Page 1 of 1

changing paths, using < and > (PROBLEM SOLVED)

PostPosted: Tue Mar 25, 2008 1:05 pm
by stevenp
i have a big problem, il try to put it simple all the following code is in DRAW ACTOR

if (something something < 100)
{
change path on
}

if (something something > 100)
{
change path off
}

now because this is in draw actor, using < and > is constant so basically my path is being repeated, and never reaches its full duration

how can i create some kind of "lock" mechanism that can make that code only happen once, while in draw actor, using the < and > ( if that is even posible )

or to constantly check if something is < or > but when < or > happens, only do what is inside the code once, kind of like a toggle, and can be locked...

Re: changing paths, using < and > in DRAW actor O_O!?!??

PostPosted: Tue Mar 25, 2008 3:40 pm
by Bee-Ant
You need to add "limitator" variable...(limitator or limitater)
call it as "on"
Actor>DrawActor>
Code: Select all
if(something<100)
{
    if(on==0)
    {
        ChangePath("EventActor", "YourPath");
        on=1;    //This is the locking point
    }
}
if(something>=100)
{
    ChangePath("EventActor", "(none)");
}

Actor>PathFinish>YourPath>
Code: Select all
on=0;   //Unlock the Path event

If still doesnt work, use variable to change the movement. Do you want to use it in AI movement? :roll:
Just remember, always use "limitator" variable in DrawActor to avoid that annoying looping :mrgreen:

Re: changing paths, using < and > in DRAW actor O_O!?!??

PostPosted: Tue Mar 25, 2008 7:41 pm
by Fuzzy
mojo domo wrote:
if (something something < 100)
{
change path on
}

if (something something > 100)
{
change path off
}



You also have a little problem with that code. What if "something" is exactly 100? Will Path turn off or on?

Re: changing paths, using < and > in DRAW actor O_O!?!??

PostPosted: Tue Mar 25, 2008 9:23 pm
by stevenp
omg :shock:

you your code actualy worked on the first time!!! :shock:

TY :D

+1 point

Re: changing paths, using < and > in DRAW actor O_O!?!??

PostPosted: Tue Mar 25, 2008 9:29 pm
by pyrometal
Looks like I didn't completely understand what your problem was all about in the chat room yesterday... but now I see what you wanted to do more precisely... Sorry for not being that helpful. (It's hard over a busy chat)

Re: changing paths, using < and > in DRAW actor O_O!?!??

PostPosted: Tue Mar 25, 2008 9:49 pm
by stevenp
np ty for the effort tho :) its the effort that counts

Re: changing paths, using < and > (PROBLEM SOLVED)

PostPosted: Tue Mar 25, 2008 10:01 pm
by DilloDude
also, you should change the second if to an else if. If it's already greater than 100, it won't be less tha or equal to 100 as well, so there's no need to check.

Re: changing paths, using < and > (PROBLEM SOLVED)

PostPosted: Tue Mar 25, 2008 10:12 pm
by stevenp
i just used 100 and 100 as an example,

the real valused i am using are 450 and 300

its all apart of the complex AI code Thanx wrote for me

basically its the enemy "AGGRO" code or aggrivation

if enemy gets close, chases you, then attacks you once he gets even closer,

if you attack enemy he attacks you

if you run away from enemy he chases you, untill you leave his AGGRO circle ( agro circle different for every enemy )