• 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.

Some questions

Status
Not open for further replies.
Level 17
Joined
Mar 21, 2011
Messages
1,611
hi, i have some questions:

1. what is best: hashtables, using Index, Bribe's unit indexer ?
2. i got a problem, i could solve it but then its rly unefficient.
-->
i have bribes unit indexer and i wanted to do a custom shockwave (as the normal one, but it stuns if it hits somebody), well so i created a dummy that looks like shockwave and took his custom value for indexing ( i added it to a group and picked every unit in that group in the next trigger [every 0.03 secs]), now there is my problem, in the "an unit casts an ability" trigger, i need to start with [Unit1 = Triggering unit] , but i couldnt because it has an index, so i have to create the dummy first, set index and then do [Unit1[Index] = triggering unit]

Trigger:
  • ES
    • Ereignisse
      • Unit - A unit Starts the effect of an ability
    • Bedingungen
      • (Ability being cast) equal to Earth Shock
    • Aktionen
      • Unit - Create 1 Earth Shock for Neutral feindlich at EarthShock_Point facing EarthShock_Angle[EarthShock_Index] degrees
      • Set EarthShock_Target = (Target point of ability being cast)
      • Set EarthShock_Dummy = (Last created unit)
      • Set EarthShock_Index = (Custom value of EarthShock_Dummy)
      • Set EarthShock_Unit[EarthShock_Index] = (Triggering unit)
      • Set EarthShock_Point = (Position of EarthShock_Unit[EarthShock_Index])
      • Set EarthShock_Damage[EarthShock_Index] = (60.00 + (60.00 x (Real((Level of Kanalisieren for EarthShock_Unit[EarthShock_Index])))))
      • Set EarthShock_Range[EarthShock_Index] = 900.00
      • Set EarthShock_Speed = 30.00
      • Unit - Make EarthShock_Dummy face EarthShock_Angle[EarthShock_Index] over 0.00 seconds
      • Unit - Set level of Earth Shock (Dummy) for EarthShock_Dummy to 1
      • Unit Group - Add EarthShock_Dummy to EarthShock_Group
      • Set EarthShock_Counter = (EarthShock_Counter + 1)
      • Custom script: call RemoveLocation (udg_EarthShock_Point)
      • Custom script: call RemoveLocation (udg_EarthShock_Target)
      • Trigger - Turn on ES Loop <gen>

see my problem? i need the angle and the point before the creation of the dummy, but i need the dummy before the triggering unit
 
Level 17
Joined
Mar 21, 2011
Messages
1,611
well look at the " create unit "
there are 2 variables inside which werent setted before, but i cannot set them before (try it out and you'll see the problem). without bribes unit indexer i wouldnt have the problem, but i wanna use it
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
well look at the " create unit "
there are 2 variables inside which werent setted before, but i cannot set them before (try it out and you'll see the problem). without bribes unit indexer i wouldnt have the problem, but i wanna use it

The unit indexer has events for when it indexes/deindexes a unit.

Thus, all you have to do is store all you want to store in variables and then in another trigger apply the values when the unit is indexed.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
thank you for your replies.
xonok, i dont understand what you say, could you explain it to me with a simple example?

When a unit is indexed:
  • IndexEvent(or whatever) becomes equal to 1
Deindexed
  • IndexEvent becomes equal to 2
Assuming you are using Bribe's GUI unit indexer.

So basically you save everthing about the projectile into variables(angle/speed/etc) and then you have another trigger that runs when a unit is indexed.
The other trigger gets the custom value of the indexed unit(IndexedUnit[UDex] or something similar) and then saves all parameters to a hashtable.
 
Level 17
Joined
Mar 21, 2011
Messages
1,611
i found a solution that works. bribes unit indexer never gives a unit the value 0 (i checked it)

  • ES
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) equal to Earth Shock
    • Actions
      • Set EarthShock_Unit[0] = (Triggering unit)
      • Set EarthShock_Point = (Position of EarthShock_Unit[0])
      • Set EarthShock_Target = (Target point of ability being cast)
      • Set EarthShock_Angle[0] = (Angle from EarthShock_Point to EarthShock_Target)
      • Unit - Create 1 Earth Shock for Neutral hostile at EarthShock_Point facing EarthShock_Angle[0] degrees
      • Set EarthShock_Dummy = (Last created unit)
      • Set EarthShock_Index = (Custom value of EarthShock_Dummy)
      • Set EarthShock_Unit[EarthShock_Index] = EarthShock_Unit[0]
      • Set EarthShock_Angle[EarthShock_Index] = EarthShock_Angle[0]
      • Set EarthShock_Damage[EarthShock_Index] = (60.00 + (60.00 x (Real((Level of Earth Shock for EarthShock_Unit[EarthShock_Index])))))
      • Set EarthShock_Range[EarthShock_Index] = 900.00
      • Set EarthShock_Speed = 30.00
      • Unit - Set level of Earth Shock (Dummy) for EarthShock_Dummy to 1
      • Unit Group - Add EarthShock_Dummy to EarthShock_Group
      • Set EarthShock_Counter = (EarthShock_Counter + 1)
      • Custom script: call RemoveLocation (udg_EarthShock_Point)
      • Custom script: call RemoveLocation (udg_EarthShock_Target)
      • Trigger - Turn on ES Loop <gen>
i tried it out and it works!
but i think theres a better solution..
what do you think?
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
i found a solution that works. bribes unit indexer never gives a unit the value 0 (i checked it)

  • ES
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) equal to Earth Shock
    • Actions
      • Set EarthShock_Unit[0] = (Triggering unit)
      • Set EarthShock_Point = (Position of EarthShock_Unit[0])
      • Set EarthShock_Target = (Target point of ability being cast)
      • Set EarthShock_Angle[0] = (Angle from EarthShock_Point to EarthShock_Target)
      • Unit - Create 1 Earth Shock for Neutral hostile at EarthShock_Point facing EarthShock_Angle[0] degrees
      • Set EarthShock_Dummy = (Last created unit)
      • Set EarthShock_Index = (Custom value of EarthShock_Dummy)
      • Set EarthShock_Unit[EarthShock_Index] = EarthShock_Unit[0]
      • Set EarthShock_Angle[EarthShock_Index] = EarthShock_Angle[0]
      • Set EarthShock_Damage[EarthShock_Index] = (60.00 + (60.00 x (Real((Level of Earth Shock for EarthShock_Unit[EarthShock_Index])))))
      • Set EarthShock_Range[EarthShock_Index] = 900.00
      • Set EarthShock_Speed = 30.00
      • Unit - Set level of Earth Shock (Dummy) for EarthShock_Dummy to 1
      • Unit Group - Add EarthShock_Dummy to EarthShock_Group
      • Set EarthShock_Counter = (EarthShock_Counter + 1)
      • Custom script: call RemoveLocation (udg_EarthShock_Point)
      • Custom script: call RemoveLocation (udg_EarthShock_Target)
      • Trigger - Turn on ES Loop <gen>
