Function Sub-Events are ignored

0 favourites
  • 5 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • I'm attempting to use a function to configure the stats of an object when its created depending on which weapon the player has equipped.

    When i pass the "WeaponEquipped" Variable to the function, the "System (Weapon = "Bat" sub event is ignored even though the spelling matches etc.

    If i move the code that sets the damage value etc out of that sub event, so that its at the top level of the function, it will assign the values correctly.

    So why can't i use the "System (Weapon = "Bat") check in there?

  • If it is working at the top level of the function then weapon is not Bat. Try some other action under 'weapon = bat' that is a general variable change and not related to the sprite, does that also not work ?

  • I can confirm that weapon = "bat" by moving "DamageCircle - Set TestString to "Weapon") out of the sub event. and it will indeed get the value of "Bat".

  • I mean that's not what I asked... but I think the issue is the global variable value has quotation marks around it. If you did what I asked in previous post probably you will find other actions are not working under the weapon=bat condition. Your var is equal to the string "Bat" not Bat

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Wow yeah that was it. For some reason I think i've always added quotes for strings both in the event sheets and in the global variable because strings require them. But i guess they don't if the global variable is set to type "string"

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)