Status
Not open for further replies.

Winek

Veteran
Veteran
Joined
Apr 12, 2017
Messages
34
Reaction score
5
First Language
English
Primarily Uses
RMMV
Hey, I think it's the proper place to post (not sure since I'm new here) but I'd need help for a lunatic mode of the said plugin.

Basically, I want to make a skill that give a poison to an enemy. If the enemy bear the poison as they die, a random foe will be chosen and given the state as well. (Think of something like infections)

So here's what I got:
<Reapply Ignore Turns>
<Custom Respond Effect>
//Check if the enemy is dead
if (user.hp <= 0) {
// Get a random enemy
var members = this.friendsUnit().aliveMembers();
members.splice(members.indexOf(target), 1);
var member = members[Math.floor(Math.random() * members.length)]
if (member) {
//Play an animation and pass over the infections
member.startAnimation(60);
member.addState(22);
member.setAtk(user.atk);
member.setDef(user.def);
member.setMat(user.mat);
user.performCollapse();}}
</Custom Respond Effect>

<Custom Action End Effect>
//Apply poison effect
var dmg = (115 + a.def * 90) + (a.atk * (0.50 + a.def * 0.005) + a.mat * (0.50 + a.def * 0.005)) * a.def;
user.gainHp(-Math.ceil(dmg * user.elementRate(8)));
user.startAnimation(146);
user.startDamagePopup();
//Check if the enemy is dead
if (user.hp <= 0) {
var members = this.friendsUnit().aliveMembers();
members.splice(members.indexOf(target), 1);
var member = members[Math.floor(Math.random() * members.length)];
if (member) {
//Play an animation and pass over the infections
member.startAnimation(60);
member.addState(22);
member.setAtk(user.atk);
member.setDef(user.def);
member.setMat(user.mat);
user.performCollapse();}}
</Custom Action End Effect>

This SHOULD be working, but I encounter two problems:

First, if I kill the foe without if falling for poison, like using a spell on it (first part), strictly nothing will happen. I'm trying to figure
out why, but can't seem to get it! I mean, it's literally the same as the second part without the poison.

Secondly, the most gruesome: in the second part, it only partly works. If an enemy dies from the poison, they will collapse and pass over the state to another enemy, sometimes even creating a chain. Sadly, there is ONE problem that pisses me off badly.
If there is only one other enemy when the infected enemy dies, this part never applies and I have no idea why.

if (member) {
member.startAnimation(60);
member.addState(22);
member.setAtk(user.atk);
member.setDef(user.def);
member.setMat(user.mat);
user.performCollapse();}}

The one before applies, I tried putting some random stuff in it and it does apply. So basically if there's only two enemies when the infected one dies, he just stay in place, never collapse nor pass over the state.

I think it's weird because I have a similar spell that hits one enemy then another random one. If the first hit killed the first enemy,
the randomly chosen enemy will take similar damages. I'm using a lunatic code very similar to it and never ever faced this problem, as it works perfectly if there are two enemies. Have a look:

<Post-Damage Eval>
var elementId = 3;
var damage = value;
if (target.hp <= 0){
var damage = damage * 2;}
var members = this.opponentsUnit().aliveMembers();
members.splice(members.indexOf(target), 1);
var member = members[Math.floor(Math.random() * members.length)];
if (member) {
member.startAnimation(141);
member.gainHp(-Math.ceil(damage * member.elementRate(elementId)));
member.startDamagePopup();
member.clearResult();
if (member.isDead()) {
member.performCollapse();}}
</Post-Damage Eval>

Could anyone look up to it? I'd really love to get some help on that.
 

EisiG.R

Villager
Member
Joined
Jan 19, 2017
Messages
11
Reaction score
13
First Language
French
Primarily Uses
N/A
hello, I think you need to put you transmition effect in your death state like yanfly do for the phoenix ring

 

Winek

Veteran
Veteran
Joined
Apr 12, 2017
Messages
34
Reaction score
5
First Language
English
Primarily Uses
RMMV
Hey, I tried that methods, but it sadly doesn't work for the only reason that other states are removed upon death, thus making it impossible for me to actually check the state and infect someone. Yanfly's video is about an item, and these stay after death... But thanks for your time anyway!
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
34,363
Reaction score
8,772
First Language
German
Primarily Uses
RMMV
Hey, I think it's the proper place to post (not sure since I'm new here)
Unfortunately you were wrong, but that is no problem
[move]Plugin Support[/move]
Please give a link to the plugin, so that people don't need to search it for crosschecks
 

