[RESOLVED] Script Request: Threat/Aggro System [XP]

Started by KCMike20, January 04, 2009, 06:33:00 am

Previous topic - Next topic

KCMike20

January 04, 2009, 06:33:00 am Last Edit: July 13, 2009, 07:22:31 pm by Starrodkirby86
The Idea:

With the popularity of the MMORPG, I'm surprised this hasn't been done yet, but I'm sure quite a few people would be quick to include a system like this.  Would anyone be willing to take up scripting this?

In RPG Maker XP's default battle system, enemies seemingly target your characters randomly, although battlers in the front row have a higher chance of being targeted than those in the back.  What this script would do is create a threat/aggro system, where each action your battlers perform creates a certain amount of overall threat for his or herself.  This script stores a separate value for each actor that keeps track of the amount of threat they have generated, and enemy actors always target the party member with the highest threat when attacking (or if two actors have the same value, the target is randomly selected between the two).  This has the possibility of creating a more strategic battle system where the player has to balance using strong abilities which produce a high amount of threat with defensive maneuvers to keep the battlers alive.



Customization and Further Explanation:

Now, I'm no scripting genius, but I'd imagine the customization layout would look something along the lines of this:

Max_Threat = 100
When ID then return [[X, Y]]

when 1 then return [[0, 0]]
when 2 then return [[50, 0]]
when 3 then return [[-100, 0]]
when 4 then return [[30, -10]]

This script allows the user to determine the maximum threat possible as well as the amount of threat each skill produces or removes from the actor using it.  The ID is the ID Number of the skill in the database, the X value is the amount of threat a skill produces (or removes) for the actor using it and the Y value is the amount of threat it produces or removes from all actors.  In the above example we made four different skills.  Skill 1 would be an example of a skill that produces no threat for the actor.  Skill 2 is an example of a skill that produces quite a bit of threat.  Skill 3 is a skill that removes all threat from the actor, and skill 4 would produce threat for the actor while removing threat from all actors.



Changes to Battle Screen

Finally, there needs to be a visual representation of how much threat each character has generated.  Below is a screen shot of what I have in mind (I'm using ParaDog's Active Time Battle System v. 2.58, by the way, and a copy can be found at http://rmrk.net/index.php?topic=14056.0):




Excuse the bad picture.  I just drew up something simple in paint before posting.  On the right side of the screen you can see a small box has been added that uses gauges to keep track of the amount of threat each actor has.  Notice how there is a fourth gauge, but there is no fourth actor in the party.  That's my mistake.   :roll:  If the extremely benevolent person who decides to script this can make it so the number of gauges shown is equal to the number of actors in the party (I.E., if you only have two actors, only two gauges are drawn), then that would be perfect!

Thanks so much in advance, and hopefully there is someone out there nice of to take this over.

Fantasist

January 04, 2009, 08:24:55 am #1 Last Edit: January 04, 2009, 08:55:35 am by Fantasist
I don't know the ideal way to do it, but I can try to get it to work.

@Anyone who knows how:

Quoteand enemy actors always target the party member with the highest threat when attacking (or if two actors have the same value, the target is randomly selected between the two).


I've defined the "threat" variable for the Game_Actor class. Next, I modified the Game_Party#random_target_actor method. I collected the valid actors in an array and sorted it by their threats, like this:


class Game_Party
 
  alias fts_threat_choose_actor random_target_actor
  def random_target_actor(hp0 = false)
    # Decide valid targets
    targets = []
    @actors.each {|actor|
    targets.push(actor) if (!hp0 && actor.exist?) || (hp0 && actor.hp0?)}
    return fts_threat_choose_actor(hp0) if targets.size == 0
    # Decide target by their threat
    targets.sort! {|a, b| b.threat - a.threat}
    ############################################
    return fts_threat_choose_actor(hp0)
  end
 
end


After that, I could return the first actor in the target array, but that would not chose randomly b/w actors with same threat. How do I proceed?
Also, is that method the structurally right one to modify?
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Kagutsuchi

Thats a brilliant idea! I'm so tired of the uselessness of a "tank class" because it is noway to make the opponent attack the tank more often than the cloth wearers (the front, middle and rear system doesn't work at all!) <.<

Add-on that allows you to create skills that generate extra aggro/treat would be great.

@Fantasist, does that script work as it is now? or is it incomplete?
(excluding the choose randomly b/w actors with same threat part, that is not so important imo)

KCMike20

I'm glad someone else is excited about this idea!  I was beginning to think I might be the only one.  : P

From a design standpoint, it does add an important aspect of player control to the battle system (which is generally regarded as a good idea).  It makes players consider the risk of using certain abilities and determine if that's a risk their willing to take.  I think it's a system with a lot of potential.

No rush, Fantasist, but just to appease inquiring minds, how is the script coming along?

Fantasist

lol! I was going to get to it eventually. This is actually implemented (as an addon?) in the RTAB. I saw it waaaaaaay back when I had no clue about scripting and decided to get back to it.

Anyway, I haven't tested this extensively, this is not even version 0.5 :P And I'm not too experienced with the battle system, this attempt is my best guess. I can't guarantee the above code works, so don't use it yet.

Quote from: Kagutsuchi@Fantasist, does that script work as it is now? or is it incomplete?
(excluding the choose randomly b/w actors with same threat part, that is not so important imo)

Not so important if you're OK with the enemies always attacking the first actor in the line even if everyone has the same threat :P

So, any ideas? Or maybe I can find some examples in the default scripts.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Kagutsuchi

Quote from: Fantasist on January 07, 2009, 09:27:55 am
lol! I was going to get to it eventually. This is actually implemented (as an addon?) in the RTAB. I saw it waaaaaaay back when I had no clue about scripting and decided to get back to it.

