• 🏆 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] A certain hookshot spell

Status
Not open for further replies.
Level 3
Joined
May 12, 2016
Messages
51
Hello! Hoping to get some help on this one. So, here are my two concerns for this spell I made...which will be included in a spellset I'll upload here eventually.

[trigger="Bandage Toss Cast"]
Bandage Toss Cast
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to AbilityIndex[0]
Actions
-------- Indexing --------
Set IndexMax[0] = (IndexMax[0] + 1)
For each (Integer Index[0]) from 0 to (IndexMax[0] - 1), do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
IndexOccupied[Index[0]] Equal to False
Then - Actions
-------- Instance Index Activate --------
Set IndexOccupied[Index[0]] = True
-------- Variable Setup --------
Set Caster[Index[0]] = (Triggering unit)
Set SourcePoint[Index[0]] = (Position of Caster[Index[0]])
Set TargetPoint[Index[0]] = (Target point of ability being cast)
Set DummyPoint[Index[0]] = (SourcePoint[Index[0]] offset by Speed[0] towards (Angle from SourcePoint[Index[0]] to TargetPoint[Index[0]]) degrees)
Set Distance[Index[0]] = (Distance[Index[0]] + Speed[0])
-------- Lasso Create --------
Lightning - Create a Drain Life lightning effect from source SourcePoint[Index[0]] to target DummyPoint[Index[0]]
Set Lightning[Index[0]] = (Last created lightning effect)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(BT Cast Loop <gen> is on) Not equal to True
Then - Actions
Trigger - Turn on BT Cast Loop <gen>
Else - Actions
Skip remaining actions
Else - Actions
[/trigger]

