Skip to content

DoOnce? BCS

CallirgosCallirgos Member Posts: 105
Hey Everyone,

I've got a combat script with a wizard, and I'd like them to fire Magic Missile if it is memorized, but only once and then move on to the next part of the script.

Looking around gibberlings3, but I don't see a way to do a "doOnce". Is there a way?

thank you.

Comments

  • jasteyjastey Member Posts: 2,669
    I'm not sure I understand the question correctly. Having a script block fire only once is easily done by setting a variable inside it. E.g. the variable is "0" when the script block is called and set to "1" upon firing the Magic Missile. After that, the script block (and the Magic Missile) will not fire until the variable is reset to "0" which could be done at the end of the script or whenever you want the mage to consider firing a MM again.
    These checkvariables are needed inside script blocks anyway to prevent them from looping, i.e. firing repeatedly which leads to the "stutter" bug behavior where NPC constantly interrupt any of their actions.

    Do not forget to register your own modding prefix: https://www.gibberlings3.net/forums/topic/1649-community-filename-prefix-reservations :)
  • CallirgosCallirgos Member Posts: 105
    Ok. Thanks. What is the format for declaring a new variable?
  • jmerryjmerry Member Posts: 3,822
    SetGlobal("name","parent",value). Or, for timers, SetGlobalTimer (in-game time) or RealSetGlobalTimer (real time). The first parameter is the variable name, the second is GLOBAL for a global variable not tied to any specific object, LOCALS for a variable tied to the object that this script belongs to, or an object's identifier. The format is the same for defining a new variable or giving a new value to an existing variable.

    Of course, you could have just looked at basically any existing script to get this.
    jastey
  • CallirgosCallirgos Member Posts: 105
    AH, I have registered a prefix in 2013. Though it's some time. Thanks

    gfwndhr9vdz2.png
Sign In or Register to comment.