i tried it out and it works!
but i think theres a better solution..
what do you think?

This also works, but note, that you are not saving the values to the dummy, but to the caster.
In other words, 1 spell instance per caster and never more, or it will bug.

EDIT: Proposed solution that allows for 8190 instances.
Note that this is only an example, so it leaks and has a million other problems.
  • ES1
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) EarthShock
    • Actions
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing Default building facing (270.0) degrees
      • Set EarthShockVar1 = (Facing of (Triggering unit))
      • Set EarthShockVar2 = 30.00
  • ES2
    • Events
      • Game - UnitIndexEvent becomes Equal to 1.00
    • Conditions
      • (Unit-type of UDexUnits[UDex]) Equal to (==) Dummy
    • Actions
      • Set EarthShockVarArray1[(Custom value of UDexUnits[UDex])] = EarthShockVar1
      • Set EarthShockVarArray2[(Custom value of UDexUnits[UDex])] = EarthShockVar2
      • Unit Group - Add UDexUnits[UDex] to EarthShockGroup
 
Level 17
Joined
Mar 21, 2011
Messages
1,611
ok got another problem, and i cant find the mistake .......
well my custom shockwave should hit the enemy only once, of course.
so i added all the units that get hit by the wave to the unit group EarthShock_Out[EarthShock_Index], but it wont work..

  • ES Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in EarthShock_Group and do (Actions)
        • Loop - Actions
          • Set EarthShock_Dummy = (Picked unit)
          • Set EarthShock_Index = (Custom value of EarthShock_Dummy)
          • Set EarthShock_Point = (Position of EarthShock_Dummy)
          • Unit - Move EarthShock_Dummy instantly to (EarthShock_Point offset by EarthShock_Speed towards EarthShock_Angle[EarthShock_Index] degrees)
          • Set EarthShock_Range[EarthShock_Index] = (EarthShock_Range[EarthShock_Index] - EarthShock_Speed)
          • Set EarthShock_Affected = (Units within 180.00 of EarthShock_Point matching ((((Matching unit) belongs to an enemy of (Owner of EarthShock_Unit[EarthShock_Index])) equal to True) and ((((Matching unit) is in EarthShock_Outs[EarthShock_Index]) euqal to False) and (((Matching unit) is alive
          • Unit Group - Pick every unit in EarthShock_Affected and do (Actions)
            • Loop - Actions
              • Unit Group - Add (Picked unit) to EarthShock_Outs[EarthShock_Index]
              • Unit - Order EarthShock_Dummy to Human-Mountain King- 'Thunder Bolt' (Picked unit)
              • Unit - Cause EarthShock_Unit[EarthShock_Index] to damage (Picked unit), dealing EarthShock_Damage[EarthShock_Index] damage of attack type Spells and damage type Magic
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Conditions
              • EarthShock_Range[EarthShock_Index] smaller than 0.00
            • 'THEN'-Actions
              • Unit Group - Remove EarthShock_Dummy from EarthShock_Group
              • Unit - Kill EarthShock_Dummy
              • Unit Group - Remove all units from EarthShock_Outs[EarthShock_Index]
              • Set EarthShock_Counter = (EarthShock_Counter - 1)
            • 'ELSE'-Actions
          • Custom script: call RemoveLocation (udg_EarthShock_Point)
          • Custom script: call DestroyGroup (udg_EarthShock_Affected)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • 'IF'-Conditions
          • EarthShock_Counter equal to 0
        • 'THEN'-Actions
          • Trigger - Turn off (This trigger)
        • 'ELSE'-Actions
the enemy still get multiple hitted by the wave.. why?
 
Status
Not open for further replies.
Top