I've been using Call Function events for my various integrations and it was working fine when I called a function on a component on the Player, but now I have a DamageZone with an event on an enemy AI and when I use Call Function in that event, the function never gets called. The only thing that I think that is different is that on the one that works, the Event Settings have the Player actor added and the Target is set to Actor/Player. However, the enemy AI is not the Player, but I can't figure out what I'm supposed to set as the Target so that the function will get called on the enemy AI. I've tried various different options, but nothing seems to work.
  • The game object the damage zone is on is available as Event Object, i.e. an Object actor with Event Object enabled.

    The attacker is available as Starting Object actor.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks. I thought I had already tried that, but it didn't work. Now it is working. However, in my event I want to tell my function the current HP of the AI so that I can update the third party AI to the current HP. However, the Status to variable event is very confusing. Here is how I have it set up:

    Status Value: HP
    Used Value: Current Value

    Variable Settings
    Variable Origin: Local

    Variable Key
    Value Type: Game Variable
    Value: HP
    Variable Origin: Local
    Operator: Set

    But the value that gets sent to my function when I tell it to use the HP Local GameVariable is always 0. I increased the health of the AI so that it won't die in a single attack so I know the value can't be going to 0 in one attack.

    What confused me the most is that there are 2 Variable origin settings and I have no idea why.
  • Your issue is due to a mistake that's often made - when defining the Variable Key, you usually use the Value value type, since you want to define the key that is used.

    Using Game Variable as value type for a variable key will use the (string) value that is stored in the defined key.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Well, it makes sense why one would make that mistake. If you click on value, the help text states the following:

    Depending on the Value Type:
    Value: The text will be used as value.
    Game Variable: The text is the key (name) of a game variable (string) that holds the value that will be used.

    To me that means the Value is the key name of the variable that stores the value, which is exactly what I want. But you say to use Value, which says the text will be used as the value, which to me means that the Value is going to be whatever I type in that field.

    I guess it just doesn't make sense. When I look at it, I think that the Status value is going to be stored in the Game Variable indicated by the Value key that I specify.

    But, what you suggest does work. It just doesn't make sense.
  • edited November 2019
    Now, I'm even more confused. How does this even work? In the next node in the event after storing the Status value, I specify that I want to send an int parameter to my function and I tell it that it's a Local Game Variable with a Key of HP. But in the previous node, we no longer specify Game Variable and we have no field that specifies the variable key at all anymore. So how does it get the correct value from a variable Key called HP if we didn't specify that in the Status to Variable event?

    [EDIT]
    Nevermind. We did specify HP in the Value. My bad.
    Post edited by tomjscott on
  • This is always in context of the individual setting - e.g. when it's about defining a Variable Key, the value is what is used as variable key.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • gamingislove said: This is always in context of the individual setting - e.g. when it's about defining a Variable Key, the value is what is used as variable key.
    I understand it is in context that's why I read the help while clicking on each individual field. And according to the context help, it isn't what you've explained here. That's fine now because I understand it, but the help is confusing.
Sign In or Register to comment.