Jump to content

[Help] Object interaction through script


Guest Imagine

Recommended Posts

I had a quick look for any posts on the same subject but couldn't find any.

Currently im learning a little about scripting whilst working on the Halls of Reflection script, and iv hit a snag :

When you enter the instance, i want the first door to be closed (starts open) so i use this code :

from instance_hallsofreflection

void Initialize()
   {
       HandleGameObject(GUID_Door1, true);
    }

HandleGameObject contains :

void HandleGameObjects(uint64 GUID, bool activate, bool alternative = false)

//Copy of SwitchDoorOrButton from GameObject class

{

GameObject* pGo = instance->GetGameObject(GUID);

if(activate){

pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);

}else {

pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);

}

if(pGo->GetGoState() == GO_STATE_READY){ //if closed -> open

pGo->SetGoState(alternative ? GO_STATE_ACTIVE_ALTERNATIVE : GO_STATE_ACTIVE);

}else { //if open -> close

pGo->SetGoState(GO_STATE_READY);

}

}

Whenever this method is called (or more specifically when the line) :

pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);

is called, mangos crashes with the error:

Debug Error

Run-Time Check Failure #2 - Stack around the variable 'szBuff' was corrupted

this happens when i use the above or DoUseDoorOrButton and SetGoState / SetLootState

can anyone divine the problem?

Link to comment
Share on other sites

×
×
  • 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