Threat System

envenger

Active Member
Reaction score
3
Hi....

I had thought a threat system for my RPG map...
I need some help, feedback and suggestions on it.
So here how it is like...
First every hero has a threat value... they gain it from items or passives..

They are numbers like 2,3,4,20 etc...
like if A has 10, B has 20 and C has 5.

They have 2 use..

1. Deciding the attacked enemy
The enemy units line of sight(triggered) is updated like every 1-2seconds(value not thought better if any one could say me).

When it is updated it checks units with the highest threat and then attacks it.

like if A has 10, B has 20 and C has 5 threat value.
and A does a damage of 1000, B of 800 and C a healing of 1500.
Threat value of A is 1000*15 = 15000, of B is 800*20 = 16000 and of C is 1500*5 = 7500

And the enemy will attack B

*Here i need a help to check if the both units are in line of sight or not or if they have trees or wall or something between them.

2. The aggro during a fight
When 2-3 units are attacking an enemy unit.
There damage or there heal is multiplied by threat and is stored in a variable named threat value.

There is a trigger which runs every 4,5 or 6 seconds(There is a random loop executing it. It is done to make some randomness and put more effect. And suggestion on it will be welcomed).
The trigger can run in any of those 3 values it depends on your luck.
When it runs, the threat value is rested. And the enemy attacks the unit with the highest threat value.

Also there are some special spells which make this trigger run when there is a need for extra threat.

Displaying system

There is a system that stores the value and converts them to a percent to show players by multiboard.

like if A has 10, B has 20 and C has 5 threat value.
and A does a damage of 1000, B of 800 and C a healing of 1500.
Threat value of A is 1000*15 = 15000, of B is 800*20 = 16000 and of C is 1500*5 = 7500
Total threat value of system is 38500

Now there are 2 ways to represent this

On a full-scale

The threat percent for B is ((16000/38500)*100) = 41.55%
Even though this is more clear it has its problems
In a 2 men group the job of players is to keep threat below 50% who doesn't want to take threat but,
for a 3 men group the job of players is to keep threat below 33%.

Its technically 100/(no of players)

On a out of 100% scale
In This the threat percent for B is taken out of 38500/(no of players)

So, the threat percent is ((16000/(38500/3))*100) = 124.65%

So, here if you don't want to take threat you will need to keep it below 100% while if you want to take threat you need to keep it above 100%

The threat percent is updated on the screen every 1.5 or 2 seconds(suggestions if any).

*And, i am unsure which of the systems should i use among the two to represent this. Need help for that or any way to improve it.

Also there are many spell schools which have there own threat percents like a shadow spell causes more threat than a nature spell.

Well this is it... i know its not organized but hope you understand... I have tried my best to represent my idea here.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
display should be via floating text unique to the local player for units in combat with the target, threat also should not be limited to heroes but include npcs, ie: mind control threat... threat should be updated upon a damage event not on regular intervals
threat should be determined by overall damage dealt to a target, which is dynamic, not a static method like the one you are using (determined by who has the best items/level/hero type/etc)

display should not be for the total group, but for each player on each unit

this is something i was working on a while back but it should put the main point across:

JASS:
private struct Threat extends array
    unit unit
    real max
    real secondMax
    integer target
    integer second
    group targets
    boolean inCombat
    texttag text
    
    private method periodic takes nothing returns nothing
        local group g = this.targets
        local unit u
        local thistype i
        local real x = GetUnitX(this.unit) - 20
        local real y = GetUnitY(this.unit)
        local integer a
        call SetTextTagPos(this.text, x, y, 10 * 0.023 / 10)
        loop
            set u = FirstOfGroup(g)
            exitwhen u == null
            set i = GetUnitId(u)
            set a = R2I(LoadReal(bj_lastCreatedHashtable, this, GetUnitId(u))/this.max)
            if GetLocalPlayer() == GetOwningPlayer(u) then
                call SetTextTagVisibility(this.text, true)
                call SetTextTagText(this.text, SubString("|cffff0000" + SubString("''''''''''''''''''''", 0, a - 1) + "|r|cffffc1c1" + SubString("''''''''''''''''''''", a, 19) + "|r", 0, 19), -10)
            endif
            call GroupRemoveUnit(g, u)
            set u = null
        endloop
        call DestroyGroup(g)
    endmethod
    
    implement T32x
endstruct


this is part of a threat system that i made a while back, im not even sure that it compiles cuz i havent looked at it in a while (for personal use and not optimized/changed for public use)
 

envenger

Active Member
Reaction score
3
I will use an multi-board to represent for each hero.
Got no idea about npc or player may be a floating text above them will like you said. And only the player which could control it could see it.

I don't want to make it on damage...

Cause if i make a mage with a huge damage spell... He should use it form time to time so... If i do it on damage it will draw instant aggro even if his total dps is less.
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
well the point is to balance the damage for damage dealers and make non-damage dealers create modified threat, ie: a tank creates 300% x his damage in threat, but deals very little damage, whereas a caster deals 10 x the tanks damage but has his threat reduced by 75%, and healers get minor threat on everything when they heal, etc...
what you wanted to make isnt a threat system, its slightly improved AI, threat is a dynamic high quality AI
 

envenger

Active Member
Reaction score
3
making threat on damage will make the enemy move between two targets while not attacking any.

Any suggestion on the two ways to display threat? Which one should i use??

And way to detect trees or any path blockers between the two units?
 

GFreak45

I didnt slap you, i high 5'd your face.
Reaction score
130
no it doesnt... whoever has dealt the most total damage over the duration of the fight has the most threat, its not instantaneous threat its accumulative, starting at 0 and getting higher and higher
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top