• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Is it possible to take stats from a unit for use in variables?

Status
Not open for further replies.

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,285
No, this is not possible directly.

You can kind of emulate this behaviour by keeping track of the unit's state (what they have effecting it) and computing the result using script. Obviously this involves a rather large data management system and a huge amount of initial loading (usually generated by some vJASS macro).

In Blizzard's more recent game StarCraft II this is nativly possible as you can read game data values from the catalogs.
 
Level 9
Joined
Apr 26, 2011
Messages
403
  • Autocast Mirage
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Maverick fighter
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Mana of (Attacking unit)) Greater than or equal to 30.00
        • Then - Actions
          • Unit - Order (Attacking unit) to Orc Blademaster - Mirror Image
        • Else - Actions
  • Assign illusion to player
    • Events
      • Unit - A unit Spawns a summoned unit
    • Conditions
      • ((Summoned unit) is an illusion) Equal to True
    • Actions
      • Set Temp_Unit = (Summoned unit)
      • Set Temp_Integer = (Custom value of (Summoning unit))
      • Unit - Set the custom value of Temp_Unit to Temp_Integer
      • Unit Group - Add Temp_Unit to Fighter_Group_Player[Temp_Integer]
      • Unit Group - Add Temp_Unit to Fighter_Group
just add illusion to group, then you can do anything you want

edit:
if you want to "add" illusion spell to targeted unit
then remove spell on 2nd trigger
 
Yeah it is. Just use event Unit Enters region mixed with boolean condition ((Triggering unit) is Illusion) Equals to True.
EDIT: Sorry HuanAk; didn't see your post.

Btw don't manipulate custom values like that. It's evil and risky in case it interferes with Unit Indexers; so.. it sucks xD.
Just use Unit Indexer instead which sets custom values to all units on map automaticaly.
 
Level 26
Joined
Aug 18, 2009
Messages
4,099
You can create unit dummies of your type and order them to attack other dummies to get values like armor or attack damage out of the taken damage, which is of course inconvenient and may be imprecise.

There are some tools that combine object editor data with trigger script (which might not be so easy however). For example, in my current map, I do not create new stuff in object editor but run the ObjectMerger included in JNGP that can be started from external scripts within Code.
 
Status
Not open for further replies.
Top