Can I have a NPC start an action? [SOLVED]

Started by Candle, Fri 10/12/2004 03:09:23

Previous topic - Next topic

Candle

I want to have a NPC walk in to a region and start an action ( open door) .

TerranRich

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.
Status: Trying to come up with some ideas...

Candle

I was looking in the code but didn't see anything ? but not real sure where to look in it .

TerranRich

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.
Status: Trying to come up with some ideas...

Candle

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 .

TerranRich

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.
Status: Trying to come up with some ideas...

Candle

#6
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 .
Code: ags
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 .
Code: ags
NewRoomNPC(ROBOT, 6, 60, 215); 


Had the wrong view .. it works fine now .

SMF spam blocked by CleanTalk