Kay_ande

Artist
Veteran
Joined
Jan 9, 2021
Messages
44
Reaction score
10
First Language
English
Primarily Uses
RMMV
Hello,I created an event that needs to happen when the player's health reaches 0 by a self-damage item,and only after it the game-over should happen.
How can this be done?
 

Attachments

  • Снимок экрана (769).png
    Снимок экрана (769).png
    59.4 KB · Views: 6

Shaden

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
173
Reaction score
137
First Language
French
Primarily Uses
RMMV
Well, are you okay with plugins or not ? :3
Is it suppose to only happen after an item is consumed ?
 

Kay_ande

Artist
Veteran
Joined
Jan 9, 2021
Messages
44
Reaction score
10
First Language
English
Primarily Uses
RMMV
Is it suppose to only happen after an item is consumed ?
Yes,i'm also okay with plugins
 

Shaden

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
173
Reaction score
137
First Language
French
Primarily Uses
RMMV
Yes,i'm also okay with plugins
I'll try to go without plugin first.

For the items you could always use a common event inside the item, and put in the item damage formula this :
v[x] = b.actorId(); 0;

replace X by the ID of your own variable, it'll store the actorID inside this variable. Now in the common event triggered by your item, check the player's health like this (place a condition, then use a script for the condition) :
$gameActors.actor($gameVariables.value(x))._hp <= y
where again x is the ID of your own variable where you stored the ID of the actor previously. y should be the number of HP your pill actually remove from the player, if you want you can make it a variable too, like this :
$gameActors.actor($gameVariables.value(x))._hp <= $gameVariables.value(y)
where Y is the ID of your own variable where the damage dealt by the item is stored. this condition script will be fulfilled if the hp of the actor is lower than the damage it would takes from the item (so, if the actor reaches 0 hp by consuming it), enter there the code to be executed, then call the game over scene.

and if the condition is not met, simply remove from the actor's hp the value, with this script call :
$gameActors.actor($gameVariables.value(x))._hp -= $gameVariables.value(y)

and done ! :D lemme know if I got something wrong if you have any issue with it.

EDIT : corrected the code !
 

Kay_ande

Artist
Veteran
Joined
Jan 9, 2021
Messages
44
Reaction score
10
First Language
English
Primarily Uses
RMMV
I'll try to go without plugin first.

For the items you could always use a common event inside the item, and put in the item damage formula this :
v[x] = b.actorId(); 0;

replace X by the ID of your own variable, it'll store the actorID inside this variable. Now in the common event triggered by your item, check the player's health like this (place a condition, then use a script for the condition) :
$gameActors.actor($gameVariables.value(x))._hp <= y
where again x is the ID of your own variable where you stored the ID of the actor previously. y should be the number of HP your pill actually remove from the player, if you want you can make it a variable too, like this :
$gameActors.actor($gameVariables.value(x))._hp <= $gameVariables.value(y)
where Y is the ID of your own variable where the damage dealt by the item is stored. this condition script will be fulfilled if the hp of the actor is lower than the damage it would takes from the item (so, if the actor reaches 0 hp by consuming it), enter there the code to be executed, then call the game over scene.

and if the condition is not met, simply remove from the actor's hp the value, with this script call :
$gameActors.actor($gameVariables.value(x))._hp -= $gameVariables.value(y)

and done ! :D lemme know if I got something wrong if you have any issue with it.

EDIT : corrected the code !
Doesn't seem to work...did I do everything right?
 

Attachments

  • Скриншот 2022-01-18 18.19.56.png
    Скриншот 2022-01-18 18.19.56.png
    37.1 KB · Views: 3
  • Снимок экрана (773).png
    Снимок экрана (773).png
    31.2 KB · Views: 3

Shaden

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
173
Reaction score
137
First Language
French
Primarily Uses
RMMV
You're defining again the variable 1 before checking it, which changes its value. use another variable for pill use.

Also do not deal the damage on the player right away, you have to remove the HP inside the event, not the damage formula, else the gameover event won't work. remove everything after "0;" in the damage formula. And use the last script call code I gave to you to remove HP from the player.

$gameActors.actor($gameVariables.value(1))._hp -= $gameActors.actor($gameVariables.value(1)).atk * 3.4375

will do the trick, for the checking, use this :

$gameActors.actor($gameVariables.value(1))._hp <= $gameActors.actor($gameVariables.value(1)).atk * 3.4375
 
Last edited:

Kay_ande

Artist
Veteran
Joined
Jan 9, 2021
Messages
44
Reaction score
10
First Language
English
Primarily Uses
RMMV
You're defining again the variable 1 before checking it, which changes its value. use another variable for pill use.

Also do not deal the damage on the player right away, you have to remove the HP inside the event, not the damage formula, else the gameover event won't work. remove everything after "0;" in the damage formula. And use the last script call code I gave to you to remove HP from the player.

$gameActors.actor($gameVariables.value(1))._hp -= $gameActors.actor($gameVariables.value(1)).atk * 3.4375

will do the trick, for the checking, use this :

$gameActors.actor($gameVariables.value(1))._hp <= $gameActors.actor($gameVariables.value(1)).atk * 3.4375
Realized the problem was from another script in the item...but thanks a lot!it works.
 

Shaden

Phoenix of darkness.
Veteran
Joined
Sep 4, 2019
Messages
173
Reaction score
137
First Language
French
Primarily Uses
RMMV
Realized the problem was from another script...but thanks a lot!
Oh, alright.

I don't know how you did it but if it works, great ! :kaohi:
Don't hesitate to ask if you have any more issue.
 

Latest Threads

Latest Posts

Latest Profile Posts

Beep-Beep-Motha-facka.gif

Just finished and uploaded the delivery truck base/sprite sheet. I've been steadily replacing the default assets with early modern alternatives. The air-ship for a biplane, horse-drawn wagon for a delivery truck, and next a sailboat for a steam-powered passenger liner (think of the SS Olympic and RMS Titanic).
I caught a shiny magikarp on pokemonGO today AND finally saw Detective Pikachu and it was so cute and I'm still so hype AHHHHH!!!
one of the coolest things I've learned from the forums is the ability to give yourself a hitbox. I have a move you can do on the fields. shoulder tackle. thanks to the forums, that tackle triggers self A switches on some events. NPC's and the environment now react to the tackle. awesome.
I really liked how this one turned out! :kaopride:
WYqMPf6.png

Character (Yes, this is a character): Nibiru the Primal Being from Yugioh.
Dragon Quest style enemy selection plugin work in progress:

Quest_Targeting.png

It's a simple targeting system from the NES era. Select an enemy group; single-target skills will target the first enemy in that group.

Quest-Targeting-Animated.gif

Forum statistics

Threads
121,936
Messages
1,145,288
Members
160,207
Latest member
RiceKun
Top