Anyway, I haven't tested this extensively, this is not even version 0.5 :P And I'm not too experienced with the battle system, this attempt is my best guess. I can't guarantee the above code works, so don't use it yet.

Quote from: Kagutsuchi@Fantasist, does that script work as it is now? or is it incomplete?
(excluding the choose randomly b/w actors with same threat part, that is not so important imo)

Not so important if you're OK with the enemies always attacking the first actor in the line even if everyone has the same threat :P

So, any ideas? Or maybe I can find some examples in the default scripts.


Well that wouldn't be a problem if none have the same treat :P
I know nothing about scripting =D

KCMike20

Bumpity bump bump.

Is there anyone out there who can script this?

Fantasist

1. Sorry, I totally forgot about this >.<
2. I still don't know what to do to select random actors with the same threat.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Calintz


KCMike20

Quote from: Fantasist on January 31, 2009, 11:15:13 pm
1. Sorry, I totally forgot about this >.<
2. I still don't know what to do to select random actors with the same threat.



Do you think you could get it to work if we removed the "random actor" bit?  For example, having the script just call the first actor (either in regards to database ID or perhaps actor position in battle) with the highest threat? 

Fantasist

Yes, but I don't like that one bit. OK, so I have exams for the next 3 days, so I think I'll work on it this weekend. Also, I PMed Bliz about something else abd he hasn't responded. When he's active again, I'll take his advice. Basically, if you have some time, know that I'm still on this, cause I like the idea very much.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Kagutsuchi

Wouldn't it be possible to create something which every turn generates between 1-10 random threat by each actor? This way the odds for two actors to have the same aggro will be drastically lowered.

Fantasist

But that would ruin the whole point of this script :P
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Starrodkirby86

Maybe we can further incorporate that when it comes to the threats for actors of the same threat level...? Or it goes even more in-depth, looking into stats or even battle formations to see if that player is a threat. Or...rather...you can configure it to what hero is at a threat, maybe what level or how their welfare is...?

Or is that still too hard for you Fanta...?

What's osu!? It's a rhythm game. Thought I should have a signature with a working rank. ;P It's now clickable!
Still Aqua's biggest fan (Or am I?).




Fantasist

February 05, 2009, 04:43:18 am #14 Last Edit: February 05, 2009, 05:59:56 am by Fantasist
I figured it out! It's so simple, I can't believe I didn't think of it earlier >.<

@KCMike:
So only skills can modify the threat. Max threat should be defined. I'm also assuming minimum threat is 0. This should be done soon.

EDIT:
Okay, I've succesfully implemented everything including the config system. But lets say you use a skill and it misses. Do you want missed skills to change the threat level or do the skills have to deal damage?
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




KCMike20

February 05, 2009, 06:36:26 pm #15 Last Edit: February 05, 2009, 06:41:12 pm by KCMike20
Quote from: Fantasist on February 05, 2009, 04:43:18 am

EDIT:
Okay, I've succesfully implemented everything including the config system. But lets say you use a skill and it misses. Do you want missed skills to change the threat level or do the skills have to deal damage?



Fantasist, this made my day!  I can't wait to try out the finished script!

Also, this is a very good question.  I know other people are interested in this script, and I don't want to ruin the scripts functionality based on what I had in mind but...Personally, I still would like missed skills to generate threat.  Hey, if somebody shot an arrow at me, and it missed and hit a nearby tree instead, I'd still think I'd be pretty pissed.  Either way, I still think some abilities, such as strong status effects, should cause threat too, so I say yes, skills should be able to draw threat whether they inflict damage or not.


EDIT: I hate to throw this out there before I've seen the finished script, but do you think it's possible to implement skills that remove a certain amount of threat when you target a party member?  For example, we could make a skill called "Pacify" that removes 10 threat from whoever the target is.

Fantasist

February 06, 2009, 05:35:56 am #16 Last Edit: February 06, 2009, 07:23:48 am by Fantasist
QuotePersonally, I still would like missed skills to generate threat.  Hey, if somebody shot an arrow at me, and it missed and hit a nearby tree instead, I'd still think I'd be pretty pissed.  Either way, I still think some abilities, such as strong status effects, should cause threat too, so I say yes, skills should be able to draw threat whether they inflict damage or not.

That's what I had in mind too :)

QuoteEDIT: I hate to throw this out there before I've seen the finished script, but do you think it's possible to implement skills that remove a certain amount of threat when you target a party member?  For example, we could make a skill called "Pacify" that removes 10 threat from whoever the target is.

Yeah, I can work on that. As things stand now, I'll finish this before Sunday.

EDIT:
I hit a hitch again. I need to analyze something closely. It could take a bit long, but it's highly unlikely.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




KCMike20

Quote from: Fantasist on February 06, 2009, 05:35:56 am

QuoteEDIT: I hate to throw this out there before I've seen the finished script, but do you think it's possible to implement skills that remove a certain amount of threat when you target a party member?  For example, we could make a skill called "Pacify" that removes 10 threat from whoever the target is.
Yeah, I can work on that. As things stand now, I'll finish this before Sunday.

EDIT:
I hit a hitch again. I need to analyze something closely. It could take a bit long, but it's highly unlikely.




I'm guessing that hitch struck hard.  How goes the progress on this?

Fantasist

February 22, 2009, 12:37:43 am #18 Last Edit: February 22, 2009, 12:42:34 am by Fantasist
How goes the progress... my laptop where I have your project is busted, it's not starting up. I had to reinstall XP on my desktop due to it's unbearable annoyances. Do you have a deadline for this?

EDIT:
And of course, I still haven't found a way around the hitch I was talking about.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




KCMike20

Yikes!  So sorry to hear the bad news.

Nope, no deadline.  I was just trying to quell my fear that this thread had been forgotten about.   :^_^':