[trigger="BT Loop (initially off)"]
BT Cast Loop
Events
Time - Every 0.01 seconds of game time
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
IndexMax[0] Greater than 0
Then - Actions
For each (Integer Index[0]) from 0 to (IndexMax[0] - 1), do (Actions)
Loop - Actions
Unit - Pause Caster[Index[0]]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Target[Index[0]] Equal to No unit
Then - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Distance[Index[0]] Less than MaxDistance[0]
Then - Actions
Set CasterPoint[Index[0]] = (Position of Caster[Index[0]])
Set DummyPoint[Index[0]] = (DummyPoint[Index[0]] offset by Speed[0] towards (Angle from SourcePoint[Index[0]] to TargetPoint[Index[0]]) degrees)
Set Group[Index[0]] = (Units within 50.00 of DummyPoint[Index[0]] matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) belongs to an ally of (Owner of Caster[Index[0]])) Equal to False) and ((((Matching unit) is alive) Equal to True) and ((Matching
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in Group[Index[0]]) Greater than 0
Then - Actions
Set Target[Index[0]] = (Random unit from Group[Index[0]])
Set TargetPoint[Index[0]] = (Position of Target[Index[0]])
-------- Stun --------
Unit - Create 1 Dummy for (Owner of Caster[Index[0]]) at DummyPoint[Index[0]] facing TargetPoint[Index[0]]
Set Dummy[Index[0]] = (Last created unit)
Unit - Add DummyAbi[0] to Dummy[Index[0]]
Unit - Set level of DummyAbi[0] for Dummy[Index[0]] to (Level of AbilityIndex[0] for Caster[Index[0]])
Unit - Order Dummy[Index[0]] to Human Mountain King - Storm Bolt Target[Index[0]]
Unit - Remove Dummy[Index[0]] from the game
Unit - Turn collision for Caster[Index[0]] Off
-------- Cleaning --------
Set Dummy[Index[0]] = No unit
Custom script: call RemoveLocation(udg_CasterPoint[udg_Index[0]])
Else - Actions
Lightning - Move Lightning[Index[0]] to source CasterPoint[Index[0]] and target DummyPoint[Index[0]]
Set Distance[Index[0]] = (Distance[Index[0]] + Speed[0])
Custom script: call RemoveLocation(udg_CasterPoint[udg_Index[0]])
Custom script: call DestroyGroup(udg_Group[udg_Index[0]])
Else - Actions
-------- De-indexing --------
Set IndexOccupied[Index[0]] = False
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
IndexMax[0] Greater than 0
Index[0] Equal to (IndexMax[0] - 1)
Then - Actions
Set IndexMax[0] = (IndexMax[0] - 1)
Else - Actions
-------- Cleaning --------
Lightning - Destroy Lightning[Index[0]]
Unit - Unpause Caster[Index[0]]
Set Distance[Index[0]] = 0.00
Set Caster[Index[0]] = No unit
Custom script: call RemoveLocation(udg_SourcePoint[udg_Index[0]])
Custom script: call RemoveLocation(udg_DummyPoint[udg_Index[0]])
Custom script: call RemoveLocation(udg_TargetPoint[udg_Index[0]])
Custom script: call RemoveLocation(udg_CasterPoint[udg_Index[0]])
Else - Actions
Set SourcePoint[Index[0]] = (Position of Caster[Index[0]])
Set TargetPoint[Index[0]] = (Position of Target[Index[0]])
Set Distance[Index[0]] = (Distance between SourcePoint[Index[0]] and TargetPoint[Index[0]])
Quest - Display to (All players) the Hint message: (Dist: + (String(Distance[Index[0]])))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Distance[Index[0]] Greater than or equal to 125.00
Then - Actions
-------- Reel --------
Set DummyPoint[Index[0]] = (SourcePoint[Index[0]] offset by Speed[0] towards (Angle from SourcePoint[Index[0]] to TargetPoint[Index[0]]) degrees)
Unit - Move Caster[Index[0]] instantly to DummyPoint[Index[0]], facing TargetPoint[Index[0]]
Lightning - Move Lightning[Index[0]] to source DummyPoint[Index[0]] and target TargetPoint[Index[0]]
Else - Actions
-------- De-indexing --------
Set IndexOccupied[Index[0]] = False
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
And - All (Conditions) are true
Conditions
IndexMax[0] Greater than 0
Index[0] Equal to (IndexMax[0] - 1)
Then - Actions
Set IndexMax[0] = (IndexMax[0] - 1)
Else - Actions
-------- Cleaning --------
Lightning - Destroy Lightning[Index[0]]
Unit - Unpause Caster[Index[0]]
Unit - Turn collision for Caster[Index[0]] On
Set Target[Index[0]] = No unit
Set Caster[Index[0]] = No unit
Set Distance[Index[0]] = 0.00
Custom script: call RemoveLocation(udg_DummyPoint[udg_Index[0]])
Custom script: call RemoveLocation(udg_SourcePoint[udg_Index[0]])
Custom script: call RemoveLocation(udg_TargetPoint[udg_Index[0]])
Else - Actions
Trigger - Turn off (This trigger)

[/trigger]


Details
This spell's a Hookshot spell, that channels a lasso with a configurable speed and maximum distance before getting destroyed. When it finds a target before its destruction, it casts its secondary effect (variable DummyAbi[Index[0]]) to it, clings, and reels the caster to the target's position.

Notes:
- First time I used dynamic indexing for a spell.


My questions for this one are...:
1. On a scale of 1 to 10, 10 as the clearest, how comprehensible are my triggers?
2. It's working well enough, but do you think this is properly executed and cleaned? Why or why not?

Answers and suggestions will be much appreciated. Thank you. :grin:
 
Last edited:
Level 37
Joined
Jul 22, 2015
Messages
3,485
If you want your spell to be reviewed, just upload it into the spell section. Anyway, to answer your questions:
  1. I give it a 6. You should add more comments about what your If/Then/Else check for.
  2. You do a lot of strange things like starting at 0 with a GUI loop and decrementing the index in the for loop statement "from 0 to (IndexMax[0] - 1". The indexing system is also strange, do you mind linking where you learned it from? I would list more things, but that's what the spell section is for :3
 
Level 3
Joined
May 12, 2016
Messages
51
If you want your spell to be reviewed, just upload it into the spell section. Anyway, to answer your questions:
  1. I give it a 6. You should add more comments about what your If/Then/Else check for.
  2. You do a lot of strange things like starting at 0 with a GUI loop and decrementing the index in the for loop statement "from 0 to (IndexMax[0] - 1". The indexing system is also strange, do you mind linking where you learned it from? I would list more things, but that's what the spell section is for :3

Thanks for the answers~!
I uploaded it here because I want to get minor feedback, especially formatting-related, to be used for the rest of spells as well before uploading the full spellset. Anyways,
  1. Noted. Thank you for the suggestion~ :)
  2. After getting the basics from reading this, I'm still getting the hang of it. I'll be changing this a bit, heh.
 
Last edited:
Status
Not open for further replies.
Top