RPG Maker VX Ace

RPG Maker VX Ace

İstatistiklere Bak:
More than one type of HP?
How would I create more than one type of HP?
For example, lets say this alternate HP is Shield Points (SP).
The actor 'Bob' has 30 HP and 5 SP.
Bob then gets attacked by a rat. If the rat does 3 damage each turn, it would need to attack twice to take Bob's SP to zero before it can begin to damage the HP.
< >
2 yorumdan 1 ile 2 arası gösteriliyor
That would require scripting and even then you may have to recreate the gauges in the battle screen.
Looks like I've solved this. I'll explain how I did it, for the sake of any future people with this same question.

I used three scripts to make this work - two I found online.
Manashield[forums.rpgmakerweb.com]
Passive States [yanflychannel.wordpress.com] <--- Only needed if you want equipment to create shields

I edited Manashield so it would transfer damage to TP, rather than MP:
85 if @battler.manashield && @battler.tp > 0 #@battler.mp changed to @battler.tp
86 dpm = @battler.manashield[0]
87 percent = @battler.manashield[1]
88 shield = (@hp_damage * percent.to_f) / 100.0
89 shield = shield / dpm.to_f
90 #shield = [shield, @battler.mp.to_f].min #line disabled
91 @hp_damage = 0 #@hp_damage set to zero
92 @tp_damage += shield.to_i #@mp_damage changed to @tp_damage

Lines 90 and 91 are used to calculate 'extra' damage your shield didn't block and transfer the extra to the actor (ex, if your shield has 3 TP and you take 5 damage, the other 2 is taken from HP). I don't want this to happen, so I disabled it. If you want this in your game, replace @battler.mp.to_f with @battler.tp.to_f on line 90, leaving line 91 alone.

Passive States is unchanged. I use it so the state Manashield specifies is applied to any actor wearing a shield.


The third script I cobbled together myself, to set the tp values to something appropriate for my game:
class Game_BattlerBase
def max_tp
return luk - 1
end

def tp_rate
@tp.to_f / max_tp #decides when tp bar is full (don't use init_tp)
end
end

class Game_Battler < Game_BattlerBase
def init_tp
self.tp = luk - 1 #decides starting tp at the beginning of battle
end

def execute_damage(user)
on_damage(@result.hp_damage) if @result.hp_damage > 0
self.hp -= @result.hp_damage
self.mp -= @result.mp_damage
user.hp += @result.hp_drain
user.mp += @result.mp_drain
on_damage(@result.tp_damage) #added to apply TP damage to actor
self.tp -= result.tp_damage #see above
end
end

max_tp is the most TP you're allowed to have. By default, it's 100. You can change 'luk - 1' to any value that makes sense in your game.

tp_rate is used for drawing the 'tp bar' (example: if you have a max tp of 50 but a tp_rate of the default 100, the bar will never fill past halfway). I recommend setting this to max_tp. DON'T set this to 'init_tp', it makes TP perpetually restore itself to full.

init_tp decides how much tp you start battle with. don't set above max_tp or tp_rate.
En son toad_004 tarafından düzenlendi; 15 Şub 2014 @ 11:20
< >
2 yorumdan 1 ile 2 arası gösteriliyor
Sayfa başına: 1530 50

Gönderilme Tarihi: 14 Şub 2014 @ 8:21
İleti: 2