The Movement of NPCs

a moving event

Would it be possible to have an event that moves all the NPCs on the map down one space? It might be possible to delete each NPC and then re add them in one space lower, except that since they are constantly moving, one can never know where each NPC is....

Hmm... It is a predicament... :huh:

Aye, you can. Simply delete them and add new ones that all try to reach a specific position in the map (the place you want them to go, of course). But that might be hard if they're all moving. Do they have to move?

Well yeah.. They're supposed to be evading the target, and I wanted an event that can move them all in one direction at once...

The NPC control function doesnt seem to be able to do much except add and remove NPCs. You can't control their movements.....

Naw, you have to make new ones. I believe it's on the last page of the NPC creation wizard. Look for "try to reach a specific cell" or something similar. Then you delete the NPC and add the new one. When he's reached the target, you can delete him again and add a third one! That's how cutscenes are made. 🙂

yeah i've done that before in a previous game, (I ended up stopping partway thru) lol. But yeah, I understand that. So I guess that means that u have no idea what to do for the original problem... lol 😉

It is possible to move all the NPCs one tile (or however many you want) but they all have to be unique to do it. Each one will have two globals to track X and Y co-ordinates. If you are doing this only once, it's fairly easy because you would replace them with non-unique NPCs. The event would look like this:

NPC control:
add soldier at gb_S1X, gb_S1Y+1
delete S1
add soldier at gb_S2X, gb_S2Y+1
delete S2
And so on down the list.

But then they wouldn't get any movement animation. What if you placed a global in their animation? If the movement tiles are 30x30 and his speed is 6, you could place a global adding 1 to his coordinates at every 5th frame. So if he goes east it adds one to "SoldierX" and if he goes south east it adds one to "SoldierX" and "SoldierY" and so on. Then, when the time has come, you delete him and add "Soldierflee" or whatever at "SoldierX", "SoldierY".

Does that even make sense? :blink:

Ledorax, on Jul 30 2005, 06:56 AM, said:

But then they wouldn't get any movement animation.
View Post

They would all "jump" one tile away. 🙂 Actually, you could get them to walk there by replacing Soldier1 with an intermediate set to seek gb_S1X, gb_S1Y+1 and on reaching target, replace with another soldier. It gets a little complicated for a bunch of them, but that all depends on how Pixor wants the scene to play out.

THANKS GUYS!! Yeah that just might work... You see I wanted them to be able to move around normally and then when I hit a button they all move down a tile... So since they have to be speciall guys, I could make them always want to get to a coordinate that is equal to a certain global, (a different one for each guy). Then I could have an event that every second or something adds a random amount from 1-10 maybe. And then they would always be trying to move to that tile. The I could have it so that whenever u hit the button and activate the event that makes them move, it adds one to the Y axis to make them all move down!!! :laugh: :laugh: Thanks alot!


wait, theres a problem... You can't have an event that calls itself at the end can u... Nothing else will work.... <_<

Is there any way to have an event repeat itself, cuz i would need it to to be able to have them all move randomely. I could make an event that randomely adds or subtracts a number from the globals with their coordinates. and then I could have it wait 1 second, and then have it call itself. But that doesnt work does it.. The game won't go on until the variable finishes... :blink: It doesn't make sense!! ahhhhhhh 😮

This post has been edited by Pixor : 30 July 2005 - 11:23 AM

Heh, well you can add a "call event" flag to one of the frames in your NPC animation. So if you have eight walking frames then on, say, the sixth one it calls the event. The event itself could either set random coordinates or you could have it have a small chance it does nothing. That way the NPC will stop at times. It's up to you.

I couldn't even get an NPC to want to go to the coordinates of a global variable! You can't put tags in the "Try to reach a specific cell" boxes. They have to be numbers....

can you?

This post has been edited by Pixor : 30 July 2005 - 04:28 PM

Here's an idea which might work for you. It has to be done in an event using NPC control because, as you say, you cannot have an NPC target a global value.

When the event triggers, switch your NPCs to a look-alike which only can travel south. After a certain number of frames in the animation, call an event which replaces the NPC with one which has the normal movement in 8 directions. In this case, I do not think you need to make each NPC unique. You are changing all normal guys to south guys and then back again. If there were ten soldiers in the field, your NPC control would need to replace ten soldiers with ten retreaters, who then become soldiers again. You actually need only one trigger to turn the retreaters back into soldiers.

Yeah.. I think that just might work, It should solve all of my problems if I had the south only characters set to move every second, and that after like 1.1 seconds (or long enough for them to move down one space) I would switch them back.. hmmm it should work.. How exactly would I make it so that they can only move south.. Would I just give them a south animation? Then what...

Make a new animation. Put in it only the south going pictures. Make sure the animation is marked "standard" and not "4 direction" or "8 direction." Now when you make your new NPC, chose this animation in the NPC editor. If you give this retreating NPC a higher speed than the other one, it will look like he's running away instead of just walking. 🙂 Don't make the animation loop. At the end, call the event to change them back at "Actual X," "Actual Y." A little experimentation should show you how many frames are needed to move the distance you want. You can add or delete frames in the animation to get the desired result.

But even if the animation only has him moving south, who says he won't move North with the South animation?

Pixor, on Jul 30 2005, 07:11 PM, said:

But even if the animation only has him moving south, who says he won't move North with the South animation?
View Post

If that should happen (I don't think it will) there is another way around that. Make your NPC with zero movement but build the actual movement into the animation. One method is to make the pictures follow a path by plotting the dots in the animation editor. I think a better way is to keep adding a small area of white margin to the top of each graphic so the figure appears lower with each frame. That's how a puff of smoke keeps rising from the chimney.

Adding the white margin is easy in a program like GraphicConverter where you just select the number of pixels to add for each frame. If there are 32 pixels per tile and 8 frames in the walking sequence, simple math dictates add four more pixels to each graphic to move down one tile.

Yeah it did happen, I tried it, but that should work too.. I think we've finally solved the problem :laugh: YAY

So I'll add white to the tops, because I don't like, or understand, the whole interpolation and moving animation thing. So I'll just add white to the tops. lol. Thanx a bunch!

Edit: Whoops, guess I did it twice by accident.. don't know how that happened..
Edit: I deleted your duplicate post 🙂 ~RD

This post has been edited by Rubber Ducky : 31 July 2005 - 11:08 AM

Ok.. It all worked.. When I switch to the character that has the extra space at the top that works. But then how do I get him to switch back? It just goes back up, because it gets rid of the extra space at the top.. If I could it to switch back without moving back up that would be great!

Ok.. I lied, It still didn't work.. 😞 I used NPC Contol, and told it to delete all of that certain type of NPC, but then I still can't tell it where to add them back.. Maybe it's just impossible.... 😞

This post has been edited by Pixor : 01 August 2005 - 08:17 PM