- Joined
- Oct 19, 2007
- Messages
- 51
In my virus infection map I have a class of unit that is a Worm, consisting of a worm head hero, and segments which follow it (technically they are repeatedly given this order to decrease the follow distance). The system works by finding all units owned by a given player, starts with the custom value of 1, and works it's way up to x, which is a position in a global array that contains the number of segments that a worm player has. Currently the system is only MPI(use of player number and all units owned by a player, and arrays based on said data), but I would like this ability to work for when I devise a way of making it mui...(maybe impossible until then...)
At any rate, this ability is a war stomp that the worm hero casts. Then each segment proceeds to cast the stomp rippling backwards to the end of the tail, at which point the worm head is moved to the position of the tail, and all of the segments turn around.
At present I have a very messy GUI trigger doing his, which does little of what I really intend for it to do, but it was made hastily just so I could get something implemented. I haven't looked at it, and before I post it I'm going to spend the next few minutes looking at it now (which will not take any of your time, just look down 3 lines for my explanation and posting of it.)
After having looked at it, the custom value of the worm head is actually, as I recall, the number of segments following it. Here it is(just as messy as I remember):
worm_group is a unit array containing the worm heads of each player (some of which don't even necessarily have worms). What the trigger does in this first unit group is set up an array that begins at the head and proceeds towards the tail in order. Then it gives each unit the ability to, and orders it to stomp, removes the ability, and so on, backwards through the worm. The final if statement checks to see if the current segment is the last one (in the global array worm_end), in which case it changes the custom values of all the segments to reflect the change in direction, and sets the proper segment to be the new end piece.
Like I said, it's messy, but it works, to an extent. I'd like to go about converting it to jass, but I don't even have to try to know that converting it to custom text will be messy. More so than with most triggers. I'd also like to make it as ready as possible for the introduction of MUI-ability, but I really don't think that will be possible until I come up with the new way of handling the system. If only I could just make a worm "class". That would be incredibly useful. But this isn't cpp (or any other object oriented language, for that matter) so I'll just move on with life. (Though I have heard something of structs in jass, which would be incredibly useful in making a new system...)
Point is, I'd ideally like to freeze the hero, and have about a .1 sec delay between stomps (using a timer) and move the head along with the ripple so the inversion is less sudden. I'm going to make an attempt at jassifying this version of the trigger without going mad and removing what I'm estimating to be...2 or 3 leaks. Any help would be appreciated!
At any rate, this ability is a war stomp that the worm hero casts. Then each segment proceeds to cast the stomp rippling backwards to the end of the tail, at which point the worm head is moved to the position of the tail, and all of the segments turn around.
At present I have a very messy GUI trigger doing his, which does little of what I really intend for it to do, but it was made hastily just so I could get something implemented. I haven't looked at it, and before I post it I'm going to spend the next few minutes looking at it now (which will not take any of your time, just look down 3 lines for my explanation and posting of it.)
After having looked at it, the custom value of the worm head is actually, as I recall, the number of segments following it. Here it is(just as messy as I remember):
-
worm SNES Shuffle
-
Events
-
Unit - A unit Finishes casting an ability
-
-
Conditions
-
(Ability being cast) Equal to SNES Shuffle (Worm)
-
-
Actions
-
Set worm_temp[0] = worm_group[(Player number of (Owner of (Triggering unit)))]
-
Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit))) and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Unit-type of (Picked unit)) Equal to Segment
-
-
Then - Actions
-
Set worm_temp[(Custom value of (Picked unit))] = (Picked unit)
-
-
Else - Actions
-
-
-
-
For each (Integer A) from 1 to (Custom value of worm_temp[0]), do (Actions)
-
Loop - Actions
-
Unit - Add SNES Shuffle (Segments) to worm_temp[(Integer A)]
-
Unit - Set level of SNES Shuffle (Segments) for worm_temp[(Integer A)] to (Level of (Ability being cast) for (Triggering unit))
-
Unit - Order worm_temp[(Integer A)] to Orc Tauren Chieftain - War Stomp
-
Unit - Remove SNES Shuffle (Segments) from worm_temp[(Integer A)]
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
worm_temp[(Integer A)] Equal to worm_end[(Player number of (Owner of (Triggering unit)))]
-
-
Then - Actions
-
For each (Integer B) from 0 to ((Custom value of worm_temp[0]) - 1), do (Actions)
-
Loop - Actions
-
Unit - Set the custom value of worm_temp[(Integer B)] to ((Custom value of worm_temp[0]) - (Integer B))
-
-
-
Unit - Move (Triggering unit) instantly to (Position of worm_end[(Player number of (Owner of (Triggering unit)))])
-
Set worm_end[(Player number of (Owner of (Triggering unit)))] = worm_temp[(Custom value of worm_group[(Player number of (Owner of (Triggering unit)))])]
-
-
Else - Actions
-
Do nothing
-
-
-
-
-
-
Like I said, it's messy, but it works, to an extent. I'd like to go about converting it to jass, but I don't even have to try to know that converting it to custom text will be messy. More so than with most triggers. I'd also like to make it as ready as possible for the introduction of MUI-ability, but I really don't think that will be possible until I come up with the new way of handling the system. If only I could just make a worm "class". That would be incredibly useful. But this isn't cpp (or any other object oriented language, for that matter) so I'll just move on with life. (Though I have heard something of structs in jass, which would be incredibly useful in making a new system...)
Point is, I'd ideally like to freeze the hero, and have about a .1 sec delay between stomps (using a timer) and move the head along with the ripple so the inversion is less sudden. I'm going to make an attempt at jassifying this version of the trigger without going mad and removing what I'm estimating to be...2 or 3 leaks. Any help would be appreciated!
Last edited: