Having some trouble with an event set to "event touch" trigger.

Jennavieve

Veteran
Veteran
Joined
Oct 21, 2020
Messages
90
Reaction score
87
First Language
English
Primarily Uses
RMMZ
I want to put a type of NPC in the game that follows the player and when the NPC touches the player it drains a set amount of the player's HP. I can get it to do that just fine but once it touches the player, the player gets stuck and the NPC continually touches the player, draining their HP until there's none left. That's not how I want it to work. I want it to drain the set amount once and then start over at following the player again.

I tried putting in a self-switch after the "decrease HP" command and that seemed to work the way I wanted at first but then when I edited it and tried to change the amount of HP it steals, it went back to functioning the same way it did before. Even after I changed the HP drain amount back to 1 like it was when it worked, it continued to function like it did originally again.

So now I'm just completely confused. How the heck do you get an event to not stick to the player once it touches them and does its thing?
 
Joined
Jul 12, 2020
Messages
156
Reaction score
29
First Language
English
Primarily Uses
RMMV
In case I'm not mistaken, wouldn't you need to implement a "wait" time? Like, idk...about 30-60 frames? That way, the event would stop constantly draining HP from the player when they touch them.

As for the player getting stuck, there could be a number of ways around that.
Have you tried setting the player-movement route to force the player away from the event? Perhaps allow the "skip" instead of "wait for completion"?

I don't believe you need switches for something like this...could be wrong though.
 

BK-tdm

Manga Maker
Veteran
Joined
Jun 21, 2018
Messages
249
Reaction score
686
First Language
English
Primarily Uses
RMMV
Try making the event and player jump back 1 step then do the hp drain effect, that way the event cant re-trigger instantly as you're not touching it anymore and 2 spaces should be enough room for the player to run before it catches up again (if it isnt, then adjust accordingly).

Also make sure this event is parallel and not autorun, as autorun will block player input until is resolved and if the touching is constant you will be looping the event, resulting in a slow looped death everytime.
 

Jennavieve

Veteran
Veteran
Joined
Oct 21, 2020
Messages
90
Reaction score
87
First Language
English
Primarily Uses
RMMZ
In case I'm not mistaken, wouldn't you need to implement a "wait" time? Like, idk...about 30-60 frames? That way, the event would stop constantly draining HP from the player when they touch them.

I tried this too and it didn't work either. It only made it take a little longer to drain all of the player's HP.

As for the player getting stuck, there could be a number of ways around that.
Have you tried setting the player-movement route to force the player away from the event? Perhaps allow the "skip" instead of "wait for completion"?

I think this is the solution my brain was trying to think of next but I was in brain fart mode already and couldn't get there lol. I'll try out the player movement command and hopefully that does the trick. Thank you :)
 

Jennavieve

Veteran
Veteran
Joined
Oct 21, 2020
Messages
90
Reaction score
87
First Language
English
Primarily Uses
RMMZ
Try making the event and player jump back 1 step then do the hp drain effect, that way the event cant re-trigger instantly as you're not touching it anymore and 2 spaces should be enough room for the player to run before it catches up again (if it isnt, then adjust accordingly).

I like the jump idea! That should do the trick and give a little more visual queue to the event as well. Sounds like exactly the solution I was looking for. Thank you for the idea!

Also make sure this event is parallel and not autorun, as autorun will block player input until is resolved and if the touching is constant you will be looping the event, resulting in a slow looped death everytime.

It's set to trigger with event touch, so it's not parallel or autorun. I do have a parallel process with a delay timer so that the NPC doesn't show up until a half-second after the player steps over the square that triggers its appearance. That part is working fine though. Of course, now that I'm writing this out I'm realizing I don't even need that either lol.
 
Last edited:

Jennavieve

Veteran
Veteran
Joined
Oct 21, 2020
Messages
90
Reaction score
87
First Language
English
Primarily Uses
RMMZ
In case I'm not mistaken, wouldn't you need to implement a "wait" time? Like, idk...about 30-60 frames? That way, the event would stop constantly draining HP from the player when they touch them.

The wait time thing ended up being the key. The other solutions you guys suggested also worked but I didn't like the way it looked with player movements or jumps. I ended up putting a wait command as a movement route for the NPC with wait unchecked and now it's working how I wanted. I tried just doing a regular wait command before and that was why it didn't work originally. Thank you again!
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,905
Reaction score
4,831
First Language
EN, FR
Primarily Uses
RMMZ
I'm assuming this is in RPG Maker MZ. Moving this thread since this is an implementation question.

I've moved this thread to RPG Maker MZ. Please be sure to post your threads in the correct forum next time. Thank you.


@Jennavieve , please avoid double posting, as it is against the forum rules. You can use the "Edit" function on your posts to add additional information you've forgotten or respond to multiple people. You can review our forum rules here. Thank you.

 

Latest Threads

Latest Posts

Latest Profile Posts

Is there any way to get more than 8 enemies in a troop in RMMV or is that limit pretty much hardcoded into the engine?
Stream will be live shortly with some game development! Feel free to drop by!
Finally working actively on Tundra! I'd like to share my wife's WIP art for the starting map and a rough draft of one of the later characters, Katrina. She's very eager to hear any feedback you might have!1623790662347.png
Got my first vax today, arm is a bit numb, but nothing odd so far. :kaopride:
dYOm9IY.jpg
image_2021-06-15_212613.png
Looks a bit.....kid friendly. Then again, I suppose that does with with a lot of retro themes... Crap, already spotted a flaw xD

Forum statistics

Threads
112,266
Messages
1,066,941
Members
145,882
Latest member
Vincentus
Top