Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: shaungaryevans on Tue 19/05/2009 21:10:08

Title: Can you have only one character actviating a hotspot
Post by: shaungaryevans on Tue 19/05/2009 21:10:08

I now have two characters on the same time, one following the other one. I have also got a two hospots and when you go over thing happens and when you go over the other one it does the oppusite (on/off). Can you put a code in so that if char A walks on the hopstot, something happens for him and nobody else please?
Title: Re: Can you have only one character actviating a hotspot
Post by: Vince Twelve on Tue 19/05/2009 21:30:33
Just use


if(player==cCharsName){
  //do stuff
}


in the code for the region's walk onto event.
Title: Re: Can you have only one character actviating a hotspot
Post by: Trent R on Tue 19/05/2009 21:54:08
1) Use regions, not hotspots. If something happens when you walk onto it, then use a region.

2) Use the static Region.GetAtRoomXY to check which character is there. The manual includes a script that will work for you.


~Trent
Title: Re: Can you have only one character actviating a hotspot
Post by: Khris on Tue 19/05/2009 22:11:22
Doesn't only the current player character trigger region events?
Title: Re: Can you have only one character actviating a hotspot
Post by: Vince Twelve on Tue 19/05/2009 22:30:03
Good point Khris, I didn't notice that he said one char was following the other.  I assumed we were talking about multiple playable characters.  If so, it shouldn't trigger unless the current player walks on it.

That is, if he's using regions and not hotspots as he said.
Title: Re: Can you have only one character actviating a hotspot
Post by: Trent R on Tue 19/05/2009 22:35:55
Ah, I forgot about that. Considering it says under the events pane "Player..." for each, I'd say that you are right.

So if it's the player, you should be covered. Otherwise, use GetAtRoomXY in the rep_exec.


~Trent