News Forums RAIN General Discussion and Troubleshooting Action Repeats forever when never repeat is set.

This topic contains 4 replies, has 2 voices, and was last updated by  cptcheerios 1 year, 10 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #13387

    cptcheerios
    Participant

    So everything but my last action call is working properly. When it hits the action at the end it calls it and the only solution I have seen is a never ending loop (which is not a valid solution). Everything but the Can AI See Target is set to never repeat (and I have done it as never repeat and it still failed to work properly).

    So are there any ideas on how to make an action call only once? I’m going to think of a work around, but is there anyway to make it behave the way I think it should (which is when BT hits an action at the end and it is set to never repeat the tree stops at that node without repeating)

    #13398

    CodersExpo
    Participant

    Is the code in the action returning a success? If not, it will repeat until it does.. unless you have it set to repeat until failure. In which case, it will repeat until it fails.

    If you just want the code to only run one time period (never repeat) regardless, then you need to set a parameter variable to act as a flag indicating do nothing if the script is entered on subsequent events or nest the action under a constraint that will determine if it gets called.

    Does this help?

    #13463

    cptcheerios
    Participant

    faceTarget Returns a success everything lights green solid that it was a success it just keeps calling the action repeatedly. I’m working out some logic in the code that the action calls to just skip the extra action calls, but its just masking the underlying problem.

    #13492

    CodersExpo
    Participant

    Oh I got ya. Yah I agree, the “Repeat Never” confused me too. There are a few ways to allow a script to run only once when triggered. Maybe the easiest is to drop it in a constraint node. The constraint would be a bool something like runMethod. When the action runs you set this variable to false: ai.WorkingMemory.SetItem<bool>(“runMethod”, false);

    We should ask about this cause I agree it seems to me that Never repeat means it would run and NEVER repeat. However, what if you wanted it to repeat again after it ran once….I suppose we would be right back here again talking about ways to trigger it on and off.

    Anyway, I’ll be interested to hear what you end up doing.

    #13565

    cptcheerios
    Participant

    Since I’m running a pivot with match target I had to setup a constraint triggered between the call of the action and the execution of the animation and its stop of the execution.

    I think you understood what meant originally about Never repeat. I want it to hit the code and end there, then if the path is reset it does it again and executes again (eg, player walks out of the AIs field of view it calls the executes the face target once and turns and face. Then the code is reset to having the character in the field of view.

    What happened was the character walked out of the field of view, then it called the action indefinitely until the character returned to the field of view. (the varCharacter!=null is because I setup an inverted field of view so that it detects what the AI cannot see)

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.