Imagine
-
Posts
5 -
Joined
-
Last visited
Never -
Donations
0.00 GBP
Content Type
Profiles
Bug Tracker
Wiki
Release Notes
Forums
Downloads
Blogs
Events
Posts posted by Imagine
-
-
I managed to solve the first problem, it was a combination of bad code and typo's
anyway i have edited the question to something else im having trouble with
-
When a player enters an instance, the script associated with that instance is executed..
if that player then leaves the instance, the script continues to run.
This is what i have gathered so far from some tests, i would like to know if :
1) Is there some kind of auto timeout for instance scripts if no players are inside
2) Is there a way of disposing of that instance when there are no players inside
Also do scriptedAI scripts continue to run when there are no players inside of the same instance
the problem is im currently using the Update method in scriptedInstance to control some events (talking, moving, spawning mobs)
and im concerned about it causing unnecessary processor usage if the script is running when there are no players in that instance.
-
I hadn't thought of that, i assumed the world was populated before Initialize() was called,
anyway i moved that line to OnPlayerEnter and it seems to work now.
Thanks for the info
-
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?
ScriptedInstance Update
in OldGeneral discussion
Posted
thanks,
also as a side question, is there any method of getting a list of all creatures of entry X, Y or Z in an instance
or should i have to add them to a list using OnCreatureCreate()
Im trying to create a function that returns false if there are any creatures still alive that have a specific (or one of many) entry(s)