Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Taking Damage With Every Move

Status
Not open for further replies.

MinisterJay

Administrator
Staff member
Administrator
This is what I have tried: Putting an event on every space that is walkable. Advantage: It works. Disadvantage: it prevent events that I have routed from moving.

What I know how to do: I can put a looping parallel event that causes damage every so many tics. That is not what I am looking for though.

What I am looking for: An parallel event or plugin that allows damage to occur with every move.
 

CT_Bolt

Global Moderator
Staff member
Resource Team
Xy$
0.02
This is what I have tried: Putting an event on every space that is walkable. Advantage: It works. Disadvantage: it prevent events that I have routed from moving.

What I know how to do: I can put a looping parallel event that causes damage every so many tics. That is not what I am looking for though.

What I am looking for: An parallel event or plugin that allows damage to occur with every move.
Just want to clarify...

Every move the player makes (aka. button pressed/clicked movement)?
...or...
every move the character takes (aka. every square stepped on)? <--- I'm guessing this one.
 

MinisterJay

Administrator
Staff member
Administrator
Just want to clarify...

Every move the player makes (aka. button pressed/clicked movement)?
...or...
every move the character takes (aka. every square stepped on)? <--- I'm guessing this one.
Your guess is correct. They will also take damage when encountering any event, but that is easy to do.
 

CT_Bolt

Global Moderator
Staff member
Resource Team
Xy$
0.02
Your guess is correct. They will also take damage when encountering any event, but that is easy to do.
Also just to cover all bases... damage floor doesn't suit your needs, correct?
...At least in the current form.

...at least in the current form.

... if you needed to toggle the damage floor you could always copy the tileset and edit one to damage floor & one not, then use the "change tileset" command.

Edit:
Perhaps this will suit your needs for now? A small plugin script I wrote:
JavaScript:
Game_Actor.prototype.onPlayerWalk = function() {
    this.clearResult();
    this.checkFloorEffect();
    if ($gamePlayer.isNormal()) {
        this.turnEndOnMap();
        this.states().forEach(function(state) {
            this.updateStateSteps(state);
        }, this);
        this.showAddedStates();
        this.showRemovedStates();
    }
    if ($gameSwitches.value(1)){this.executeSwitchDamage();} // Change 1 to the SwitchID you use
};

Game_Actor.prototype.executeSwitchDamage = function() {
    var damage = Math.floor(this.basicFloorDamage() * this.fdr);
    damage = Math.min(damage, this.maxFloorDamage());
    this.gainHp(-damage);
    if (damage > 0) {
        this.performMapDamage();
    }
};
I'm now going to write a "Common event activated on each new square while switch is ON" plugin with parameters as well as not overwrite the onPlayerWalk function and instead alias it.
This might suit what you need better.
 
Last edited:

CT_Bolt

Global Moderator
Staff member
Resource Team
Xy$
0.02
I've wrote a plugin that should suit this perfectly. (cool)

Switch on While Player Walk Plugin: Click Here to View

While a "master switch" is ON this plugin turns a switch on every time the character moves to another tile.
This allows the developer to create a parallel common event and set the switch ID to the switch that will get enabled by the character moving, then in the common event turn the switch back off after damaging as well any other event commands.

The original idea was to call a common event every time the character moved to a new tile. However this caused the character to stop moving and only was able to move 1 tile at a time so I decided to use a switch and parallel common event instead & viola! It worked like a charm.

Also for more flexibility I used an in-game variable to set what switch ID will get turned on, this way the switch ID can be changed anytime. (cute)

Let me know how this works for you. I'm eager to hear some feedback. (cheeky)
I'm thinking of adding more, haven't thought of much else needed for this though. (cool)
 

Xilefian

Adventurer
Xy$
0.00
You can do this with a parallel process event that checks if the player's X/Y has changed and apply damage if it has.


You could even make it only work if the player is standing on certain regions by adding a conditional check for what region the player is currently in.
 

MinisterJay

Administrator
Staff member
Administrator
Thanks @CT_Bolt and @Xilefian for assisting.

Last night after I turned computer off for wife to sleep, I was thinking about what I said about parallax mapping and what CT said about damage floor. I use an invisible tiles for making areas passable and non-passable with my parallax maps. What if I tried to take those invisible passable tile and check them off with damage floor. I tried it this morning, and it worked.

This thread is being closed due to it being solved, unless original poster (me) requests more information.
 
Status
Not open for further replies.
Top