Skip to content

GetEventScript / SetEventScript

ZephiriusZephirius Member Posts: 419
edited December 2022 in Builders - Scripting
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:
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.

Comments

  • MelkiorMelkior Member Posts: 204
    It looks to me as though you are using the calls correctly. The only way the command fails is if the object doesn't exist or the object doesn't have the event type which you specified.
    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.
  • TerrorbleTerrorble Member Posts: 179
    What would you like to have happen?

    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.
Sign In or Register to comment.