Winek

Veteran
Veteran
Joined
Apr 12, 2017
Messages
34
Reaction score
5
First Language
English
Primarily Uses
RMMV
i really thought i was right qq

http://yanfly.moe/2015/12/25/yep-50-buffs-states-core/
Here's Yanfly's buff and state core.

I'm still mainly trying to figure out the problem number two. The number one is probably because states are removed upon death, making it never
really check in the first place... Does anyone have an idea how to turn around that? And well I'm still struggling with my script not working if there is only 2 enemies.
 

Frogboy

I'm not weak to fire
Veteran
Joined
Apr 19, 2016
Messages
1,834
Reaction score
2,345
First Language
English
Primarily Uses
RMMZ
Game_Battler.prototype.die() does 3 things.
  1. Set HP to 0
  2. Removes all buffs
  3. Removes all states
You could make a plug-in that overwrites this function and comments out the remove States part. If you do though, anyone brought back to life will likely still have whatever States they had when they died. Maybe you could also overwrite the revive() function and shift the code there.
 

Winek

Veteran
Veteran
Joined
Apr 12, 2017
Messages
34
Reaction score
5
First Language
English
Primarily Uses
RMMV
http://yanfly.moe/2016/04/03/yep-89-state-categories/

Yanfly's State Categories plugin allows states to remain on a target even after death. Just use <Category: Bypass Death Removal> in the state and it will remain after death.

I used it, nothing happens... it's the same as before. :/

I tried with multiple Custom xx Effect and really nothing happens if the enemy doesn't die from the poison qq
<Reapply Ignore Turns>
<Category: Bypass Death Removal>
<Custom Deselect Effect>
//Check if the enemy is dead
if (user.hp <= 0) {
// Get a random enemy
var members = this.friendsUnit().aliveMembers();
members.splice(members.indexOf(target), 1);
var member = members[Math.floor(Math.random() * members.length)]
if (member) {
//Play an animation and pass over the infections
member.startAnimation(60);
member.addState(22);
member.setAtk(user.atk);
member.setDef(user.def);
member.setMat(user.mat);
user.performCollapse();}}
</Custom Deselect Effect>

Also, it seems that the foe won't pass over the poison if it is alone or with only one other member when it dies from the poison, not just when there are two of them... Just what is wrong with my script qq

Game_Battler.prototype.die() does 3 things.
  1. Set HP to 0
  2. Removes all buffs
  3. Removes all states
You could make a plug-in that overwrites this function and comments out the remove States part. If you do though, anyone brought back to life will likely still have whatever States they had when they died. Maybe you could also overwrite the revive() function and shift the code there.

I would just need something to be JUST before removing the state...
 

Winek

Veteran
Veteran
Joined
Apr 12, 2017
Messages
34
Reaction score
5
First Language
English
Primarily Uses
RMMV
Hey, I've given up, this is too hard for me. The <Category: Bypass Death Removal> doesn't work at all and this actually makes me block in game
since I have to do skills/state in order. I've changed it for a smaller poison with other methods of spreading other than death. Regardless, thanks to everyone that helped me!
 

Ms Littlefish

Dangerously Caffeinated
Global Mod
Joined
Jan 15, 2014
Messages
6,417
Reaction score
8,113
First Language
English
Primarily Uses
RMMV

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

 
Status
Not open for further replies.

Latest Threads

Latest Posts

Latest Profile Posts

since all my maps are hand drawn... I admit, I super envy those who can make the tileset's work. I'm garbage at mapping, but slightly less bad at just drawing my own areas. plus it's easier to draw my own sprites than edit others to look like my characters.
Guys, I made a trailer! And, I also launched the Steam page! If you would like to support the game, please Wishlist it :ahappy: ->
working on some tilesets _ノ乙(、ン、)_

CIBl8xT.png


Oq8WKHX.png
aww man, color hex code #C4C4C4 doesn't work for the tint value in this scene I need something darker, which stinks just because I liked that one it was my favorite plastic explosive three times...#696969 (nice) should work better (WHY IS MY BRAIN LIKE THIS)
Tell it to me straight, doc. If I've been trying to piece together a "shorter" game to learn stuff outside of game jams... am I just running away from my WIP? :v

Forum statistics

Threads
117,284
Messages
1,106,135
Members
153,470
Latest member
CPGPPC
Top