Jump to content

scripting question about world game objects


Guest chatico
 Share

Recommended Posts

I'm writing a custom script that has a button, in the function for the button I'm spawning some mobs that are also scripted. I need to be able to access the game object of the button from with in the spawned creatures script. All the ways I have tried end up crashing the server. Seeing the game object is not in a instance I'm not sure how this can be done.

I'm assuming because this has sat here for 8 hours with out a reply that you can not do this. This is a basic necessary functionality of the scripting system that needs to be added. I would add it but not having this is just lazy on your guys part. To not be able to script complex scripts with out being in an instance is retarded.

Link to comment
Share on other sites

Why not use mangos iterators for it ?

for example

                                CellPair p(MaNGOS::ComputeCellPair(m_creature->GetPositionX(), m_creature->GetPositionY()));
                               Cell cell(p);
                               cell.data.Part.reserved = ALL_DISTRICT;

                               MaNGOS::NearestGameObjectEntryInObjectRangeCheck go_check(*m_creature,objectentry,range);
                               MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck> checker(m_creature, p_GameObject,go_check);

                               TypeContainerVisitor<MaNGOS::GameObjectLastSearcher<MaNGOS::NearestGameObjectEntryInObjectRangeCheck>, GridTypeMapContainer > object_checker(checker);
                               CellLock<GridReadGuard> cell_lock(cell, p);
                               cell_lock->Visit(cell_lock, object_checker, *m_creature->GetMap(), *m_creature, range);

                               if (p_GameObject)
                               {
                                   // Here You have access to Your gameobject
                               }

I didn't test and compile it but should work if You ofc change objectentry, range and pointer (i used m_creature cause You said its creature script)

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use