I've seen this in tons of games to where if you can destroy something like for example, a propane tank, it will hurt the player and/or enemies if close to it but gives the player a chance to conserve ammo if shot one of these objects when a group(2 or more) enemies are close to the exploding object.
Basically speaking, I'm trying to make an object that if you destroy it, it will hurt the player as long as you are close and any enemy as long as they are close too.
Make an alignment group that sees Actors and Enemies as its enemy. Make it lifeless. If you want, you can also make this group consider itself as an enemy (chain reaction explosions).
Create a skill that hits all enemy targets and is shockwave.
Post this below BABS:
class Map_Battler < Game_Character
def use_skill(skill, forced = false, after_death = false)
# remove last hpdamage and spdamage values
@battler.hpdamage = @battler.spdamage = 0
# if can use the skill
if skill_can_use?(skill.id, forced, after_death)
# get combo id
combo_id = BlizzABS::Skills.combo(skill.id)
# if combo id is valid and not currently in a combo
if combo_id != 0 && @combo == nil
# create combo
@combo = BlizzABS::Combo.new(combo_id, self)
# return used
return true
end
# set last action
@battler.last_action = ["skill", false]
# execute skill
result = $BlizzABS.skillitem_process(self, skill)
# effectiveness
effective = (result || charging? && !charged?)
# if used or charging up and about to discharge
if result
# set frame penalty
set_action(self.skill_penalty(skill.id))
# skill consumption effect
skill_consumption(skill)
# call common event
common_event_call(skill)
# set usage animation
set_usage_animation(skill)
# set sprite animation
set_sprite_animation(BlizzABS::SPRSkill, skill_sprites?, skill)
# set up user damage display if necessary
user_damage_display
# reset action
self.reset_action
# if discharged
elsif charging? && charged?
# reset action
self.reset_action
end
# effective
return effective
end
# not used
return false
end
alias call_babs_orig_use_skill use_skill
def use_skill(skill, forced = false, after_death = false)
if skill.is_a?(RPG::Skill)
call_babs_orig_use_skill(skill, forced, after_death)
else
call_babs_orig_use_skill($data_skills[skill], forced, after_death)
end
end
def skill_can_use?(id, forced = false, after_death = false)
if (forced)
# If low SP, incapacitated, or silent and non-physical, can't use
return $data_skills[id].sp_cost <= @battler.sp && (!@battler.dead? || after_death)
($data_skills[id].atk_f != 0 || @battler.restriction != 1)
end
return @battler.skill_can_use?(id)
end
end
Make a dummy enemy in your database (gives no EXP or items and has low stats, except perhaps STR and ATK).
In the map event, choose an enemy you wish to represent and set its group to this new one we made. In event list, use 'Script' and do the following line:
e = $game_map.events[@SELF]
e.use_skill(SKILL_ID, true, true)
where SKILL_ID is your explosion skill.
Question, will this cause enemies to go after the event rather than going after me?
I have made some alignments before on lifeless objects that try to be against enemies but sometimes these enemies will go after those objects rather than trying to attack the player. Will this script prevent that?
The script I posted only modifies the use_skill method to make it so that skills can be used even when the battler is dead (thus, when the box "dies" it can use its skill to explode).
Forgot to also say to make the Enemies group see this new lifeless group as totally neutral. That way the enemy won't attack it should it be hurt from a previous explosion. I've tested this and it works.
Works great except when I do this. The enemies try to attack the explodable object instead of trying to hit me. Sometimes they may ignore me and go after the object.
I set the object to an alignment that is exclusive to that object with it being enemies with me and the regular enemies. I set the player to be enemies with that object and the regular enemies to be enemies with the alignment of the object and still the enemies are trying to attack the object when they aren't suppose to.
Quote from: KK20 on November 10, 2012, 11:22:15 am
Forgot to also say to make the Enemies group see this new lifeless group as totally neutral. That way the enemy won't attack it should it be hurt from a previous explosion.
You might also want to do that with the Actors group as you wouldn't want your party members to see these boxes as enemies.
Ooh now I get it. I set the enemies to be enemies with the lifeless object and lifeless object to be enemies with enemies but it turns out, you have to make enemies be neutral with the lifeless object and the lifeless object be enemies with the enemies.
I misinterrpreted your post wrongly thinking that the script did it, silly me.
Again, thank you so much!
KK20, I forgot to ask you this but do you think this script could be databased? I think this is a very good script add on for Blizz ABS and I really like it.
Hmmm...I'm not sure if this would be good enough to throw into the script database. I could make it a tutorial/guide since it is more eventing and manipulating the BlizzABS configuration.
I'll look into it ;)