STEW'S PROFILE

Search

Filter

Need help editing Threat System script (XP)

Any chance a moderating could move this to the Programming forum? Apologies.

Need help editing Threat System script (XP)

So I am working on integrating Fanatist's Threat System script into my game and I've come across a minor snag.

My goal is to move the threat gauge down so it's below the HP counter. I'd also like add the letters EF (Enemy Focus) to the left of the threat number.

My first and biggest problem is that while I have been able to move the Threat counter, it only moves to the correct spot for the first player character. The other two move down but are too far to the left.

My second problem is that I just don't know how to pop the desired "EF" in there. I can do without this if I need to, but I'd like to have it there.


If anyone with more experience might be up for taking a gander at the script (below) I'd appreciate the help.

(I used Hide rather Code because Code was giving me some weird problem where it stretches out so that it's unreadable.)

The portion I edited
#============================================================================== # ** Window_BattleStatus #------------------------------------------------------------------------------ # Modded to show threat beside actor's name. #============================================================================== class Window_BattleStatus #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- alias threat_display_refresh refresh def refresh threat_display_refresh for i in 0...$game_party.actors.size actor = $game_party.actors next if actor.threat == 0 actor_x = i * 160 + 4 actor_x += self.contents.text_size(actor.name).width + 4 self.contents.draw_text(actor_x, 0, 160, 170, "(#{actor.threat})") end end end end if ThreatConfig::THREAT_WINDOW]


The full script
#==============================================================================
# ** Threat System
#------------------------------------------------------------------------------
# by Fantasist
# Version: 1.2
# Date: 23-Oct-2011
#------------------------------------------------------------------------------
# Version History:
#
# 1.0 - First version (13-July-2009)
# 1.1 - Fixed Force Action bug and added enemy-specific threat ignore (21-Oct-2011)
# 1.2 - Added disable by switch, threat by damage, fixed a display bug
#------------------------------------------------------------------------------
# Description:
#
# During battle, enemies will choose their targets based on their "threat"
# rather than randomly. The threat for an actor changes depending on what they
# do. For example, attacking raises threat and defending decreases threat.
#------------------------------------------------------------------------------
# Compatibility:
#
# Might be incompatible with other battle systems or battle addons.
#------------------------------------------------------------------------------
# Instructions:
#
# Place this script anywhere above "Main" and below "Scene_Debug".
#------------------------------------------------------------------------------
# Configuration:
#
# Scroll down a bit and you'll see the configuration.
#
# ATTACK_THREAT: Threat to increase when actor attacks
# DEFEND_THREAT: Threat to decrease when actor defends (read THREAT_BY_DAMAGE)
# THREAT_CHANCE: The chance of enemies attacking based on threat
# THREAT_SWITCH: Turn this ON to temporarily disable the threat system
# THREAT_BY_DAMAGE: When "true", an actor's threat increases by the damage
# caused to enemies. Enabling this ignores ATTACK_THREAT.
# When defending, actor's threat is divided by DEFEND_THREAT.
# THREAT_DISPLAY: Display players' threats besides their name
# THREAT_WINDOW: Whether to enable or disable threat window
# To enable it, set it to "true". If you want to set it's
# position and width, you can also set it to an array with
# it's X position, Y position and width (eg: ).
# ENEMY_IGNORE: List of enemy IDs which ignore the threat system
#
# Skill Threat Configuration:
#
# Look for "SKILL THREAT CONFIG BEGIN" and follow the example.
# In the given example:
#
# when 57 then
#
# the skill 57 (Cross Cut) increases user's threat by 10 and decreases the
# rest of the party's threat by 2.
#
# Item Threat Configuration:
#
# Works exactly the same as skill threat configuration.
#------------------------------------------------------------------------------
# Credits:
#
# Fantasist, for making this script
# KCMike20, for requesting this script
#
# Thanks:
#
# Blizzard, for helping me
# winkio, for helping me
# Jackolas, for pointing out a bug
# yuhikaru, for fixing force action bug
# Fenriswolf, for requesting enemy ignore list
# Kagutsuchi, for requesting threat-by-damage feature
#------------------------------------------------------------------------------
# Notes:
#
# If you have any problems, suggestions or comments, you can find me at:
#
# forum.chaos-project.com
#
# Enjoy ^_^
#==============================================================================

#==============================================================================
# ** ThreatConfig module
#------------------------------------------------------------------------------
# Module for settings and configuration of the Threat system.
#==============================================================================

module ThreatConfig
#--------------------------------------------------------------------------
# * Config
#--------------------------------------------------------------------------
ATTACK_THREAT = 10 # Threat to increase when actor attacks
DEFEND_THREAT = 10 # Threat to decrease when actor defends
THREAT_CHANCE = 100 # The chance of enemies attacking based on threat
THREAT_SWITCH = 25 # ID of switch which disables threat system when ON
THREAT_BY_DAMAGE = true # Threat is increased based on damage caused
THREAT_DISPLAY = true # Display player's threat besides their name
THREAT_WINDOW = false # Whether to enable or disable threat window
ENEMY_IGNORE = # List of enemy IDs which ignore the threat system
#--------------------------------------------------------------------------
# * Configure skill threats
#--------------------------------------------------------------------------
def self.get_skill_threat(skill_id)
threat = case skill_id
#========================================================================
# SKILL THREAT CONFIG BEGIN
#========================================================================
when 57 then # Cross Cut
when 61 then # Leg Sweep
when 7 then # Fire
# when skill_ID then
#========================================================================
# SKILL THREAT CONFIG END
#========================================================================
else false
end
return threat
end
#--------------------------------------------------------------------------
# * Configure item threats
#--------------------------------------------------------------------------
def self.get_item_threat(item_id)
threat = case item_id
#========================================================================
# ITEM THREAT CONFIG BEGIN
#========================================================================
when 1 then # Potion
# when item_ID then
#========================================================================
# ITEM THREAT CONFIG END
#========================================================================
else false
end
return threat
end
#--------------------------------------------------------------------------
# * Configure enemy ignore IDs
#--------------------------------------------------------------------------

end

#==============================================================================
# ** Game_Actor
#------------------------------------------------------------------------------
# Added the threat attribute.
#==============================================================================

class Game_Actor
#--------------------------------------------------------------------------
# * Initialize threat attribute
#--------------------------------------------------------------------------
alias game_actor_threat_setup setup
def setup(actor_id)
@threat = 0
game_actor_threat_setup(actor_id)
end
#--------------------------------------------------------------------------
# * Get the threat attribute
#--------------------------------------------------------------------------
attr_reader :threat
#--------------------------------------------------------------------------
# * Set the threat attribute
#--------------------------------------------------------------------------
def threat=(val)
val = 0 if val < 0
@threat = val
end
end

#==============================================================================
# ** Game_Party
#------------------------------------------------------------------------------
# Modified random actor selection to select by threat.
#==============================================================================

class Game_Party
#--------------------------------------------------------------------------
# * Choose actor by threat
#--------------------------------------------------------------------------
alias choose_actor_threat_orig random_target_actor
def random_target_actor(hp0 = false)
if $game_switches
return choose_actor_threat_orig(hp0)
end
if $scene.active_battler.is_a?(Game_Enemy) &&
ThreatConfig::ENEMY_IGNORE.include?($scene.active_battler.id)
return choose_actor_threat_orig(hp0)
end
if rand(100) >= ThreatConfig::THREAT_CHANCE
return choose_actor_threat_orig(hp0)
else
return threat_target_actor(hp0)
end
end
#--------------------------------------------------------------------------
# * Calculate threat and choose actor
#--------------------------------------------------------------------------
def threat_target_actor(hp0=false)
# Collect valid actors
targets =
for actor in @actors
next unless (!hp0 && actor.exist?) || (hp0 && actor.hp0?)
targets.push(actor)
end
# Get actors with maximum threat
targets.sort! {|a, b| b.threat - a.threat}
targets = targets.find_all {|a| a.threat == targets.threat}
# Choose random
target = targets
return target
end
end

#==============================================================================
# ** Game_Battler
#------------------------------------------------------------------------------
# Added attack and skill threat handling.
#==============================================================================

class Game_Battler
#--------------------------------------------------------------------------
# * Attack Threat
#--------------------------------------------------------------------------
alias attack_effect_threat attack_effect
def attack_effect(attacker)
result = attack_effect_threat(attacker)
if attacker.is_a?(Game_Actor) && self.damage.is_a?(Numeric) && self.damage > 0
if ThreatConfig::THREAT_BY_DAMAGE
attacker.threat += self.damage
else
attacker.threat += ThreatConfig::ATTACK_THREAT
end
end
return result
end
#--------------------------------------------------------------------------
# * Skill Threat
#--------------------------------------------------------------------------
alias skill_effect_threat skill_effect
def skill_effect(user, skill)
result = skill_effect_threat(user, skill)
threat = user.is_a?(Game_Actor) && ThreatConfig.get_skill_threat(skill.id)
if threat && self.damage.is_a?(Numeric) && self.damage > 0
user_threat, party_threat = threat, threat
for actor in $game_party.actors
threat_plus = actor.id == user.id ? user_threat : party_threat
actor.threat += threat_plus
end
if ThreatConfig::THREAT_BY_DAMAGE
user.threat -= user_threat
user.threat += self.damage
end
end
return result
end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# Added defend and item threat handling and realtime target selection.
#==============================================================================

class Scene_Battle
attr_reader :active_battler
#--------------------------------------------------------------------------
# * Defend Threat
#--------------------------------------------------------------------------
alias basic_action_threat_result make_basic_action_result
def make_basic_action_result
if @active_battler.current_action.basic == 1 && @active_battler.is_a?(Game_Actor)
if ThreatConfig::THREAT_BY_DAMAGE
@active_battler.threat /= ThreatConfig::DEFEND_THREAT
else
@active_battler.threat -= ThreatConfig::DEFEND_THREAT
end
end
basic_action_threat_result
end
#--------------------------------------------------------------------------
# * Item Threat
#--------------------------------------------------------------------------
alias item_action_threat_result make_item_action_result
def make_item_action_result
item_action_threat_result
threat = @active_battler.is_a?(Game_Actor) && ThreatConfig.get_item_threat(@item.id)
if threat
user_threat, party_threat = threat, threat
for actor in $game_party.actors
threat_plus = actor.id == @active_battler.id ? user_threat : party_threat
actor.threat += threat_plus
end
end
end
#--------------------------------------------------------------------------
# * Choose target actor in realtime
#--------------------------------------------------------------------------
alias update_phase4_step2_choose_actor_realtime update_phase4_step2
def update_phase4_step2
# Fore action fix by yuhikaru
# If there is no force action this turn
if $game_temp.forcing_battler == nil
@active_battler.make_action if @active_battler.is_a?(Game_Enemy)
end
update_phase4_step2_choose_actor_realtime
end
#--------------------------------------------------------------------------
# * Clear threats before battle
#--------------------------------------------------------------------------
alias clear_threats_battle_main main
def main
$game_party.actors.each {|actor| actor.threat = 0}
clear_threats_battle_main
end
end

if ThreatConfig::THREAT_DISPLAY
#==============================================================================
# ** Window_BattleStatus
#------------------------------------------------------------------------------
# Modded to show threat beside actor's name.
#==============================================================================

class Window_BattleStatus
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
alias threat_display_refresh refresh
def refresh
threat_display_refresh
for i in 0...$game_party.actors.size
actor = $game_party.actors
next if actor.threat == 0
actor_x = i * 160 + 4
actor_x += self.contents.text_size(actor.name).width + 4
self.contents.draw_text(actor_x, 0, 160, 170, "(#{actor.threat})")
end
end
end
end

if ThreatConfig::THREAT_WINDOW
#==============================================================================
# ** Window_Threat
#------------------------------------------------------------------------------
# This window displays the threats of actors in the party.
#==============================================================================

class Window_Threat < Window_Base
H = 18
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
a = ThreatConfig::THREAT_WINDOW
if a.is_a?(Array)
x, y, w = a, a, a
else
x, y, w = 0, 64, 160
end
super(x, y, w, 32 + H + $game_party.actors.size * H)
@threats =
$game_party.actors.each {|a| @threats.push(a.threat)}
self.contents = Bitmap.new(w-32, self.height-32)
self.contents.font.size = H
self.contents.font.bold = H <= 22
self.opacity = 160
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.draw_text(0, 0, self.width-32, H, 'Threats', 1)
$game_party.actors.each_with_index {|a, i| y_off = H
self.contents.draw_text(0, y_off + i*H, self.width-32, H, a.name)
self.contents.draw_text(0, y_off + i*H, self.width-32, H, @threats.to_s, 2)}
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
flag = false
$game_party.actors.each_with_index {|a, i|
@threats = a.threat if a.threat != @threats
flag = true}
refresh if flag
end
end

#==============================================================================
# ** Scene_Battle
#------------------------------------------------------------------------------
# Modded to handle threat window.
#==============================================================================

class Scene_Battle
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
alias threat_win_init main
def main
@threat_win = Window_Threat.new
threat_win_init
@threat_win.dispose
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
alias threat_win_upd update
def update
@threat_win.update
threat_win_upd
end
end
end

Looking for an artist for some detail work

Hi all,

So I recently hired an artist to help me do the coloring and detailing for a character battler. Sadly, they backed out and now I'm looking for someone else to give it a go.

Rather than shoot off messages to random artists I find on Deviant Art, I'm wondering if anyone with talent here might be interested and looking for a bit of cash.

If you worked out there would be potential for more work and of course, a credit in the game

Here is the battler I need finished:

Looking for ideas for my battle screen layout.

Psh...Well when my multi-million dollar Kickstarter campaign succeeds we'll see what tune you sing! :)

Seriously though, if anyone is interested in helping out and possesses the skills to do so I'm willing to negotiate a compensation. I said $20 but I'm open to discussion.

Looking for ideas for my battle screen layout.

There will be 3 party members total. I just don't have battlers for the other two yet.

How hard would it be to replace the fight/escape text menu with icons? I.e. one for attack, running, special attacks and resting? A nice HP bar would be a good idea too. I'm not sure how many skills each character will have... I'm shooting for a game length of about 10-15 hours, so maybe 6-7 per character?

Heh, how much do you charge?

Looking for ideas for my battle screen layout.

Hmm... Well as I said, there's not SP in the game. HP doubles as SP, meaning that to perform a special skill you'd need to essentially damage yourself, which could be risky if you're at low health.

The hero will be able to use perform a basic attack, perform special moves, use items, rest, and attempt to flee. Resting would essentially be a Defend move, you lose a turn but recover a percentage of your HP.

I'm a big fan of classic turn-based RPGs, so I want to keep things simple combat-wise. That said, I had considered trying to implement a "focus" system similar to the threat system in the Deadly Sin games whereas performing specific attacks or moves will draw the enemy's attention to a character and make them more likely to attack that character. I actually think it would work well, especially with my HP system. I'm hesitant though, because I don't want to be seen as copying their system. I also imagine such a system would require heavy scripting and I'm not a scripter at all.

Status ailments would also play heavily into the game and their use would sometimes be needed to beat a boss. For instance, a boss with a high defense might need to be attacked with a defense lowering attack to even put a dent in their health. Another goal with my status ailments is to keep them largely grounded in reality. I'm looking to make the Game of Thrones of RPGs and keep magic a very limited presence in the game. So far none of planned attacks are magical in nature and the status ailments will be along the lines of broken bones, sprained knees, poison, bleeding, etc. I imagine that would play into things like icons for status ailments and such.

Oh! And the art stops at the area containing the player characters. It would just be black past that point.

I hope some of that was useful...

Looking for ideas for my battle screen layout.

So I'm dealing with a minor quandary. I'm making a demo for a game I hope to Kickstart and someday take commercial. Hoping to put my best foot forward I've invested in unique music and am still putting together a nice repertoire of custom art (both hand drawn and pixel) that I'm going to use to make a playable demo.

The thing is, my battle layout is the standard XP one and I think I need something a bit more unique to my project if I'm going to ask people to give me money. My problem is that I have no clue where to go with this.

I actually really like the basic XP layout and don't want to stray too far from that classic Dragon Quest style. That said, I know I need something....

As such I'm turning to you kind folks. I've posted a couple screens from my game below and if anyone has any ideas I'd be much appreciative. Moreover, if anyone has the ambition to help me actually put something together, I'd be willing to compensate them financially. I'm not rich so we're probably talking in the area of like $20, but hey, you can buy a copy of Dragon Quest V for $20, so that's something!

A few pertinent details:
-My art is tailored toward the aforementioned Dragon Quest static battle screens, so it has to fit that.
-The Carmichael character art is currently a placeholder. Another artist did a better piece that's currently being detailed.
-While the mockups have an SP counter there will be no SP in the actual game, just HP.

Let me know your thoughts!


Fog effects in battle?

Ah yes, should have specified that I'm using XP.

Fog effects in battle?

So my artist just finished up a nice night time village background for me. Thing is, there's going to be a sequence in my demo where the village is being burned down and I'd like that to come across in battle. Is there any way to use a fog effect (or something) in battle to create a fiery/smoky haze over the background?

Here's the background for kicks!

Hand Drawn/Painted Tilesets

A lesson well learned. :)

author=cosmickitty
project wasn't finished but this one is "painted" instead of pixel and I love the way it looks except for the fact that pixel sprites look wrong with the background.

http://rpgmaker.net/games/4506/

and no sprite should ever cost $90 and that is 100% generated unless you had that commissioned from the creator of looseleaf. there are several websites where you can report an artist and check if an artist has been reported before.