• 🏆 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!

[Solved] Bribe's GUI Unit Indexer (Unit Event) and GUI Damage Engine

Status
Not open for further replies.
Level 1
Joined
Jan 23, 2015
Messages
160
Hey everyone - putting this here because I think it is a step above "getting started" for the trigger, since I need help implementing a system to get Unit Indexer/Unit Event to interact with Damage Engine.

I did already msg Bribe and ask about this, but he's a busy man and all so hopefully the community can help out too.

I'm an aspiring noob gui'er so these two systems are making my life a lot easier. I'm positive they can achieve what I need but I'm too stupid to go about implementing it, hope someone can help.

The deal:

I am implementing the damage engine such that a Damage Event will take the unit's base damage, and has a lot of different things that can happen based on Strength, Agility, and Intelligence.

  • Damage Event Example
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
      • (DamageEventSource is A Hero) Equal to True
      • (DamageEventSource is A Hero) Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Weapon/LongSword for DamageEventSource) Greater than 0
        • Then - Actions
          • -------- Poor Quality --------
          • -------- --------
          • -------- Set Weapon Accuracy Bonus --------
          • Set Variable = Value (this would be where I call that indexed units Agility or Non Hero Agi Ability)
          • -------- Set Accuracy Roll For Source of Attack --------
          • Set Variable = Value
          • -------- Set Critical Chance --------
          • Set Variable = Value (Maybe Str or Str ability for non hero)
          • -------- Set Weapon Damage --------
          • Set Variable = (Random real number between 2.00 and 8.00)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Condition 1 and Condition 2
            • Then - Actions
              • Set DamageEventAmount = Value
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Condition 1 and Condition 2
                • Then - Actions
                  • Set DamageEventType = DamageTypeCriticalStrike
                  • Set DamageEventAmount = Value
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Value Less than Value
                    • Then - Actions
                      • Set DamageEventType = DamageTypeMiss
                      • Set DamageEventAmount = 0.00
                    • Else - Actions
        • Else - Actions

So I have non hero units that need artificial Strength, Agility, and Intelligence. I decide to make a Spell Book called (Monster Stats) with abilities based off tornado slow aura inside the Spell Book (Monster Stats) - the level of these tornado based abilities will be the number of the Strength, Agility, or Intelligence amount for that non hero unit on Damage Event.

Moving to Unit Indexer/Unit Event:

All non hero units I use will have this Spell Book (Monster Stats) so I don't think I need to add it as anyone is created (though that might be useful too)

But what I'm trying to do is have every unit or unit type, be indexed and have variables with the level of their strength, agility, or intelligence attached to them so I can recall this variables into Damage Event without getting screwed up in some MUI incompatibility.

Summing up the Problem:

Non Hero unit is indexed, how can I get a variable that takes the level of the artificial stat (str,agi,int) ability in the Spell Book (Monster Stats) which will always start as 1, manipulate it to the level I want (Being able to randomize it between units would be sweet - so 2 ogre would have varying strength scores) , and then store that set of variables to that indexed unit so I can recall them for use in manipulating Damage Event

Would also need to do this for Hero units, but getting their Str, Agi, and Int scores (plus whatever ability level scores, like if I wanted to make an ability "Improve Accuracy" at level 1 to add bonus to "chance to hit" for example.

Thanks for your time if you read all this, and I appreciate any input, even harsh criticisms of how I'm going about all of this.
 
Level 18
Joined
Nov 21, 2012
Messages
835
But what I'm trying to do is have every unit or unit type, be indexed
with UnitEvent units are indexed without your action.
Should your monster units be controlled by a player? Do you need custom Str/Agi/Int displayed on UI?
if not - you don't need slow aura-based abilities, just variables.
Use event from UnitEvent: UnitIndexEvent==1 which means "a unit enters map", this unit is : UDexUnits[UDex], where UDex is unit's custom value (index). Upon this event set variables. Let's call it MonsterStr/Agi/Int: set MonsterStr[UDex]=10, so this value will be connected with specific unit, etc.
To read/change value use (for example in DamageEvent==1): set TempInt=MonsterStr[Custom value of DamageEventSource] and use this value to calculate new damage or smth.
 
Level 1
Joined
Jan 23, 2015
Messages
160
with UnitEvent units are indexed without your action.
Should your monster units be controlled by a player? Do you need custom Str/Agi/Int displayed on UI?
if not - you don't need slow aura-based abilities, just variables.
Use event from UnitEvent: UnitIndexEvent==1 which means "a unit enters map", this unit is : UDexUnits[UDex], where UDex is unit's custom value (index). Upon this event set variables. Let's call it MonsterStr/Agi/Int: set MonsterStr[UDex]=10, so this value will be connected with specific unit, etc.
To read/change value use (for example in DamageEvent==1): set TempInt=MonsterStr[Custom value of DamageEventSource] and use this value to calculate new damage or smth.

Thanks for the quick response @ZiBitheWand3r3r

If I'm trying to assign these values by Unit-type, does this look correct? Is this very efficient, or no?

  • Unit Index and Custom Value Stats for Non Hero
    • Events
      • Game - UnitIndexEvent becomes Equal to 1.00
    • Conditions
      • (UDexUnits[UDex] is A Hero) Equal to False
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of UDexUnits[UDex]) Equal to Timber Wolf
        • Then - Actions
          • Set NonHeroStr[UDex] = 2
          • Set NonHeroAgi[UDex] = 5
          • Set NonHeroInt[UDex] = 2
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of UDexUnits[UDex]) Equal to Ogre Warrior
        • Then - Actions
          • Set NonHeroStr[UDex] = 6
          • Set NonHeroAgi[UDex] = 2
          • Set NonHeroInt[UDex] = 0
        • Else - Actions

