Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Raggit on Fri 23/05/2003 02:20:12

Title: Controling NPCs with different cursor commands...
Post by: Raggit on Fri 23/05/2003 02:20:12
I could probably do this on my own but It'd take awhile to figure out!

Anyway, I want the player to be able to move some NPCs around by clicking a custom cursor on him, and then using the walk cursor where he wants him to go.

So here is how it should work:

The player uses the "select this character" cursor on the NPC and then clicks the walk icon on any walkable area and the NPC will go there.

Any way this can work easily?
Title: Re:Controling NPCs with different cursor commands...
Post by: Ishmael on Fri 23/05/2003 13:02:57
SetPlayerCharacter(CHARID);
Title: Re:Controling NPCs with different cursor commands...
Post by: Jimi on Fri 23/05/2003 13:07:05
or

character[CHARID].x
character[CHARID].y
Title: Re:Controling NPCs with different cursor commands...
Post by: Ishmael on Fri 23/05/2003 13:15:07
I think the NPC's should walk there... or?
Title: Re:Controling NPCs with different cursor commands...
Post by: Scorpiorus on Fri 23/05/2003 16:09:27
QuoteThe player uses the "select this character" cursor on the NPC and then clicks the walk icon on any walkable area and the NPC will go there.
And how you suppose to return the walk mode to normal state when it is applied to the player character?
Title: Re:Controling NPCs with different cursor commands...
Post by: am on Fri 23/05/2003 16:21:32
To return to normal character after clicking once with walk-to you could put in the "on click"
if cursorMode=walk && charid=??
moveCharacterBlocking(....)
setPlayerCharacter(?)
....

(you should probably also disable and enable things like inventory, use and etc.)
Title: Re:Controling NPCs with different cursor commands...
Post by: Scorpiorus on Fri 23/05/2003 17:13:50
Yep, just wondering if he would like to return to normal state immediately after NPC has done his moving or maybe an option? :P

-Cheers
Title: Re:Controling NPCs with different cursor commands...
Post by: Raggit on Fri 23/05/2003 22:51:55
No, I want the player to be able to control all actions of the NPC, wich becomes the player character when selected, including the inventory and stuff.  The selection icon is a standard function.
All the player has to do is select it and click it on the NPC he wants.  Then he just clicks the walk icon and so on.

I can't reveal exactly what I'm doing until I'm sure it will all work out.

Title: Re:Controling NPCs with different cursor commands...
Post by: Scorpiorus on Fri 23/05/2003 23:09:55
ok, then just do what TK said:
Quote from: TK on Fri 23/05/2003 13:02:57
SetPlayerCharacter(CHARID);

You can use unhandled_event (int what, int type) to achieve what you want:

function unhandled_event (int what, int type) {
 if (what == 3 && type == 6) {
         SetPlayerCharacter(GetCharacterAt (mouse.x, mouse.y));
 }
}

Now whenever you click on a character with USERMODE1 cursor mode you get switched to that one.