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

KurayamiBlackheart

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
 

KurayamiBlackheart

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

KurayamiBlackheart

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.
 

KurayamiBlackheart

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

ScreenShot_5_26_2022_11_36_32.png
added a Panic gauge to battle. it fills up according to your actions. each character has a different passive that activates once the gauge is full. also once full, a countdown starts and after each action taken, the gauges decreases. with each character, the decrease is different.
Genuinely considering making a thread informing people how to Google.
It's time for Da Update...

Prototyping some overworld abilities. Some of the characters you'll meet on your journey can use special overworld skills to travel around. This can be something like digging holes in the ground or getting hints towards your next objective.

Even more things I made.
Equipping Abilities is very important.
fLhHhZjh.gif

Forum statistics

Threads
122,157
Messages
1,146,885
Members
160,423
Latest member
THORR1
Top