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

[Trigger] Spell Fixing - To Arms! GUI

Status
Not open for further replies.
Level 5
Joined
Dec 25, 2014
Messages
111
Well, i need help to fix my spells to be working properly.
This spell is using unit indexer.
Here is the triggers :

  • To Arms Initialize
    • Events
    • Conditions
    • Actions
      • -------- This trigger is mean to create and initialize any data needed --------
      • Set ToArms_Ability = (Ability being cast)
      • Set ToArms_DummyUnit = Knight (Dummy)
      • Set ToArms_DummyAbility = Fuzzy (Dummy)
      • Set ToArms_Knights[1] = 3
      • Set ToArms_Knights[2] = 4
      • Set ToArms_Knights[3] = 5
      • Set ToArms_Knights[4] = 6
      • Set ToArms_CollisionSize[1] = 150.00
      • Set ToArms_CollisionSize[2] = 150.00
      • Set ToArms_CollisionSize[3] = 150.00
      • Set ToArms_CollisionSize[4] = 150.00
      • Set ToArms_Distance[1] = 600.00
      • Set ToArms_Distance[2] = 800.00
      • Set ToArms_Distance[3] = 1000.00
      • Set ToArms_Distance[4] = 1200.00
      • Set ToArms_Damage[1] = 70.00
      • Set ToArms_Damage[2] = 90.00
      • Set ToArms_Damage[3] = 110.00
      • Set ToArms_Damage[4] = 130.00
      • Set ToArms_AttackType = Chaos
      • Set ToArms_DamageType = Normal
      • Set ToArms_FinalDistance[1] = (ToArms_Distance[1] x (Real(ToArms_Knights[1])))
      • Set ToArms_FinalDistance[2] = (ToArms_Distance[2] x (Real(ToArms_Knights[2])))
      • Set ToArms_FinalDistance[3] = (ToArms_Distance[3] x (Real(ToArms_Knights[3])))
      • Set ToArms_FinalDistance[4] = (ToArms_Distance[4] x (Real(ToArms_Knights[4])))
      • Set ToArms_Offset[1] = 200.00
      • Set ToArms_Offset[2] = 200.00
      • Set ToArms_Offset[3] = 200.00
      • Set ToArms_Offset[4] = 200.00
      • Set ToArms_Speed[1] = 325.00
      • Set ToArms_Speed[2] = 325.00
      • Set ToArms_Speed[3] = 325.00
      • Set ToArms_Speed[4] = 325.00
      • Set ToArms_SFX = Objects\Spawnmodels\Undead\ImpaleTargetDust\ImpaleTargetDust.mdl
  • To Arms Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to To Arms!
    • Actions
      • Trigger - Run To Arms Initialize <gen> (checking conditions)
      • -------- ---- --------
      • Set ToArms_Integer = (ToArms_Integer + 1)
      • -------- ---- --------
      • Set ToArms_Unit = (Triggering unit)
      • Set ToArms_Index = (Custom value of ToArms_Unit)
      • -------- ---- --------
      • Unit Group - Add ToArms_Unit to ToArms_TempUnitGroup
      • -------- ---- --------
      • Set ToArms_Owner[ToArms_Index] = (Owner of ToArms_Unit)
      • -------- ---- --------
      • Set ToArms_AbilityLevel[ToArms_Index] = (Level of ToArms_Ability for ToArms_Unit)
      • -------- ---- --------
      • Set ToArms_Angle[ToArms_Index] = (Facing of ToArms_Unit)
      • -------- ---- --------
      • Set ToArms_UnitPoint = (Position of ToArms_Unit)
      • -------- ---- --------
      • Set ToArms_Point = (ToArms_UnitPoint offset by 0.00 towards ToArms_Angle[ToArms_Index] degrees)
      • -------- ---- --------
      • For each (Integer A) from 1 to ToArms_Knights[ToArms_AbilityLevel[ToArms_Index]], do (Actions)
        • Loop - Actions
          • Set ToArms_Real = (ToArms_Real + (360.00 / (Real(ToArms_Knights[ToArms_AbilityLevel[ToArms_Index]]))))
          • -------- ---- --------
          • Set ToArms_Formation = (ToArms_Point offset by ToArms_Offset[ToArms_AbilityLevel[ToArms_Index]] towards ToArms_Real degrees)
          • -------- ---- --------
          • Unit - Create 1 ToArms_DummyUnit for ToArms_Owner[ToArms_Index] at ToArms_Formation facing ToArms_Angle[ToArms_Index] degrees
          • Unit - Turn collision for (Last created unit) Off
          • Unit Group - Add (Last created unit) to ToArms_TempDummyGroup
          • -------- ---- --------
          • Custom script: call RemoveLocation(udg_ToArms_Formation)
      • -------- ---- --------
      • Trigger - Turn on To Arms Loop <gen>
      • -------- ---- --------
      • Custom script: call RemoveLocation(udg_ToArms_UnitPoint)
      • Custom script: call RemoveLocation(udg_ToArms_Point)
  • To Arms Condtions
    • Events
    • Conditions
      • ((Matching unit) is A structure) Equal to False
      • ((Matching unit) is an illusion) Equal to False
      • ((Matching unit) is Ethereal) Equal to False
      • ((Matching unit) is alive) Equal to True
      • ((Matching unit) is in ToArms_TempTargetGroup) Equal to False
      • ((Matching unit) belongs to an enemy of (Owner of ToArms_TempUnit)) Equal to True
    • Actions
      • -------- Configure your conditions above --------
  • To Arms Loop
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in ToArms_TempUnitGroup and do (Actions)
        • Loop - Actions
          • -------- ---- --------
          • Set ToArms_TempUnit = (Picked unit)
          • -------- ---- --------
          • Set ToArms_Index = (Custom value of ToArms_TempUnit)
          • -------- ---- --------
          • Unit Group - Pick every unit in ToArms_TempDummyGroup and do (Actions)
            • Loop - Actions
              • -------- ---- --------
              • Set ToArms_TempDummy[ToArms_Index] = (Picked unit)
              • -------- ---- --------
              • Set ToArms_DummyIndex = (Custom value of ToArms_TempDummy[ToArms_Index])
              • -------- ---- --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ToArms_FinalDistance[ToArms_AbilityLevel[ToArms_Index]] Greater than 0.00
                • Then - Actions
                  • -------- ---- --------
                  • Set ToArms_DummyLoc[ToArms_Index] = (Position of ToArms_TempDummy[ToArms_Index])
                  • -------- ---- --------
                  • Set ToArms_TargetGroup[ToArms_DummyIndex] = (Units within ToArms_CollisionSize[ToArms_AbilityLevel[ToArms_Index]] of ToArms_DummyLoc[ToArms_Index] matching ((Evaluate To Arms Condtions <gen> conditions) Equal to True))
                  • -------- ---- --------
                  • Unit Group - Pick every unit in ToArms_TargetGroup[ToArms_DummyIndex] and do (Actions)
                    • Loop - Actions
                      • -------- ---- --------
                      • Unit Group - Add (Picked unit) to ToArms_TempTargetGroup
                      • -------- ---- --------
                      • Unit Group - Pick every unit in ToArms_TempTargetGroup and do (Actions)
                        • Loop - Actions
                          • -------- ---- --------
                          • Set ToArms_TempTarget[ToArms_DummyIndex] = (Picked unit)
                          • -------- ---- --------
                          • Special Effect - Create a special effect attached to the chest of ToArms_TempTarget[ToArms_DummyIndex] using Abilities\Spells\Other\Stampede\MissileDeath.mdl
                          • Special Effect - Destroy (Last created special effect)
                          • -------- ---- --------
                          • Unit - Create 1 Dummy for ToArms_Owner[ToArms_Index] at ToArms_DummyLoc[ToArms_Index] facing Default building facing degrees
                          • Unit - Add ToArms_DummyAbility to (Last created unit)
                          • Unit - Set level of ToArms_DummyAbility for (Last created unit) to ToArms_AbilityLevel[ToArms_Index]
                          • Unit - Order (Last created unit) to Human Sorceress - Slow ToArms_TempTarget[ToArms_DummyIndex]
                          • Unit - Cause ToArms_TempUnit to damage ToArms_TempTarget[ToArms_DummyIndex], dealing ToArms_Damage[ToArms_AbilityLevel[ToArms_Index]] damage of attack type ToArms_AttackType and damage type ToArms_DamageType
                          • -------- ---- --------
                          • Set ToArms_TempTarget[ToArms_DummyIndex] = No unit
                  • -------- ---- --------
                  • Set ToArms_MovetoLoc[ToArms_Index] = (ToArms_DummyLoc[ToArms_Index] offset by (ToArms_Speed[ToArms_AbilityLevel[ToArms_Index]] / 33.00) towards ToArms_Angle[ToArms_Index] degrees)
                  • -------- ---- --------
                  • Unit - Move ToArms_TempDummy[ToArms_Index] instantly to ToArms_MovetoLoc[ToArms_Index]
                  • -------- ---- --------
                  • Set ToArms_FinalDistance[ToArms_AbilityLevel[ToArms_Index]] = (ToArms_FinalDistance[ToArms_AbilityLevel[ToArms_Index]] - (ToArms_Speed[ToArms_AbilityLevel[ToArms_Index]] / 33.00))
                  • -------- ---- --------
                  • Special Effect - Create a special effect at ToArms_MovetoLoc[ToArms_Index] using ToArms_SFX
                  • Special Effect - Set Scale of (Last created special effect) to 0.25
                  • Special Effect - Destroy (Last created special effect)
                  • -------- ---- --------
                  • Custom script: call RemoveLocation(udg_ToArms_MovetoLoc[udg_ToArms_Index])
                  • Custom script: call RemoveLocation(udg_ToArms_DummyLoc[udg_ToArms_Index])
                  • Custom script: call DestroyGroup(udg_ToArms_TargetGroup[udg_ToArms_DummyIndex])
                • Else - Actions
                  • -------- ---- --------
                  • Unit Group - Pick every unit in ToArms_TempTargetGroup and do (Actions)
                    • Loop - Actions
                      • -------- ---- --------
                      • Set ToArms_TempTarget[ToArms_DummyIndex] = (Picked unit)
                      • -------- ---- --------
                      • Unit Group - Remove ToArms_TempTarget[ToArms_DummyIndex] from ToArms_TempTargetGroup
                  • -------- ---- --------
                  • Unit - Remove ToArms_TempDummy[ToArms_Index] from the game
                  • -------- ---- --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (ToArms_TargetGroup[ToArms_DummyIndex] is empty) Equal to True
                      • (ToArms_TempDummyGroup is empty) Equal to True
                    • Then - Actions
                      • Set ToArms_Integer = (ToArms_Integer - 1)
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ToArms_Integer Equal to 0
                        • Then - Actions
                          • Trigger - Turn off (This trigger)
                        • Else - Actions
                    • Else - Actions

