Threat System
Authors: Fantasist
Version: 1.2
Type: Enemy behavior enhancement
Key Term: Battle Add-on
IntroductionDuring 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.
Features
- Players maintain "threat" and the enemies attack the most dangerous actors first
- Offers a new aspect of control in battles
- Configurable change in threat for attack, defend, skill and items
- Configurable "Threat Chance" decides how often enemies choose actors based on their threat (leaving some randomness for those who prefer it)
- An ignore list for enemies who use random actor selection
- Temporarily disable the threat system by using a switch
- A "threat-by-damage" mode where threat is calculated based on damage inflicted
- Two ways of keeping track of threat: status window mod for DBS and threat window for other battle system mods
ScreenshotsN/A
Demohttp://www.sendspace.com/file/rxrtfp
ScriptPlace this script anywhere above "Main" and below "Scene_Debug".
#==============================================================================
# ** 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: [0, 64, 160]).
# 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 [10, -2]
#
# 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 = [480, 64, 160] # 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 [5, -1] # Cross Cut
when 61 then [5, -1] # Leg Sweep
when 7 then [5, 0] # Fire
# when skill_ID then [ user_threat, party_threat ]
#========================================================================
# 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 [2, -5] # Potion
# when item_ID then [ user_threat, party_threat ]
#========================================================================
# 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[ThreatConfig::THREAT_SWITCH]
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[0].threat}
# Choose random
target = targets[rand(targets.size)]
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[0], threat[1]
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[0], threat[1]
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[i]
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, 32, "(#{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[0], a[1], a[2]
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[i].to_s, 2)}
end
#--------------------------------------------------------------------------
# * Update
#--------------------------------------------------------------------------
def update
flag = false
$game_party.actors.each_with_index {|a, i|
@threats[i] = a.threat if a.threat != @threats[i]
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
InstructionsLook for the configuration section in the script and configure the following.
- ATTACK_THREAT: Threat to increase when actor attacks
- DEFEND_THREAT: Threat to decrease when actor defends
- THREAT_CHANCE: The chance of enemies attacking based on 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: [0, 64, 160]).
- 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:
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.
CompatibilityMight be incompatible with other battle systems or battle addons.
Credits and ThanksCredit Fantasist (me) for making this.
- Fantasist, for making this script
- KCMike20, for requesting this script
- Blizzard, for helping me
- winkio, for helping me
- Jackolas, for pointing out a bug
- yukiharu for fixing force action bug
- Fenriswolf for requesting enemy ignore list
- Kagutsuchi, for requesting threat-by-damage feature
Author's NotesIf you have any problems, suggestions or comments, you can find me at:
forum.chaos-project.com
Enjoy ^_^
Work of art like always :D
You beat me to this by weeks. Holy god.. Even has the same NAME. You just saved me a LAWT of time. THANK YOU! *powers up*
I'm gonna add edits for my game, where enemies with greater INT have a greater chance of attacking POTENTIAL threats, IE mages, and not as much of attacking the PERCEIVED threats.
Thanks again!
still think its 1 of the most requested scripts out there :P
great work as always :P
Fantasist makes my fantasies come true. <3 *levels up*
Quote from: Blizzard on July 13, 2009, 03:18:18 pm
Fantasist makes my fantasies come true. <3 *levels up*
I dunno if that was epic or phail. :P
XD, no, really, it's a great script. Just tested it with mah battle system, and it works *perfectly*. Great job!
does this work with Blizzards ABS?
No
I'll eventually convert it if someone else doesn't beat me to it.
k cool cuz this sounds real cool
Should be fairly easy. It rewrites only a few methods in Scene_Battle.
Wouldn't we also need this for Remexos? An MMO without such a system would be a bit hard to play.
Very nice script btw, it's one of these scripts many people could need, but nobody had the idea yet^^
Does this script give you threat depending on how much damage you do?
thats basicly right. just read the request on Script Request. it goes into pretty good detail
Quote from: Kagutsuchi on July 13, 2009, 08:28:01 pm
Does this script give you threat depending on how much damage you do?
No. Even misses generate threat. Try the demo, you'll see very quickly how it works. However, with basic scripting knowledge, an edit is possible. I might not be able to SOON, but within the next couple of days, I can edit it for you.
lol i feel retarded :^_^':
Why? You didn't do anything wrong ^_^. You actually tried to help. No need to feel bad.
Quote from: Seox on July 14, 2009, 12:12:18 am
Quote from: Kagutsuchi on July 13, 2009, 08:28:01 pm
Does this script give you threat depending on how much damage you do?
No. Even misses generate threat. Try the demo, you'll see very quickly how it works. However, with basic scripting knowledge, an edit is possible. I might not be able to SOON, but within the next couple of days, I can edit it for you.
Good ^^ I could see that some people might want to use this version of a threat system, but to me it just doesn't make sense to have a threat system where how much damage you deal doesn't deside your threat.
< wow and aoc geek =D
Thank you everyone :)
Quote from: Seox on July 13, 2009, 02:37:42 pm
You beat me to this by weeks. Holy god.. Even has the same NAME. You just saved me a LAWT of time. THANK YOU! *powers up*
lol! I was supposed to complete this a year ago!
Quote from: winkio on July 13, 2009, 04:56:32 pm
I'll eventually convert it if someone else doesn't beat me to it.
Sure, I'd appreciate that. I don't know BABS enough to do it XD
Quote from: Kagutsuchi on July 14, 2009, 06:43:09 am
Good ^^ I could see that some people might want to use this version of a threat system, but to me it just doesn't make sense to have a threat system where how much damage you deal doesn't deside your threat.
< wow and aoc geek =D
A threat system can ideally do a
lot of stuff, a LOT. Many of them, though, are the user's preference. I admit I could've done a better job with it's capabilities, but I've gotten sick of RGSS. You see, I'm at a point of life where everything I do should pay off to my education or my career, or I feel like I'm wasting time, or worse; that I'm letting my peers go way ahead in the game. I don't want to touch RMXP just for scripting anymore. I will only use it when I have the time and plan for my game. I left a lot of requests hanging and I felt bad, so I'm sort of completing them.
btw, if any of that rant sounded like I was offended or something, it's not that, I appreciate your remarks :)
Quote from: Fantasist on July 14, 2009, 08:32:17 am
You see, I'm at a point of life where everything I do should pay off to my education or my career, or I feel like I'm wasting time, or worse;
No! Don't think like that! Education and career isn't everything!
Quote from: Subsonic_Noise on July 14, 2009, 08:50:53 am
Quote from: Fantasist on July 14, 2009, 08:32:17 am
You see, I'm at a point of life where everything I do should pay off to my education or my career, or I feel like I'm wasting time, or worse;
No! Don't think like that! Education and career isn't everything!
Sí. You can also knock up Germans and play with pollen in your spare time.
(10 cookies to first to catch the reference, though it isn't that hard)
QuoteNo! Don't think like that! Education and career isn't everything!
I'm a person who knows that better than probably most people, but I'm already 2 years late. I have to open my eyes to the world some day. If I just focus for two years on those two aspects, I can live the rest of my life without having to worry much about them. If I slack off now, I'll be forced into the hard fight for survival. If you notice, I said "I'm at a point where...", that implies this is a passing phase I can't avoid. And "I will only use it when I have the time and plan for my game." I still plan to complete the game, even after I'm married, lol!
Don't get me wrong, I'm not the kind of guy who always focuses of career and profit alone. In fact, I'm quite the opposite (I'm an INFP, if it means anything to you). But sometimes, you have to do things you don't like for securing a life where you can live in agreement with your conscience.
Quote from: Fantasist on July 14, 2009, 09:08:17 am
I'm a person who knows that better than probably most people, but I'm already 2 years late. I have to open my eyes to the world some day. If I just focus for two years on those two aspects, I can live the rest of my life without having to worry much about them. If I slack off now, I'll be forced into the hard fight for survival. If you notice, I said "I'm at a point where...", that implies this is a passing phase I can't avoid. And "I will only use it when I have the time and plan for my game." I still plan to complete the game, even after I'm married, lol!
Don't get me wrong, I'm not the kind of guy who always focuses of career and profit alone. In fact, I'm quite the opposite (I'm an INFP, if it means anything to you). But sometimes, you have to do things you don't like for securing a life where you can live in agreement with your conscience.
Well OK then, what you said sounded like the complete opposite^^
I don't really have to worry about things like that as my hobbies and my career will most likely be the same thing (I want to be an audio engineer/ musician) and I still have 3 years of school^^
[/offtopic]
Quote from: Kagutsuchi on July 14, 2009, 06:43:09 am
Quote from: Seox on July 14, 2009, 12:12:18 am
Quote from: Kagutsuchi on July 13, 2009, 08:28:01 pm
Does this script give you threat depending on how much damage you do?
No. Even misses generate threat. Try the demo, you'll see very quickly how it works. However, with basic scripting knowledge, an edit is possible. I might not be able to SOON, but within the next couple of days, I can edit it for you.
Good ^^ I could see that some people might want to use this version of a threat system, but to me it just doesn't make sense to have a threat system where how much damage you deal doesn't deside your threat.
< wow and aoc geek =D
Send me a PM with the details?
Fantasist, my coding isn't exactly the CLEANEST stuff around, but it works, and it's (I SUPPOSE) readable. If I make this edit for Kagutsuchi, would you like a copy of the result with which to base a possible update off of, or release as 1.something? I'll make it configurable as to the threat style - current, or damage based. What do you say?
Well, frankly, I don't want anything to do with this anytime soon, but sure, why not? I'll do what I can while I'm still into it.
Quote from: Fantasist on July 14, 2009, 06:36:52 pm
Well, frankly, I don't want anything to do with this anytime soon, but sure, why not? I'll do what I can while I'm still into it.
^_^
Quote from: Seox on July 14, 2009, 10:23:47 am
Quote from: Kagutsuchi on July 14, 2009, 06:43:09 am
Quote from: Seox on July 14, 2009, 12:12:18 am
Quote from: Kagutsuchi on July 13, 2009, 08:28:01 pm
Does this script give you threat depending on how much damage you do?
No. Even misses generate threat. Try the demo, you'll see very quickly how it works. However, with basic scripting knowledge, an edit is possible. I might not be able to SOON, but within the next couple of days, I can edit it for you.
Good ^^ I could see that some people might want to use this version of a threat system, but to me it just doesn't make sense to have a threat system where how much damage you deal doesn't deside your threat.
< wow and aoc geek =D
Send me a PM with the details?
Fantasist, my coding isn't exactly the CLEANEST stuff around, but it works, and it's (I SUPPOSE) readable. If I make this edit for Kagutsuchi, would you like a copy of the result with which to base a possible update off of, or release as 1.something? I'll make it configurable as to the threat style - current, or damage based. What do you say?
Details? There really aren't all that many details..
-You generate threat equal to the amount of damage or healing you do
-Skills may have threat modifiers, some skills may be set up in a database to generate 200% threat (twice the damage they deal) and some skills may have a flat threat modifier. +500/-500 threat.
-"Taunt" skills which place you on the top of the threat list, regardless of anything else.
This is the best surprise! I've been busy with school, but I come back to RMXPing and see that my script request has been finished. Thank you so much, Fantasist! You've made my day, many times over. :haha:
No problem ^_^ (and sorry for being a year late ^_^')
oh man, this could possibly be the best battle add-on script i could use, i've always wanted to make my enemies more dangerous like how they are in Final Fantasy XII where they find and kill the most dangerous enemy *Level++*
I like this, I very may use it for my Kommunizt project.
Glad to know my work is appreciated ^_^
it doesn't quite like ZTBS that I can tell, so I'll figure that out some other time.
i was just iplementing it into Black Core (over 200 skills to configure, took a while) and i was just thinking about a suggestion,
what i thought of is maybe multipling the threat depending on the element so say a monster's Fire element defence level is A, Ice element is F and the rest C, if the monster is atatcked with a fire element skill, the threat goes up by x3 more (because it is it's wekaness) while when attacked by an ice skill, it goes down my x-3 (because it absorbs the attack, no threat and most liekly to ignore that chater so it can keep getting attack and healed up like that)
so it works like this
A = x3
B = x2
C = normal
D = -normal (or x-1, which ever you want to call it)
E = x-2
F = x-3
I'm having a problem with the threat system here. After I implemented it into my game, I cannot force a monster to do a skill. Quite basically, the force action function doesn't work any more. Any suggestions? :P
I will look into it.
Is this compatible with Charlie Lee´s CTB (the FFX battle systme script...) and if not, could somebody make a plugin for it.
QuoteIs this compatible with Charlie Lee´s CTB (the FFX battle systme script...) and if not, could somebody make a plugin for it.
we don't know.
if you really wane know I suggest to test it out yourself.
put both in a project and see if you get errors
i have it running with a high custom Sideview battle system
been looking at the CTB, it should work. but it will require some edits in the script to make it more visual.
edit:
tested it in the demo
seems to work without a problem
you should make a new frame for the threat or something because the normal one will not work.
Oh, okay... Thanks Jacko
Tested this on RTAB...didn't quite work.
Has anyone been able to get it to work with RTAB? Or have any ideas on how to? Thanks!
since the script works with turns I don't think it will work.
Wait, doesn't the RTAB already have something like this? That's what inspired me to do this in the first place. If it's not in the RTAB by default, look for its addons, I'm sure you'll find it.
This script is excellent, and I'm definitely going to use it my project, but I have one question: How difficult would it be to have an actor's threat reset to zero if they are incapacitated? It sounds like it would be simple, but I'm still on the early side of learning this business.
Edit: Make that two questions. What would cause the script to generate ungodly amounts of lag in-battle? I'm not using any other scripts that alter the battle system, and the threat system works fine for me in the demo.
Edit #2: It seems it's just the window causing it. I disabled it and left the next-to-name counter on and it's alright.
he probably has the window refreshing every frame I'll look into it for you
EDIT: nope he only has it refreshing if threat has changed, exactly what it is supposed to do
Hmm. Oh well, I like it better with the counter next to the name anyway, so no harm there.
This script is amazing. The end.
Quote from: Ryexander on November 08, 2009, 03:59:52 pm
he probably has the window refreshing every frame I'll look into it for you
EDIT: nope he only has it refreshing if threat has changed, exactly what it is supposed to do
Hey, I'd know that by now :P
Quote from: samsonite789 on November 11, 2009, 12:50:30 pm
This script is amazing. The end.
Thanks for that mate :)
But...
Quote from: Talglys
I'm having a problem with the threat system here. After I implemented it into my game, I cannot force a monster to do a skill. Quite basically, the force action function doesn't work any more. Any suggestions?
I still haven't fixed that problem ._. I haven't even tested it actually. I know, it's bad on my part but he never seems to return and I didn't get around fixing it. Since I'm lazy, please post if it's really an issue and I'll try to fix it.
Quote from: Fantasist on November 08, 2009, 10:23:31 am
Wait, doesn't the RTAB already have something like this? That's what inspired me to do this in the first place. If it's not in the RTAB by default, look for its addons, I'm sure you'll find it.
I scoured the internet and couldn't find any addons. I've come to realize that very few things work with RTAB. Ah, well...
Quote from: Fantasist on November 13, 2009, 01:52:18 pm
Thanks for that mate :)
No, thank
you. This script adds a lot of strategy and depth to battles.
Quote from: Talglys
I'm having a problem with the threat system here. After I implemented it into my game, I cannot force a monster to do a skill. Quite basically, the force action function doesn't work any more. Any suggestions?
Quote from: Fantasist
I still haven't fixed that problem ._. I haven't even tested it actually. I know, it's bad on my part but he never seems to return and I didn't get around fixing it. Since I'm lazy, please post if it's really an issue and I'll try to fix it.
@Fantasist: I, for one, wouldn't mind it at all if you fixed that problem. But it's your time, your life, your prerogative. Hooowwweeevvveeerrrr...
@Talglys: There is a workaround to this problem. One, I tested the force action command out and it works for
actors, but not enemies. This is good, because enemies can have their action forced another way than the Force Action command, and that is this:
Go to the Enemies tab in the database and enter whatever skill or action you want to force in their skill list and set the conditions to whatever turn you want to force that skill or action on. Voila - same thing as the force action command. And, luckily for us, the condition for using that skill can be a switch, so if you want more specific conditions, just make an event page for the troop, set the condition for the event to turn whatever-the-hell, make a conditional branch(es) for whatever special conditions you want to check, and then if those are met throw a switch which is then used as the condition for the monster using that skill. Ta-da...
You, sir, just earned a levelup, for testing for the problem and coming up with a workaround. *levels up*
About the threat system for the RTAB, I should've mentioned that it's not called that, it's just one of the addons. Try searching for all RTAB addons and read their descriptions. I'm 100% positive because that's where I saw it first.
Quote from: Fantasist on November 14, 2009, 01:56:27 pm
You, sir, just earned a levelup, for testing for the problem and coming up with a workaround. *levels up*
What does that mean? If it means I get skill points, I put them all in intelligence so I can understand battle systems and how to reprogram RTAB.
Quote from: Fantasist on November 14, 2009, 01:56:27 pm
About the threat system for the RTAB, I should've mentioned that it's not called that, it's just one of the addons. Try searching for all RTAB addons and read their descriptions. I'm 100% positive because that's where I saw it first.
I'm pretty sure I checked them all and didn't find anything like the aggro-esque threat system you made. I could very well be wrong, but it's beside the point; RTAB is incompatible with a lot of things I want to use on a fundamental level and I don't have the time or patience to try and figure such labyrinthine code out. So, I just switched to another battle system that works very well with many things.
Regardless, thanks for the level up! *heads off to mindlessly kill hordes of orcs*
I took a look at this earlier and I'm finding it very helpful.
Thanks for a fantastic script!
Nice surprise - this works with sbs tankentai! ^^
Quote from: Ravenith on April 14, 2010, 09:41:01 am
Nice surprise - this works with sbs tankentai! ^^
Neat, another compatibility problem I don't need to bother about :D
...now, what's SBS Tankentai? It rings a bell, but I can't put my finger on it. Google!
A sideview battle system with notorious incombatibility issues. What I like about it is that you don't need a lot of custom sprites etc - the actor's characterset bashes the enemy with his equipped weapon's icon. Laziness ftw.
Anyway, thanks for the threat script - it's amazing how much design space it offers!
You're welcome, and thanks for using this script :)
Now could you point me to the latest version of SBS Tankentai, please? I'd like to check it out.
*Necroposts like the bastard he is*
Did anyone ever make this compatible with Babs?
I tought Babs already do that by activating "actions" or "observer" xD.
This only works in a turn based system i think.
Alright, thanks!
First of all, I have no real ruby scripting knowledge, I only know C! So I don't really know what I was doing, but anyway, looks like it worked.
I think I found solution for the force action issue.
First, look for
def update_phase4_step2, which should be on line 259 if you don't modify anything from the script.
Then substitute this:
def update_phase4_step2
@active_battler.make_action if @active_battler.is_a?(Game_Enemy)
update_phase4_step2_choose_actor_realtime
end
For this:
def update_phase4_step2
if $game_temp.forcing_battler == nil # If there is no force action this turn
@active_battler.make_action if @active_battler.is_a?(Game_Enemy)
end
update_phase4_step2_choose_actor_realtime
end
I tried it on the demo, and looks like it worked. Didn't extensively tested it though...
(On my project, it worked more or less, but probably because it's full of my own noob game_battler/scene_battle modifications...)
So good luck with this xD
EDIT: I just noticed. The force action has to be 'execute now'.
I'm sorry for necroposting, but would it be possible to edit this script in such a way,
that it allows certain skills or maybe even any actions from certain bosses to ignore the threat system completely?
For example, skills that incapacitate the enemy would serve better against a damage dealer or healer than the tank.
The same goes for skills that reduce the opponents healing or damage.
Sorry, but I've stopped coding RGSS a while ago. Besides, as I said before, the possibilities for making enemies intelligent are way too many, and this is a simple script based on a specific request by a member. I might update this, just maybe. If I do, I'll inform you by PM. But better not count on it. Sorry ._.
@Any other scripters: You guys can take a shot at this. If you release a version based on this one, I'll lock this topic and link to yours.
That's ok, thanks for the response anyway. :)
The game I'm working on is for my final assignment at school
and it has to be done by januari/februari.
Untill then i'll keep an eye on my PM's and this thread in case you change your mind
or someone else decides to do it.
Sorry again. Good luck :)
EDIT:
Updated to v1.1
Changelog:
Quote1.1 - Fixed Force Action bug and added enemy-specific threat ignore
If I ever update this again:
- Explore force action bug and see if it can be fixed in a better way.
- Re-work entire system to see if it can include many of the requested features without breaking compatibility with other scripts.
Point 2 in the To-do list is the main reason why I don't want to update this script. If it were specifically for one game, I could add many features but as a script release, it's too much pain to worry about compatibility.
EDIT 2:
Updated to v1.2
Changelog:
Quote1.2 - Added disable by switch, threat by damage, fixed a display bug
Awesome job and again, thank you for your help and effort. :)
*levels up*
You're welcome :)
I am having a very odd issue, that is just... well.. odd.
I am using this script, configured it for multiple skills and tested it:
everything works as supposed to as expected.
Now, when my game is demo-ready, I compress it and then extract it on a different pc to do another final full test run.
This is where the sorcery kicks in:
some skills add a different amount of threat than supposed to, while the regular attack and other skills still work as supposed to.
Does anybody have an idea what could be the cause of this?
I tryed to use this script and it all works for me except threat caused by skills, the second part works the threat removed by skills but i cant create a taunt move because no skills will create any threat, i have tryed typing [100, -10] [+100, -10] both wont work. Also healing moves dont cause threat and they dont even work to remove it. could anyone tell me what im doing wrong?
i have kept trying and i really cant get healing spells to cause threat is that even possible, i have made taunt work by setting threat damage to false and i kind of understand why it doesn't work with it set to true but i really need a way around this because i want the threat to be based on damage done but for certain moves to do set amounts of threat and healing to do this as well.
also a (threat = ) on skills would be good so you can use a skill to set threat at a set amount no matter what it currently is.
i sorted the problem of heals not doing set threat by tweaking the script very slowly because its the first time ive touched it :p
#--------------------------------------------------------------------------
# * 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 && damage.is_a?(Numeric) && damage > -9999
user_threat, party_threat = threat[0], threat[1]
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
i need a gtbs pluggin...
can someone help ??
http://www.creationasylum.net/forum/index.php?showtopic=20353 (http://www.creationasylum.net/forum/index.php?showtopic=20353)
thx alot in advance