How to chase a NPC from room 1 to room 2 ?

Started by amigo240480, Thu 09/11/2023 20:02:48

Previous topic - Next topic

amigo240480

Hello I'm a new user. I have a scenario where the player character is chasing an NPC off the screen.
Currently as you walk on to a region it activates the NPC command to dash along it's X-Y coords to the edge. But I want the npc to then disappear and go to the next room !
There is no action available in the regions settings for this?
Only (( move npc to a different room)) but has no coordinates so it's useless?
 I have a good grasp of the basics. But now with walk cycles animations and regions walkable areas and rooms all sorted I can not think how to logically make  the NPC character leave room 1 and then start in room two.
Is this because I need to start using script now ?
Btw I'm using the older AGS as I have ADD and it took me an incredibly long time to learn how to use the original version. I tried using newer versions but I could not adapt to the changes and can not work the menus as it's all changed.  So hopefully some of you remember the older system as I can not use the newer one it would take years to adjust lol

eri0o

Sorry but which version are you using? Just checking because ags initial release is like for DOS, so one never knows.

In anyway, scripting is the way to go, if you break the problem in "something that happens" (a condition) causes "something else to happen" (an action), we can then think on how to accomplish the goal.

So for the second part, the action, there is a script function that can change the room of any character. So the same way you can do player.ChangeRoom(2, 160, 300) (Just some arbitrary room and x y position) you can also use it so with any character - like cEnemy.ChangeRoom(2, 160, 300), but this will make the enemy in the same position exactly, you may want to nudge it a bit just so the characters don't overlap.

Then the issue is triggering this, what condition causes it, I don't know which version of AGS you are using, but perhaps it's an event associated to the player being in the region and then this calls an event function, which will have the script above.

Khris

#2
Quote from: amigo240480 on Thu 09/11/2023 20:02:48Is this because I need to start using script now ?

Yeah, that's the gist of it.

To send an NPC to specific coordinates, use the RunScript action at the top the dropdown. Click the "Edit Script..." button, then write something like this in the script window that opens:
Code: ags
  NewRoomNPC(2, 3, 123, 45);
Now select "Save changes and exit" from the file menu.

This example command sends character #2 to room #3 at coordinates 123, 45.


AGScript has come a long way since then, version 2.7 was in fact released 18 years ago and featured a complete redesign of the language, allowing you to use cNPC.ChangeRoom(3, 123, 45); instead, among numerous other improvements.
I understand that it's hard for you, but the basic mechanisms haven't really changed at all. If you haven't already I recommend taking a look at version 3.4.3 for an experience much closer to the old editor but also much less outdated.

SMF spam blocked by CleanTalk