I know this spell is not 100% work. What i want to do with this spell is :
  • Fully MUI of course.
  • Each enemy unit is only affected once per knight/dummy (damages, slow). So if there is 3 knights and a unit collides, the unit still can be affected by the rest(2) each.
  • The knights/dummies formation to be like an arrow when cast, ignoring how much they are(?) (I'll post the example pics and more questions later if you don't understand).
  • Dummies and the other data recycled correctly.
Simple word, it is like a Multiple Shockwaves (maybe).
Thank you for the attention.

EDIT : Ah, is this the correct forum? i'm a bit confused to post this in here or maybe The Lab instead.
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,010
No, The Lab is more for proof-of-concept ideas/fiddling around. This is the right forum.

I'm unsure of the shape you're trying to make. Is it a line of knights like this: — or a v/arrow shape like this /\ or ^ ? Right now it makes them in a circle as far as I can tell. For that matter is there any reason you can't just make a shockwave spell that uses the knight model as its SFX? I guess the slow on hit units.
 
Level 5
Joined
Dec 25, 2014
Messages
111
No, The Lab is more for proof-of-concept ideas/fiddling around. This is the right forum.

I'm unsure of the shape you're trying to make. Is it a line of knights like this: — or a v/arrow shape like this /\ or ^ ? Right now it makes them in a circle as far as I can tell. For that matter is there any reason you can't just make a shockwave spell that uses the knight model as its SFX? I guess the slow on hit units.
Yeah, i made it in a circle for now because i have no idea how to make an arrow shape, also it could be both /\ and ^ maybe, depends on how much the dummy created.

