GetEventScript / SetEventScript
Zephirius
Member Posts: 419
I was messing around with events and thought I'd try to call a heartbeat event to run said heartbeat script, when called. I having problems understanding what GetEventScript is calling for when it requires an integer to be assigned to the right side of the statement?
My GetEventScript code so far:
I'm not getting anything to run correctly - no suprise.
My GetEventScript code so far:
SetEventScript(oMonster, EVENT_SCRIPT_CREATURE_ON_HEARTBEAT, "rxx_loomevent");...and to call???
if (GetEventScript(oMonster, EVENT_SCRIPT_CREATURE_ON_HEARTBEAT) == "rxx_loomevent") { // neat code here... }
I'm not getting anything to run correctly - no suprise.
0
Comments
The integer is the event number, which you can specify by using one of the constants just as you have done above.
What I'd suggest is using the return value from SetEventScript to ensure that the command succeeded (it returns 1 on success or 0 on failure).
My first guess would be that your oMonster doesn't actually exist at the point when you're trying to set its heartbeat event.
I've been using SetEventScript() to run heartbeats on things under certain circumstances (e.g. when a player is in the area). I don't use GetEventScript() for anything in that process though and can't think of why I'd need it. I have whatever I want to happen coded into the heartbeat script itself; including, when to have the heartbeat script stop and remove itself.