playMaker

Author Topic: Variable lock?  (Read 1608 times)

Grendal

  • Playmaker Newbie
  • *
  • Posts: 31
Variable lock?
« on: September 13, 2015, 02:48:58 PM »
OK here is what I am trying to do:

I have an AI entity that detects a player tagged object and makes a beeline for it.
I have a timer that makes AI entity stop chasing if the player decides to run away (and is faster) its a simple wait time transition if attack state hasn't transitioned in time allotted. What I would like to do is have the AI Entity go back to its starting location. It would be fairly simple to grab the starting vec3 and store it and use it to re position.. IF my combat system wasn't a constant running loop. In my system the set variable may update numerous times if the player and AI battle, run, battle, run.. etc.

Now I know I could make another variable and use it to let vec3 storing state to know if its safe to overwrite or not but this would be so much simpler if you could lock/unlock a variable via an action. This would allow me to simply lock the vec3 value at state exit and unlock it after combat ends or timer expires.

Anyone know of such a thing in Playmaker without having to write my own?

I will gladly accept completely new ideas on how to do this as well. :)
« Last Edit: September 13, 2015, 02:50:50 PM by Grendal »

Grendal

  • Playmaker Newbie
  • *
  • Posts: 31
Re: Variable lock?
« Reply #1 on: September 15, 2015, 04:57:41 AM »
I went ahead with the variable toggle route.

I still think a variable data lock would save several states in these situations.

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: Variable lock?
« Reply #2 on: September 15, 2015, 08:22:08 AM »
can't you just not update the variable?
if your combat AI loops, just keep the state where it grabs the initial position out of the loop