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,860
Reaction score
14,989
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

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,860
Reaction score
14,989
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
372
Reaction score
144
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've decided to try and be more social and less nervous about engaging. I'm always over thinking things - from now on when I'm worried or don't get something I'll just ask.
Sometimes a mechanic that is meant to add challenge is just annoying. Even the Final Fantasy games did not completely escape this pitfall of design. (FF8 draw system I'm looking at you - grrrr)
starting working on the sprites for one of my games major antagonists finally. here's the first frame of his chanting motion in battle.
Have spent too much time hammering out with a friend just how to make a reoccurring enemy that permanently learns skills you use against her.
I know what I want in a loose sense. Maybe I should just make a post asking for opinions and suggestions.

Forum statistics

Threads
113,737
Messages
1,077,081
Members
147,764
Latest member
ZeroForceX
Top