Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Candle on Fri 10/12/2004 03:09:23

Title: Can I have a NPC start an action? [SOLVED]
Post by: Candle on Fri 10/12/2004 03:09:23
I want to have a NPC walk in to a region and start an action ( open door) .
Title: Re: Can I have a NPC start an action ?
Post by: TerranRich on Fri 10/12/2004 03:37:33
Okay. Then do it! :P Have you even tried it?

Here's a hint: the NPC doesn't necessarily need to trigger the region's walk-on code. You could do it all manually without that region.
Title: Re: Can I have a NPC start an action ?
Post by: Candle on Fri 10/12/2004 03:46:21
I was looking in the code but didn't see anything ? but not real sure where to look in it .
Title: Re: Can I have a NPC start an action ?
Post by: TerranRich on Fri 10/12/2004 03:50:12
Oh. You're right.

You mean that you can't really control the NPC's movements, right? Will this be a blocking action? If so, it can easily be done by temporarily setting the NPC as the player character and using regular code that way. Otherwise, I don't really know. If this is a background action, I will move ths thread to the Tech forum for more knowledgeable AGSers to look at.
Title: Re: Can I have a NPC start an action ?
Post by: Candle on Fri 10/12/2004 03:53:50
Well it is a Robot that will be in the room when the player enters the room . so I want it to walk across the room  and walk on the Region  or a hotspot  and open a door  hit the next Region  to go to the next room .
Title: Re: Can I have a NPC start an action ?
Post by: TerranRich on Fri 10/12/2004 04:58:06
Then do what I said above and temporarily make it the player character. I don't know if regions are triggered by NPCs walking across them, but if not, whatever code you have that is triggered by walking across it should be done manually upon entering the room along wth moving the robot.
Title: Re: Can I have a NPC start an action ?
Post by: Candle on Fri 10/12/2004 05:08:03
Well I have it working but one problem is he slides to the right and not turn and walk to the door ? this is the .
FaceLocation(ROBOT,245,198);
MoveCharacterBlocking(ROBOT,220,198,1);
Wait(20);
AnimateObject(0,0,0,0);
MoveCharacterBlocking(ROBOT,280,198,1);
NewRoomNPC(ROBOT, 7, 256, 219);

I have him come from the start room with this code .
NewRoomNPC(ROBOT, 6, 60, 215);

Had the wrong view .. it works fine now .