And sorry, i forgot to mention. I'm using the EDITED model of knight/bandit lord model so they only has 'walk' animation. (It is okay?)
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,197
Here are some ideas how to solve the problem.

To construct and update the formation a formation offset list might be a good idea. This is a list of relative offsets for each member in the formation. These offsets are rotated and translated relative to the caster to get the actual map points for each member of the formation. The list is created once at map initialization and could potentially be hand calculated. Length of the list must be the maximum formation size.

There are 2 data classes involved to make such an ability.
  • Movers: These are given to the dummies so that they move in formation with the caster. This needs to contain a reference to the unit, the formation offset index that the dummy is using and a reference to the caster unit to follow.
  • Damage Sources: These are given to both caster and dummy units so that they deal damage. This needs to contain a reference to the unit, a unit group to hold already damaged units, a reference to the caster unit which deals the damage and other ability specific stats such as the amount of damage to deal or area of effect.
The mover update logic is pretty simple. For every mover entry, get the relative formation offset, rotate it with respect to caster facing angle and then translate it by the caster unit position. The unit is then moved to that position.

The damage logic is slightly more complicated. All units are picked around the damage source within area of effect + maximum collision size. This group is then filtered, ignoring all units that have already been damaged by this unit, which fail allowed target tests and which are not within collision radius from the damage source position. The last step is needed for correct collision radius detection. All units that pass receive damage from the caster unit and get added to the already damaged unit group.

On expiry all movers and damage sources are destroyed, with the dummy units being removed (or placed to be recycled).
 
Status
Not open for further replies.
Top