+- Save-Point (https://www.save-point.org)
+-- Forum: Games Development (https://www.save-point.org/forum-4.html)
+--- Forum: Code Support (https://www.save-point.org/forum-20.html)
+--- Thread: Lycan abs - Making enemies flee on sight (/thread-5823.html)
Lycan abs - Making enemies flee on sight - ChickenFetus - 06-06-2016
I hope I posted this in the correct section.
I want to modify the cowardice setting in Lycan abs so that enemies with cowardice will flee upon detecting an enemy, rather than fleeing upon losing a member of their party.
Correct me if I'm wrong but I believe this is what I need to modify.
Code:
#--------------------------------------------------------------------------
# * Frame Update ( for enemy - Checking Running Cowardly Enemies)
#--------------------------------------------------------------------------
def update_enemy_test_coward
return if @enemies == {}
return if @enemies_alive == {}
return if @enemies.size == @enemies_alive.size
# Set Dead Enemy ID
dead_enemy = 0
# Cycle through cloned Enemy range
for enemy in @enemies_alive.values
# Set dead enemy by ID unless the enemy is also in the active list
dead_enemy = enemy.enemy_id unless @enemies.has_value?(enemy)
end
# Cycle through the enemies
for enemy in @enemies.values
# Set the coward timer for matching enemies
update_enemy_test_coward_set(enemy, dead_enemy)
end
end
#--------------------------------------------------------------------------
# * Frame Update ( for enemy - Setting Coward Timer for Enemies)
# enemy : enemy object
# dead_enemy : comparison enemy object
#--------------------------------------------------------------------------
def update_enemy_test_coward_set(enemy, dead_enemy)
# Exit unless the enemy has the coward flag
return unless enemy.personality.include?(4)
# Exit unless the enemy has a comrade recently slain
return unless enemy.ally_group.include?(dead_enemy)
# Activate his cowardice timer
enemy.cowardice_timer = 40 * enemy.cowardice
end
Although so far my attempts to modify it (e.g removing aspects that involve detecting if another is dead) haven't worked.
RE: Lycan abs - Making enemies flee on sight - DerVVulfman - 06-07-2016
Thanks for the idea, and be sure the next upgrade for Lycan will have your username in it.
If you just want the cowardice setting to make enemies just run from those in their hate group, paste this below the Lycan system and let the new code take over. BUT, this will later be put into action as some other behavior feature... a Phobia system.
Coward to Phobia Patch
Code:
#==============================================================================
# ** Game_ABS
#------------------------------------------------------------------------------
# This class deals with the Action Battle System and controls all Player,
# Enemy and Companion Actions on the map.
#==============================================================================
class Game_ABS
#--------------------------------------------------------------------------
# * Frame Update ( for enemy - Checking Running Cowardly Enemies)
#--------------------------------------------------------------------------
def update_enemy_test_coward
return if @enemies == {}
return if @enemies_alive == {}
# Cycle through the enemies
for enemy in @enemies.values
hate_list = update_enemy_list(enemy)
for key in hate_list
update_enemy_test_coward_set(enemy, key)
end
end
end
#--------------------------------------------------------------------------
# * Frame Update ( for enemy - Setting Coward Timer for Enemies)
# enemy : enemy object
# dead_enemy : comparison enemy object
#--------------------------------------------------------------------------
def update_enemy_test_coward_set(enemy, dead_enemy)
# Exit unless the enemy has the coward flag
return unless enemy.personality.include?(4)
# Exit unless the enemy has an enemy nearby
return unless enemy.hate_group.include?(dead_enemy)
# Activate his cowardice timer
enemy.cowardice_timer = 40 * enemy.cowardice
end
end
Any other questions you have may end up in the Lycan help file too.