• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Threat Calc

Status
Not open for further replies.
Level 8
Joined
Jan 23, 2008
Messages
334
Well in one of my projects I have been designing a threat calculator. It desides who is the greatest threat by adding up time in battle and spell damage/healing done. This is being made in GUI.

Alright I have a couple questions but I will start off with the easiest first. If I wanted to make a trigger find the largest value of say about 8-12 values how would I do that? 2 is it possible to have a damage calculator made in GUI or is it only possible in JASS? 3 right now the person with the highest threat would probably run around agroing creeps that are not in combat (This would only happen if the hero was attacking things to put itself in combat). I want it so that the creep knows if it; itself is in combat. If I wanted to do such a thing would each creep need its own varible? And would future creeps that would spawn need there own varibles also??


Thanks in Advance
 
Level 9
Joined
Apr 3, 2008
Messages
700
You need to write the value of damage to the global variable with array (player number of players). Read about damaging system. You can check who did more damage with "Math - Max". It's possible to make it on GUI.
You don't need variable for each creep.
 
Level 8
Joined
Jan 23, 2008
Messages
334
Ahh thank you Day-Elven.


now can anyone answer:

right now the person with the highest threat would probably run around agroing creeps that are not in combat* (This would only happen if the hero was attacking things to put itself in combat*). I want it so that the creep knows if it; itself is in combat. If I wanted to do such a thing would each creep need its own varible? And would future creeps that would spawn need there own varibles also??*




*not in combat (not attacking things, or healing. At guard position)
*combat (attacking things, or healing)
*I have a boolean varible for each hero so that they know whether they are in combat or not.
 
Level 15
Joined
Dec 18, 2007
Messages
1,098
You could give each creep an ability called "Combat Status" when they spawn or w/e. Level 1 of that ability means the creep is not in combat, Level 2 means it is in combat. So when the creep acquires a target or casts a spell or whatever, set the level of the skill to 2. When they stop combat, set it to 1.
So when you want to check if they are in Combat or not, check which level of ability they have using If, Then, Else.
That would probably be the best solution :)
 
Level 8
Joined
Oct 28, 2007
Messages
435
Set User Data (custom value in GUI I think) could also work. Apon spawning you set all your unit's user data to 1 and when they enter combat it is set to 2 and on leaving combat to 1. This is a very "simple" way of doing it, but also should work.
 
Status
Not open for further replies.
Top