Some player controlled units will use this as well, but I don't think I need a UI. I was hoping to have a "scan" kind of ability where if you use it on a unit it will display this values in a game message.

I gotta go out for a few hours but I will return to this tonight and try to do some fancier things. Thanks again bud!

- Edit 1

Went with abilities after all because if I want the player to use an ability to "read" a units stats then that is a kind of UI display, right?
I tried to do this but it doesn't seem to be working. Pretty late here, probably doing something dumb, but wanted to get something else up before bed. Thanks again.

  • Unit Index and Custom Value Stats for Non Hero
    • Events
      • Game - UnitIndexEvent becomes Equal to 1.00
    • Conditions
      • (UDexUnits[UDex] is A Hero) Equal to False
    • Actions
      • -------- ------------------------------------------------------------------- --------
      • -------- \\ Wolf --------
      • -------- ------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of UDexUnits[UDex]) Equal to Timber Wolf
        • Then - Actions
          • Unit - Set level of Non-Hero Stats (Str) for UDexUnits[UDex] to (Random integer number between 1 and 10)
          • Set NonHeroStr[UDex] = (Level of Non-Hero Stats (Str) for UDexUnits[UDex])
          • Unit - Set level of Non-Hero Stats (Agi) for UDexUnits[UDex] to (Random integer number between 1 and 10)
          • Set NonHeroAgi[UDex] = (Level of Non-Hero Stats (Agi) for UDexUnits[UDex])
          • Unit - Set level of Non-Hero Stats (Int) for UDexUnits[UDex] to (5 + 1)
          • Set NonHeroInt[UDex] = (Level of Non-Hero Stats (Str) for UDexUnits[UDex])
        • Else - Actions
      • -------- ------------------------------------------------------------------- --------
      • -------- \\ Giant Wolf --------
      • -------- ------------------------------------------------------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of UDexUnits[UDex]) Equal to Giant Wolf
        • Then - Actions
          • Unit - Set level of Non-Hero Stats (Str) for UDexUnits[UDex] to (Random integer number between 1 and 10)
          • Set NonHeroStr[UDex] = (Level of Non-Hero Stats (Str) for UDexUnits[UDex])
          • Unit - Set level of Non-Hero Stats (Agi) for UDexUnits[UDex] to (Random integer number between 1 and 10)
          • Set NonHeroAgi[UDex] = (Level of Non-Hero Stats (Agi) for UDexUnits[UDex])
          • Unit - Set level of Non-Hero Stats (Int) for UDexUnits[UDex] to (10 + 1)
          • Set NonHeroInt[UDex] = (Level of Non-Hero Stats (Str) for UDexUnits[UDex])
        • Else - Actions

  • Set Damage Copy
    • Events
      • Game - DamageModifierEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Set TempNonHeroStr = NonHeroStr[UDex]
      • Set TempNonHeroAgi = NonHeroAgi[UDex]
      • Set TempNonHeroInt = NonHeroInt[UDex]
      • Set DamageEventAmount = (DamageEventAmount + (Real(TempNonHeroStr)))
 
Last edited:
Status
Not open for further replies.
Top