Yanflys core engine, not playing nice

Status
Not open for further replies.

DarknessFalls

Rpg Maker Jesus - JS Dev.
Veteran
Joined
Jun 7, 2013
Messages
1,393
Reaction score
210
First Language
English
Consider the following code, executed in battle, DIRECTLY after a player commits an action:

        this._actorWhobrokeLaw.gainHp(-lawObject.amount);        if (this._actorWhobrokeLaw._hp <= 0) {          this._actorWhobrokeLaw.die();          this._actorWhobrokeLaw.preformCollapse();        }Couple things to note: this._actorWhobrokeLaw is a game actor instance. Obviously.  lets assume amount is 1000.

So what happens when a player executes the attack command and this code is triggered?

Screen Shot 2015-11-12 at 1.18.57 PM.png

The first thing in the stack is the

Screen Shot 2015-11-12 at 1.20.10 PM.png

The particular line we care about is the else  in the inf statement.  the cursor blinks on context, I believe context is not defined in this instance.

How does this have anything to do with yanfly?

This code:

Screen Shot 2015-11-12 at 1.23.20 PM.png

particularly the: this.contents at the bottom of the page.

So my question is, how do you update the actors health directly after they execute an action? I have it so that I say, in the Game Action, apply function, that:

On hit, if target is a game enemy and the item is attack, take 1000 hp from the player.

Any ideas about these errors? Is there a simple solution here?
 

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,546
Reaction score
3,717
First Language
Java's Crypt
Primarily Uses
RMMZ
Try changing this line:

fillW = Math.floor(dw * rate);
for this:

fillW = Math.max(0, Math.floor(dw * rate));
and see if it works.

My guess is that your script is changing _hp to a negative value.

Game_BattlerBase.prototype.refresh should clamp the _hp to 0, but the gauge may be updating first.
 

DarknessFalls

Rpg Maker Jesus - JS Dev.
Veteran
Joined
Jun 7, 2013
Messages
1,393
Reaction score
210
First Language
English
hmm, instead of doing that I might actually do:

var health = this._actorWhobrokeLaw._hpvar health -= lawObject.amount;check if health is below 0, if so kill the player, if not set the value of the players hp. thus it can never be below 0 :D
 

Hudell

Dog Lord
Veteran
Joined
Oct 2, 2014
Messages
3,546
Reaction score
3,717
First Language
Java's Crypt
Primarily Uses
RMMZ
hmm, instead of doing that I might actually do:

var health = this._actorWhobrokeLaw._hpvar health -= lawObject.amount;check if health is below 0, if so kill the player, if not set the value of the players hp. thus it can never be below 0 :D
Sure, but it would be good to test if Yanfly's script is really crashing with negative hps and report the issue to him.
 

DarknessFalls

Rpg Maker Jesus - JS Dev.
Veteran
Joined
Jun 7, 2013
Messages
1,393
Reaction score
210
First Language
English
The issue I do not think is with yanfly, so I updated the code to:

        var health = this._actorWhobrokeLaw._hp;        health -= lawObject.amount        if (health <= 0) {          this._actorWhobrokeLaw.die();          this._actorWhobrokeLaw.preformCollapse();        } else {          this._actorWhobrokeLaw._hp = health;        }Same issue ... I'll try your solution now

So just an update same issue even with your suggested fix hudel.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
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.


at OP's request
 
Status
Not open for further replies.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,018
Messages
1,018,357
Members
137,803
Latest member
andrewcole
Top