xChikyx

Regular
Regular
Joined
Aug 7, 2019
Messages
43
Reaction score
12
First Language
English
Primarily Uses
RMXP
I'm working on a scrip that makes the NPCs follow a direction/destination, and everything is working pretty good so far. The problem comes when I introduce more than 1 NPc and they "collide".

The scrip checks the terrain tags next to the NPC moving, so as both NPCs colliding would be in the terrains that the script would check as aviable, and tehreofore would try to move to each other space's. If i manage to assign a terrain tag to each fo the NPCs, it would completely solve my problems, but I have no idea at all how to make it. If someone can please tell me an easy way to do this, I'll be really thankful
 

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,153
Reaction score
16,957
First Language
English
Primarily Uses
RMMV

I've moved this thread to RGSSx Script Support. Thank you.



(this is for RMXP)

Terrain tags go on the map, not on events.

What do you WANT to happen when they collide? Just let them go through each other?

It would be easier to help if you gave a screenshot so we could see what kind of path you're putting down, and what causes the events to move into each other.
 

xChikyx

Regular
Regular
Joined
Aug 7, 2019
Messages
43
Reaction score
12
First Language
English
Primarily Uses
RMXP
[move]RGSSx Script Support[/move]

(this is for RMXP)

Terrain tags go on the map, not on events.

What do you WANT to happen when they collide? Just let them go through each other?

It would be easier to help if you gave a screenshot so we could see what kind of path you're putting down, and what causes the events to move into each other.
I'm basically giving the NPCs AI. I introduce a coordinate and they move until they reach it, dodging obstacles, searching the closest route, and so. It's not exactly a defined path. If I give NPC1 the coordinate 3,5 it would walk to it by its own. If I give NPC2 the coordinate 17,8 it would do the same. The problem is that, if for some reason they get to cross paths, they stop.
So, when 2 NPCs meet, they should see each other as obstacles so they dodge each other. As it is right now, they meet and they just stop, trying to invade the other NPC's space as it's a viable space for them to walk into in any other circumstance.

I tried to make that each NPC changed temporally the terrain tag of the tile they are in, but it didn't work ahhaha The other option I have in mind is to make so each NPC knows the coordinates of each other NPC and avoid it that way, but that's WAY too much work for that. Even tho, this idea gives me a LOT of room to develop interactions among NPCs if they walk nearby, or stuff like that, but again, it's too much work. I don't want to make the events pass-through either. The third option could be to make temporal "goals" so, if the NPC remains in the same spot for let's say 2 seconds, it "changes its mind" and moves somewhere else, and then resume the main "goal".

But, of course, if I could assign a terrain tag it would be much easier. If it's definitely not possible it's okay, just let me know.
 

Shaz

Keeper of the Nuts
Global Mod
Joined
Mar 2, 2012
Messages
46,153
Reaction score
16,957
First Language
English
Primarily Uses
RMMV
Why not include the default check when it wants to know if the event can move onto a tile? It won't allow them to move if there is another event on the tile, so it has to go in a different direction.
 

xChikyx

Regular
Regular
Joined
Aug 7, 2019
Messages
43
Reaction score
12
First Language
English
Primarily Uses
RMXP
Why not include the default check when it wants to know if the event can move onto a tile? It won't allow them to move if there is another event on the tile, so it has to go in a different direction.
what do you mean with the default check?
 

KK20

Just some XP Scripter
Regular
Joined
Oct 11, 2018
Messages
486
Reaction score
199
First Language
English
Primarily Uses
RMXP
what do you mean with the default check?
Game_Character#passable?

Why do you need to use terrain tags and not just the default collisions? You want to restrict their movement to certain passable tiles only?

Also, there are a number of pathfinding scripts out there. Is there a reason you're not wanting to use any of them?
 

xChikyx

Regular
Regular
Joined
Aug 7, 2019
Messages
43
Reaction score
12
First Language
English
Primarily Uses
RMXP
Game_Character#passable?

Why do you need to use terrain tags and not just the default collisions? You want to restrict their movement to certain passable tiles only?

Also, there are a number of pathfinding scripts out there. Is there a reason you're not wanting to use any of them?
idk, didn't check them before making mine lol

the thing is that I used the script i made to check if a player can place an item in X place and developed it to make the NPCs "see" with it too... i'll check if that code works. if not, i think i'll make a mixture of solutions hajaja
 

Latest Threads

Latest Profile Posts

I've been so lazy about doing art but I finally decided to buckle down and get some work done on the party!

aa312ffbcd667933.png

3d554012e96e4526.png
SallyFaceTest.png
Testing the first face in battle!
ScreenShot_9_20_2023_6_58_43.png
been working on my intro off and on for a while. I finally like it lol. it took me redoing it like 4 times to get to this point. I think it set's up things a lot better now.

Forum statistics

Threads
134,683
Messages
1,249,681
Members
177,415
Latest member
vigneshwaran
Top