How to assign a terrain tag to an event?

xChikyx

Veteran
Veteran
Joined
Aug 7, 2019
Messages
36
Reaction score
10
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

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,464
Reaction score
14,816
First Language
English
Primarily Uses
RMMV

I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. 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

Veteran
Veteran
Joined
Aug 7, 2019
Messages
36
Reaction score
10
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

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
42,464
Reaction score
14,816
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

Veteran
Veteran
Joined
Aug 7, 2019
Messages
36
Reaction score
10
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
Veteran
Joined
Oct 11, 2018
Messages
365
Reaction score
141
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

Veteran
Veteran
Joined
Aug 7, 2019
Messages
36
Reaction score
10
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 Posts

Latest Profile Posts

i want to make videogame, though i am burned out on games with RPG elements, but the only gamedev tool i know how to use is rpg maker. :/
Rakon wrote on xizorandy's profile.
Hello! I found a post of lightning strike pictures you posted. You said you made them, am I allowed to use them in my commercial project. Would be really cool!^^
evhht2zr.png

Have a nice day!
It's almost 3 month and this piece of drawing is still not finished yet.
aaaa.jpg

Really busy with other stuffs like commission and coping with personal problem.
Stella & Elyune, maybe used for promotional art if my game project finished one day.

Forum statistics

Threads
112,256
Messages
1,066,849
Members
145,866
Latest member
Hallistra
Top