Community

AGI Programming => Mega Tokyo AGI Archive => Topic started by: Corby on April 28, 2003, 07:42:39 PM

Title: New Problem
Post by: Corby on April 28, 2003, 07:42:39 PM
Hi, I have my ego walk over a control line, which triggers f3 and causes the ego's view to change to that of running.  How can I return the ego back to normal if it walks over the same control line for a second time?
Title: Re:New Problem
Post by: robingravel on April 28, 2003, 09:04:00 PM
Let me see...

if (isset(f3)){
 if (!isset(f100)){
  set(f100);
  .....
 }
 else{
  reset(f100);
 }
}



Robin Gravel
Title: Re:New Problem
Post by: Corby on April 30, 2003, 03:21:52 AM
Still can't get this working...  what's with the ! in (!isset) Robin?? I think I just may need this explained to be verbally rather than in code. Thanks :)
Title: Re:New Problem
Post by: Andrew_Baker on April 30, 2003, 03:30:02 AM
Imagine that you have a flag (which you do).  It is either running or walking.  If your character touches the priority line, then it should swap between them, right?  However, you should probably jimmy some code to make sure that it doesn't constantly flip between the two states...  in pseudo code, it might be something like,

if (touching_line) {
    if (!locked) {  // ! means NOT
    toggle.flag(running);
    set(locked);
    }
   }
else {
   reset(locked);
   }

Something like that.  It uses two flags (one to change the state and the other to keep your ego from switching back and forth).  Unfortunately, it's been so long since I've used AGIStudio that I've forgotten the proper function calls.
Title: Re:New Problem
Post by: Sami Tervo on April 30, 2003, 04:06:12 AM
Hehehehe >:)

* Grabs flags and burns them! *

Here's a almost flag-free way: This method is based on direction of ego (v6). Checkout help-file for further information of directions (e.g. getdir)

if(f3){ // Ego hittin Signal Line
 if(v6 == 7){ // Ego coming from left
   set.view.v(v16,runninview);
   force.update(o0);// Optional, if you don't want to wait for next loop
 }
 if(v6 == 3){ // Ego coming from right
   set.view.v(v16,walkinview);
   force.update(o0);
 }
}

7 & 3 ain't sure..don't remember those right now..like I said, check out that help-file. You probably have to add more directions like coming from up-right, down-left and so on...hopefully you get the picture.

And this is good only for straight signallines..
Title: Re:New Problem
Post by: Corby on April 30, 2003, 08:17:38 PM
Great, everything's working fine, thanks!