APPLY STATES TO DEAD ACTORS.
Posts
Pages:
1
I'm working on an elemental field system that lowers or increases character resistance to specific elements.
For example, if you're in a glacier map all party members resistance to Ice element gets lowered by 10%, so that Ice based spells could cause more damage etc.
This is made applying hidden states to each party member upon entering a map, these hidden states never run out and only get removed in a transfer event, so the effect lasts for the whole permanence in the map.
Now the problem is when the party enters the map with a dead member, the elemental state won't be applied if the ally is inflicted with KO state, but if the player revives the dead ally after entering the map, he won't have the elemental field effect applied like the others.
So what I need is to be able to inflict states to dead actors, be it by events or by scripts (RGSS2).
Thanks in advance for the braves that shall help this distressed damsel.
For example, if you're in a glacier map all party members resistance to Ice element gets lowered by 10%, so that Ice based spells could cause more damage etc.
This is made applying hidden states to each party member upon entering a map, these hidden states never run out and only get removed in a transfer event, so the effect lasts for the whole permanence in the map.
Now the problem is when the party enters the map with a dead member, the elemental state won't be applied if the ally is inflicted with KO state, but if the player revives the dead ally after entering the map, he won't have the elemental field effect applied like the others.
So what I need is to be able to inflict states to dead actors, be it by events or by scripts (RGSS2).
Thanks in advance for the braves that shall help this distressed damsel.
Two things:
1) Go to your Death/KO/Unconscious/whatever state and make sure that these effects aren't ticked in the "states to cancel" box. Any states that are ticked will be removed when this state takes effect!
2) Ctrl-Shift-F (universal search hotkey) for def state_ignore?; it should be under Game_Battler.
Replace it with this code. Make sure you fill in the array!
Alternatively, use this code snippet instead only if you're using Melody.
Tell me if this works. If you have Melody, you really should use the second snippet since it allows you to tag states instead of hard-code them. I haven't tested this; you might need to change BYPASS to "BYPASS" (add the quotation marks).
1) Go to your Death/KO/Unconscious/whatever state and make sure that these effects aren't ticked in the "states to cancel" box. Any states that are ticked will be removed when this state takes effect!
2) Ctrl-Shift-F (universal search hotkey) for def state_ignore?; it should be under Game_Battler.
Replace it with this code. Make sure you fill in the array!
def state_ignore?(state_id)
bypass_states = [] # Put the ids of any state you want to be applied even when incapacitated here
return false if bypass_states.include?(state_id)
for state in states
if state.state_set.include?(state_id) and
not $data_states[state_id].state_set.include?(state.id)
return true
end
end
return false
end
Alternatively, use this code snippet instead only if you're using Melody.
def state_ignore?(state_id)
# For any states that you want to be applied even if incapacitated, use the tag <state type: bypass>
return false if $data_states[state_id].type?(BYPASS)
for state in states
if state.state_set.include?(state_id) and
not $data_states[state_id].state_set.include?(state.id)
return true
end
end
return false
end
Tell me if this works. If you have Melody, you really should use the second snippet since it allows you to tag states instead of hard-code them. I haven't tested this; you might need to change BYPASS to "BYPASS" (add the quotation marks).
The second one reports an uninitialized BYPASS constant, the other works just fine though.
Mucho thanks and +1 internets.
Mucho thanks and +1 internets.
Ops I didn't notice the last sentence...
Yep, works like a charm; it is indeed better because I won't have to remeber to update the numbers in the array if I change the position of the states in the database.
Thanks again (:
Yep, works like a charm; it is indeed better because I won't have to remeber to update the numbers in the array if I change the position of the states in the database.
Thanks again (:
Awesome. I use those tags for various effects in Visions & Voices, but I haven't tested everything yet, so I didn't know if it was a string or not!
If you're trying to get into scripting yourself, I'd highly suggest playing with state.type?("phrase") and obj.skill_type.include?("phrase"). "obj" and "state" would need to be adjusted most likely, but they're very useful tools.
For example, my def calc_hit returns a 999% hit rate if the skill is tagged with <skill type: buff>.
And yes, "Dimenson Door" is X-Zone/Telega. You can use it on bosses (it only lasts for 1 turn on them).
If you're trying to get into scripting yourself, I'd highly suggest playing with state.type?("phrase") and obj.skill_type.include?("phrase"). "obj" and "state" would need to be adjusted most likely, but they're very useful tools.
For example, my def calc_hit returns a 999% hit rate if the skill is tagged with <skill type: buff>.
def calc_hit(user, obj = nil)
return 0 if self.state?(90) # Dimension Door
if obj == nil # for a normal attack
hit = user.hit # get hit ratio
physical = true
elsif obj.is_a?(RPG::Skill) # for a skill
return 999 if obj.base_damage < 0 or (obj.base_damage == 0 and obj.skill_type.include?("buff"))
hit = obj.hit # get success rate
physical = obj.physical_attack
hit = obj.hit * user.hit / 100 if physical
...
And yes, "Dimenson Door" is X-Zone/Telega. You can use it on bosses (it only lasts for 1 turn on them).
Pages:
1















