HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[Halp!] Simple Jump Trigger

10-31-2008, 04:09 AM#1
Kyrbi0
Alright, I've done my reSearch on the forums, and while lots of people mention it, and put many variations of it, I cannot seem to find the "original".



I am thinking about having a "Jumping" unit for one of my custom races (undisclosed). It will primarily be a Movement and/or Combat-oriented skill; not necessarily dodging attacks or anything.

I would like this spell to be GUI, MUI, MPI, and (ideally) leakless. *awaits the inevitable "learn JASS" rant*. If this is not possible (esp. the leakless bit), I'd like to know in advance; I'm working on an alternative to the Jumping.

All I know so far, is that one has to (with triggers) add the "Crow Form" ability and remove it; then that unit can have it's "flying height" set to simulate flight. However, "move instantly" wouldn't work, and also there's the problems of gradual rise/fall and how having two locations will leak**...


Oh yeah, and this is supposed to be a an Jump ability activated off of a spell; like Blink or Channel. So you click the ability, click on a point (Point-Target), and the unit jumps there. Having all selected units of that type also Jump would be cool, but not necessary if difficult.

Thanks in advance. Hopefully this isn't too constraining of a re-query. :P

--NON-EDIT--
Oh wait, I (finally) found this... This thread speaks of a GUI jump, but it wasn't MUI or anything. Is there a way to clean this up, using only GUI + Custom Script? Also, the use of Custom Values is fine and encouraged; as long as you only mess with the CV "locally" (like, no "unit casts spell, target unit of spell gets CV = 1")

--EDIT--
** = wait, I just thought of this... Can you use the custom script "RemoveLocation" in the middle of a trigger? Because then feasibly, one could take the "jump origin point", use + remove it, then get the "jump target point", use + remove it.
... Or not?...
10-31-2008, 04:46 AM#2
Limb_Smasher
Ah ok, so were you going to try to base your jump ability off the map you posted?

If so, there is definitely an easy way to clean it up.
Arrays.


Turn CastingUnit into an array 11 (0 counts as an array) to satisfy 12 players.
then you can trim a lot of this junk down.

Trigger:
Ability
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Leaping Strike
Collapse Actions
If ((Owner of (Casting unit)) Equal to Player 1 (Red)) then do (Set CastingUnit1 = (Casting unit)) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 2 (Blue)) then do (Set CastingUnit2 = (Casting unit)) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 3 (Teal)) then do (Set CastingUnit3 = (Casting unit)) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 4 (Purple)) then do (Set CastingUnit4 = (Casting unit)) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 5 (Yellow)) then do (Set CastingUnit5 = (Casting unit)) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 6 (Orange)) then do (Set CastingUnit6 = (Casting unit)) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 7 (Green)) then do (Set CastingUnit7 = (Casting unit)) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 8 (Pink)) then do (Set CastingUnit8 = (Casting unit)) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 9 (Gray)) then do (Set CastingUnit9 = (Casting unit)) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 10 (Light Blue)) then do (Set CastingUnit10 = (Casting unit)) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 11 (Dark Green)) then do (Set CastingUnit11 = (Casting unit)) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 12 (Brown)) then do (Set CastingUnit12 = (Casting unit)) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 1 (Red)) then do (Set IntegerToMoveCastingUnit1 = (Integer((Distance between (Position of (Casting unit)) and (Target point of ability being cast))))) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 2 (Blue)) then do (Set IntegerToMoveCastingUnit2 = (Integer((Distance between (Position of (Casting unit)) and (Target point of ability being cast))))) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 3 (Teal)) then do (Set IntegerToMoveCastingUnit3 = (Integer((Distance between (Position of (Casting unit)) and (Target point of ability being cast))))) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 4 (Purple)) then do (Set IntegerToMoveCastingUnit4 = (Integer((Distance between (Position of (Casting unit)) and (Target point of ability being cast))))) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 5 (Yellow)) then do (Set IntegerToMoveCastingUnit5 = (Integer((Distance between (Position of (Casting unit)) and (Target point of ability being cast))))) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 6 (Orange)) then do (Set IntegerToMoveCastingUnit6 = (Integer((Distance between (Position of (Casting unit)) and (Target point of ability being cast))))) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 7 (Green)) then do (Set IntegerToMoveCastingUnit7 = (Integer((Distance between (Position of (Casting unit)) and (Target point of ability being cast))))) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 8 (Pink)) then do (Set IntegerToMoveCastingUnit8 = (Integer((Distance between (Position of (Casting unit)) and (Target point of ability being cast))))) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 9 (Gray)) then do (Set IntegerToMoveCastingUnit9 = (Integer((Distance between (Position of (Casting unit)) and (Target point of ability being cast))))) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 10 (Light Blue)) then do (Set IntegerToMoveCastingUnit10 = (Integer((Distance between (Position of (Casting unit)) and (Target point of ability being cast))))) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 11 (Dark Green)) then do (Set IntegerToMoveCastingUnit11 = (Integer((Distance between (Position of (Casting unit)) and (Target point of ability being cast))))) else do (Do nothing)
If ((Owner of (Casting unit)) Equal to Player 12 (Brown)) then do (Set IntegerToMoveCastingUnit12 = (Integer((Distance between (Position of (Casting unit)) and (Target point of ability being cast))))) else do (Do nothing)


you can get something like:

Trigger:
Ability Copy
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Leaping Strike
Collapse Actions
Collapse Player Group - Pick every player in (All players) and do (Actions)
Collapse Loop - Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Owner of (Casting unit)) Equal to (Picked player)
Collapse Then - Actions
Set CastingUnit[((Player number of (Picked player)) - 1)] = (Casting unit)
Set IntegerToMoveCastingUnit1[((Player number of (Picked player)) - 1)] = (Integer((Distance between (Position of (Casting unit)) and (Position of (Target unit of ability being cast)))))
Collapse Else - Actions
Do nothing

That's just basing off what the author did.
So with arrays you can take the 14 triggers down to only 3.
Does that help?
10-31-2008, 04:48 AM#3
Kyrbi0
Probably. I haven't actually gotten a chance to download and check out that test map... But hopefully tomorrow. I'll assume you're right, though, for now. :P
10-31-2008, 06:05 AM#4
Jazradel
Oh I totally have a submission for this. Unfortunately, my profile page seems to be broken I can't get to it.

Edit: found it. http://www.wc3campaigns.net/showthread.php?t=81446
Download the map and have a look at the example, it's done in the GUI and is very easy.
10-31-2008, 01:18 PM#5
Kyrbi0
Quote:
Originally Posted by Jazradel
it's done in the GUI
... The page you linked talks completely about JASS and vJASS...

But I'll DL it anyway and see if you're not crazy. :P
11-04-2008, 07:18 PM#6
Raydude
Event - When a unit starts casting an ability
Condition - Ability = w/e
Action -Set CastingUnit[(Integer((Real((String((Player number of (Triggering player))))))))] = (Triggering unit)

Use this one instead to set your variable....so u dont have to copy and paste 12x for 12 players (red = 1, and there's 16 players in a game in total, set variable array 12 if only REAL playing players are using the spell) same goes for setting distance...you don't need to do that 12x, once is enough