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

[General] Pitch Angle ...Trigger ???

Status
Not open for further replies.
Level 20
Joined
Jul 14, 2011
Messages
3,213
Wc3 doesn't prove Access in any way to Units Pitch Angle through triggers :/ Only thing you can do is change the unit model for another one when you're looking to the left, and for another one if you look right.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Player X press Left Arrow
Unit - Replace PlayerUnit[PlayerNumber of Triggering Player] model with xxxxx

Player X press Right Arrow
Unit - Replace PlayerUnit[PlayerNumber of Triggering Player] model with zzzz
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Ooooooo . I forgot about that trigger . Ehehe There is still one problem ... This trigger will replace a before-created unit by a new one from the unit palette . But What's the trigger that can replace two units from the terrain so unit 1 goes to unit 2's point , And unit 2 goes to unit 1's point ? Without loosing their variables , '_Hero1_2D' (unit 1) . and '_Hero2_2D' (unit 2) ?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
No, it doesn't create a new unit, it just replaces the model (I think)

Anyway, it's easy to loop the item transfer and ability level transfer
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
hmmm look at this why does this not work?
  • MovementRightOn
    • Events
      • Player - Player 1 (Red) Presses the Right Arrow key
      • Player - Player 2 (Blue) Presses the Right Arrow key
      • Player - Player 3 (Teal) Presses the Right Arrow key
      • Player - Player 4 (Purple) Presses the Right Arrow key
    • Conditions
    • Actions
      • -------- Turns on right movement for player: --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • _Hero2_Hidden_2D[(Player number of (Triggering player))] Equal to False
        • Then - Actions
          • Unit Group - Pick every unit in _Hero_NoPlayableGroup_2D[(Player number of (Triggering player))] and do (Actions)
            • Loop - Actions
              • Set _Hero2_UnitType_2D[(Player number of (Triggering player))] = (Unit-type of (Picked unit))
          • Unit Group - Pick every unit in _Hero_PlayableGroup_2D[(Player number of (Triggering player))] and do (Actions)
            • Loop - Actions
              • Set _Hero1_UnitType_2D[(Player number of (Triggering player))] = (Unit-type of (Picked unit))
              • Unit - Replace (Picked unit) with a (Unit-type of (Random unit from _Hero_NoPlayableGroup_2D[(Player number of (Triggering player))])) using The new unit's default life and mana
              • Set _Hero_2D[(Player number of (Triggering player))] = (Picked unit)
              • Set _Hero1_UnitType_2D[(Player number of (Triggering player))] = (Unit-type of (Picked unit))
              • Unit - Make _Hero_2D[(Player number of (Triggering player))] face 0.00 over 0.00 seconds
          • Unit Group - Pick every unit in _Hero_NoPlayableGroup_2D[(Player number of (Triggering player))] and do (Actions)
            • Loop - Actions
              • Unit - Replace (Picked unit) with a (Unit-type of (Random unit from _Hero_PlayableGroup_2D[(Player number of (Triggering player))])) using The new unit's default life and mana
              • Set _Hero2_2D[(Player number of (Triggering player))] = (Picked unit)
              • Set _Hero2_UnitType_2D[(Player number of (Triggering player))] = (Unit-type of (Picked unit))
              • Unit - Make _Hero_2D[(Player number of (Triggering player))] face 0.00 over 0.00 seconds
          • Set _Hero2_Hidden_2D[(Player number of (Triggering player))] = True
        • Else - Actions
      • Set _MovingRight_2D[(Player number of (Triggering player))] = True
  • MovementLeftOn
    • Events
      • Player - Player 1 (Red) Presses the Left Arrow key
      • Player - Player 2 (Blue) Presses the Left Arrow key
      • Player - Player 3 (Teal) Presses the Left Arrow key
      • Player - Player 4 (Purple) Presses the Left Arrow key
    • Conditions
    • Actions
      • -------- Turns on left movement for player: --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • _Hero2_Hidden_2D[(Player number of (Triggering player))] Equal to True
        • Then - Actions
          • Unit Group - Pick every unit in _Hero_NoPlayableGroup_2D[(Player number of (Triggering player))] and do (Actions)
            • Loop - Actions
              • Set _Hero2_UnitType_2D[(Player number of (Triggering player))] = (Unit-type of (Picked unit))
          • Unit Group - Pick every unit in _Hero_PlayableGroup_2D[(Player number of (Triggering player))] and do (Actions)
            • Loop - Actions
              • Set _Hero1_UnitType_2D[(Player number of (Triggering player))] = (Unit-type of (Picked unit))
              • Unit - Replace (Picked unit) with a (Unit-type of (Random unit from _Hero_NoPlayableGroup_2D[(Player number of (Triggering player))])) using The new unit's default life and mana
              • Set _Hero_2D[(Player number of (Triggering player))] = (Picked unit)
              • Set _Hero1_UnitType_2D[(Player number of (Triggering player))] = (Unit-type of (Picked unit))
              • Unit - Make _Hero_2D[(Player number of (Triggering player))] face 180.00 over 0.00 seconds
          • Unit Group - Pick every unit in _Hero_NoPlayableGroup_2D[(Player number of (Triggering player))] and do (Actions)
            • Loop - Actions
              • Unit - Replace (Picked unit) with a (Unit-type of (Random unit from _Hero_PlayableGroup_2D[(Player number of (Triggering player))])) using The new unit's default life and mana
              • Set _Hero2_2D[(Player number of (Triggering player))] = (Picked unit)
              • Set _Hero2_UnitType_2D[(Player number of (Triggering player))] = (Unit-type of (Picked unit))
              • Unit - Make _Hero2_2D[(Player number of (Triggering player))] face 0.00 over 0.00 seconds
          • Set _Hero2_Hidden_2D[(Player number of (Triggering player))] = False
        • Else - Actions
      • Set _MovingLeft_2D[(Player number of (Triggering player))] = True
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Wait... players have more than 1 unit? These triggers seem TOO complicated for a single unit manipulation.

What are thos Unit Groups for?

You should index your units with:
Hero[Player Number]

and then just make

Unit - Replace Hero[PlayerNumber] with Model XXX

It's a single action bro... No need for all Unit Groups and stuff.
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Why doesn't this wooooooork ? By the way I'm using 2D Engine :(:(:( , I was searching for soldiers' movement triggers every where but i didn't find em :(:(:(:(:(:(
  • MovementRightOn
    • Events
      • Player - Player 1 (Red) Presses the Right Arrow key
      • Player - Player 2 (Blue) Presses the Right Arrow key
      • Player - Player 3 (Teal) Presses the Right Arrow key
      • Player - Player 4 (Purple) Presses the Right Arrow key
    • Conditions
    • Actions
      • -------- Turns on right movement for player: --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • _Hero2_Hidden_2D[(Player number of (Triggering player))] Equal to False
        • Then - Actions
          • Unit - Replace _Hero_2D[(Player number of (Triggering player))] with a (Unit-type(((String((Unit-type((Substring((String((Unit-type of _Hero_2D[(Player number of (Triggering player))]))), 1, ((Length of (String((Unit-type of _Hero_2D[(Player number of (Triggering player))])))) - 3))))))) + [R]))) using The new unit's default life and mana
          • Unit - Make (Last replaced unit) face 360.00 over 0.00 seconds
          • Set _Hero2_Hidden_2D[(Player number of (Triggering player))] = True
        • Else - Actions
      • Set _MovingRight_2D[(Player number of (Triggering player))] = True
  • MovementLeftOn
    • Events
      • Player - Player 1 (Red) Presses the Left Arrow key
      • Player - Player 2 (Blue) Presses the Left Arrow key
      • Player - Player 3 (Teal) Presses the Left Arrow key
      • Player - Player 4 (Purple) Presses the Left Arrow key
    • Conditions
    • Actions
      • -------- Turns on left movement for player: --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • _Hero2_Hidden_2D[(Player number of (Triggering player))] Equal to True
        • Then - Actions
          • Unit - Replace _Hero_2D[(Player number of (Triggering player))] with a (Unit-type(((String((Unit-type((Substring((String((Unit-type of _Hero_2D[(Player number of (Triggering player))]))), 1, ((Length of (String((Unit-type of _Hero_2D[(Player number of (Triggering player))])))) - 3))))))) + [L]))) using The new unit's default life and mana
          • Unit - Make (Last replaced unit) face 180.00 over 0.00 seconds
          • Set _Hero2_Hidden_2D[(Player number of (Triggering player))] = False
        • Else - Actions
      • Set _MovingLeft_2D[(Player number of (Triggering player))] = True
2nd : I wanna know an additional thing ... How can I use variables in events ?
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
  • Unit - Replace _Hero_2D[(Player number of (Triggering player))] with a (Unit-type(((String((Unit-type((Substring((String((Unit-type of _Hero_2D[(Player number of (Triggering player))]))), 1, ((Length of (String((Unit-type of _Hero_2D[(Player number of (Triggering player))])))) - 3))))))) + [R]))) using The new unit's default life and mana
Wtf?! I can't even think for a reason to do it in such way....

  • Unit - Replace _Hero_2D[(Player number of (Triggering player))] with a Unit (left facing) unit type
  • Unit - Replace _Hero_2D[(Player number of (Triggering player))] with a Unit (right facing) unit type
This should more more than enough.

Touse variables in events you have to use JASS
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Well There is more than one character . If Every player uses mario as a hero ... Then It would be enough . To replace mario left by mario right .But each player has his own chosen hero . For example player 1 = mario , player 2 luigi , player 3 = toad , player 4 = wario . Well That's hard. I don't know why this trigger doesn't work in 2D Engine , that's after replacing . Well the hero doesn't even become turned upside down or something . Well Is there a leak ?
  • Unit - Make _Hero_2D[_IntegerL_2D] face 180.00 over 0.00 seconds
.Well If you wanna know how i set the trigger of the tavern , so that's it , What's wrong ?
  • Unit Player Group Setup
    • Events
      • Unit - A unit enters Tavern <gen>
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Entering unit)) Equal to Player 1 (Red)
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Unit-type of (Entering unit)) Equal to Super Mario [R]
            • Then - Actions
              • Set TTMario = (Unit-type of (Entering unit))
              • Set TTMarioL = Super Mario [L]
            • Else - Actions
              • -------- Other Heroes' Unit Types' Variables' Setting --------
          • Unit - Create 1 (Unit-type of (Entering unit)) for Player 1 (Red) at (Center of Player 1 <gen>) facing 0.00 degrees
          • Set _Hero_2D[1] = (Last created unit)
          • Set _Hero_Point_2D[1] = (Position of _Hero_2D[1])
          • Camera - Pan camera for Player 1 (Red) to _Hero_Point_2D[1] over 0.00 seconds
          • Set _Hero2_Hidden_2D[1] = True
          • Trigger - Turn on Gravity <gen>
        • Else - Actions
          • -------- Well the other triggers are set for the other players --------
Well The Hero doesn't face anything It just moves facing the angle that it was before .
By The Way I'm extra noob in JASS . I don't wanna use it although i can understand its functions . but i don't use it . And i can't use it
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
EDIT: I hope you understand it.

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Creates the Hashtable --------
      • Custom script: set udg_Hash = InitHashtable()
      • -------- Set both facing units --------
      • Set UnitTypeRight = Footman
      • Set UnitTypeLeft = Knight
      • -------- Save RightFace on LeftFace and viceversa --------
      • Custom script: call SaveInteger(udg_Hash, udg_UnitTypeRight, 0, udg_UnitTypeLeft)
      • Custom script: call SaveInteger(udg_Hash, udg_UnitTypeLeft, 0, udg_UnitTypeRight)
      • -------- Just for testing purposes. This is the player unit --------
      • Set PlayerUnit[1] = Footman 0000 <gen>
  • Right Face
    • Events
      • Player - Player 1 (Red) Presses the Right Arrow key
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RightFace[IntegerVar] Equal to False
        • Then - Actions
          • -------- Just for optimization --------
          • Set IntegerVar = (Player number of (Triggering player))
          • -------- Take unit Facing --------
          • Set CurrentFacing = (Facing of PlayerUnit[IntegerVar])
          • -------- Load the Reverse Facing Unit Type, stored in 0 of Id of current unit. --------
          • Custom script: set udg_ReverseFaceUnitType = LoadInteger(udg_Hash, GetUnitTypeId(udg_PlayerUnit[udg_IntegerVar]), 0)
          • -------- Replace model --------
          • Unit - Replace PlayerUnit[IntegerVar] with a ReverseFaceUnitType using The old unit's relative life and mana
          • Set PlayerUnit[IntegerVar] = (Last replaced unit)
          • Selection - Select PlayerUnit[IntegerVar] for (Triggering player)
          • Custom script: call SetUnitFacing(udg_PlayerUnit[udg_IntegerVar], 0)
          • Set RightFace[IntegerVar] = True
        • Else - Actions
          • -------- Here goes the movement --------
  • Left Face
    • Events
      • Player - Player 1 (Red) Presses the Left Arrow key
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RightFace[IntegerVar] Equal to True
        • Then - Actions
          • -------- Just for optimization --------
          • Set IntegerVar = (Player number of (Triggering player))
          • -------- Take unit Facing --------
          • Set CurrentFacing = (Facing of PlayerUnit[IntegerVar])
          • -------- Load the Reverse Facing Unit Type, stored in 0 of Id of current unit. --------
          • Custom script: set udg_ReverseFaceUnitType = LoadInteger(udg_Hash, GetUnitTypeId(udg_PlayerUnit[udg_IntegerVar]), 0)
          • -------- Replace model --------
          • Unit - Replace PlayerUnit[IntegerVar] with a ReverseFaceUnitType using The old unit's relative life and mana
          • Set PlayerUnit[IntegerVar] = (Last replaced unit)
          • Selection - Select PlayerUnit[IntegerVar] for (Triggering player)
          • Custom script: call SetUnitFacing(udg_PlayerUnit[udg_IntegerVar], 180)
          • Set RightFace[IntegerVar] = False
        • Else - Actions
          • -------- Here goes the movement --------
There's no way to make units turn faster. This can be improved a lot with some Custom Scripts. I'll just made it this way to show you how easy it is (and it can be reaaally easier, faster, smoother, better, etc)
 

Attachments

  • FacingTest.w3x
    17.8 KB · Views: 40
Last edited:
Level 15
Joined
Oct 29, 2012
Messages
1,474
This should probably be MUI MPI , shouldn't it ?
EDIT : The triggers that you made are awesome . But the units doesn't face the angle that i want directly . It turns slowly .Well that's my problem . And the trigger that you made are without arrays . Is that normal to be MPI MUI?
And ... Where do I put the movement's triggers. Should I put 'em below 'Else- Actions' Or Below the trigger itself of 'If-Then-Else'?
And What is ViceVersa :D?
And How is 2D things made in Soldiers map ? This should be like this :
- In the map initialization the game creates two units . One Right facing in the playable region . And Creates another one ( left facing ) in a recycle region . So once some one presses right or left . They replace the one in the recycle region with the one in the playabler region .isn't it like that to make the turning faster cuz the right facing's and left facing's angle are set before so this should be a solution .
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
The trigger is MPI, but can be turned to MUI pretty easily.

The turn rate is as fast as it is at 3.0. You can try at 0 though if you want. You would have to remove the unit and recreate it to make it face directly.

It uses an array PlayerUnit[index]. That makes it MPI

The movement triggers are on the ELSE OR below the whole ITE block. Makes almost no difference. You should try wich one suits you better.

ViceVersa means "The same thing with swapped values"

"Save X on Y, and viceversa". In this case means "Save X on Y, and Y in X"
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
That's a good solution. I was creating a new unit every time just to show, but having 2 units with fixed facing looks fine to me. No need to move it to a region, you can just Hide it. You just need to transfer life, items and exp from one to the other. No need to re-create it as I said before.

ViceVersa means "The same thing with swapped values"
"Save X on Y, and viceversa". In this case means "Save X on Y, and Y in X"

Do you know how to modify my triggers to fit your way? (Unit swap instead of replace)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
At the moment of Swap:

X = Your curring Unit
Y = The unit with reverse facing you're switching to

  • Unit - Set Life of Y = Life of X
  • Unit - Set mana of Y = Mana of X
  • For each integer A from 1 to 6
    • Hero - Make X drop item in slot (Integer A)
    • Hero - Give Last Dropped Item to Y
  • Unit - Hide X
  • Set tempPoint = Position of X
  • Unit - Move Y Instantly to tempPoint
  • Custom script: call RemoveLocation(udg_tempPoint)
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
AAAAA . Well I don't Need to make a periodic trigger that moves unit Y to the position of unit X each 0.03 seconds , Do I ?. So I just create Unit Y after choosing a hero from tavern and I hide him well After pressing left I swap both units . That's pretty easy to understand . Well Thank you . And Then I exchange Y's var with X's Var well the hidden unit which was X becomes Y . And the Unhidden Y becomes X . Shouldn't it be like this ?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
When you press an arrow, i'm not sure if Wc3 constantly detects it being pressed. If it doesn't then yeah, you may probably have to loop the movement.
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
What do you mean by Yeah ? Do I need to create a periodic trigger? Well I don't know . 2D Engine uses a simuliar system of perdioc triggers ( Left - Right - Jump ) . They are just run once the booleans are true ( Of MovedRight = True [like this] ). Well that will be a long thread . Isn't there a chat system in hive ?
 
Last edited:
Level 15
Joined
Oct 29, 2012
Messages
1,474
Well I have one problem . For Example Entering Unit to Tavern <gen> is Arthas
. How Can I set a variable for Arthas
? That's for each player that picks a specific Hero Type . Because there are many heroes like Archer for example . :/ This is my only problem . I mean how can I create a left facing unit of the right facing unit of the entering unit ?:/:/:/:/
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
By taking the UnitType ID.

Check how I do it in the example.

xxxx is saved on zzzz, and zzzz is saved on xxxx. If the unit you have in the tavern is 'zzzz', retrieve the data on slot 0 from the GetUnitTypeId(GetSoldUnit()) in the hash, which is the same unit with opposite facing.
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Ahaha ?? Now Your triggers seem very usefull . My Hero was just moving vry great 2 or 3 times but after them it turns slowly .So I need to remove the PlayerUnit[IntegerVar] and then creates one with the opposite angle . But I don't know how to have done this with custom scripts using a hashtable . Can you tell me?
And the last post ,,,, I didn't understand anything :D
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
heheheh 3:) See the function arguments

GetUnitTypeId returns an INTEGER, a NUMBER (yeah, units are numbers). In hashtables you can save INTEGERS, so, you can save a unit Type.
Also specific units have their own Handle Id despite of the unit type Id, it's found using GetHandleId(unit).

In my triggers I saved the UNIT TYPE ID of X on Z, and of Z in X.

In this case, you don't need it to be this way. Lets asume you're selling the RIGHT facing unit, you need to store in the RIGHT FACING UnitTypeID the UnitTypeID of the LEFT facing unit.

How?

Check how I did in the triggers.

call SaveInteger(Hashtable, parentkey, childkey, integer)
Hashtable = The hashtable
parentkey = 'xxxx' (Asuming it's the RIGHTFACING UnitTypeId)
childkey = 0
integer = 'zzzz' (Asuming it's the LEFTFACING UnitTypeId)

* You can see the ID of everything in Warcraft by pressing Ctrl+D in the Object Editor. you'll see every element turns to be a 4 characters sequence like 'hfoo' (Human Footman) or 'Hpal' (Human Paladin)

Now just replace the values

call SaveInteger(udg_YourHashtableVariable, 'xxxx', 0, 'zzzz')

When your unit is selected from a tavern (RightFacing)
Set ThisUnit[PlayerNumber] = Sold Unit
Make ThisUnit look to 0 angle (East)

-- Now we retrieve the data from the Sold Unit Unit Type ID

Custom script: set udg_UnitId = GetUnitTypeId(GetSoldUnit()) (This is the 'xxxx')

-- Now we load 0 of the unit type id (which is where we saved the 'zzzz')

Custom script: set udg_OtherId = LoadInteger(udg_YourHashtableVariable, udg_UnitId, 0)

* Set this udg_OtherId not as an integer variable, but as a unittype variable.

-- Now you create the unit

Unit - Create 1 udg_OtherId anywhere facing 180 (West)
Set this unit = OtherUnit[PlayerNumber]

-- Now you have ThisUnit[PlayerNumber] (The one you're currently using) and OtherUnit[PlayerNumber[ which is the opposite. When you turn left, you swap the variable values: You set ThisUnit[PlayerNumber] = OtherUnit[PlayerUnit] and OtherUnit[PlayerUnit] = ThisUnit[PlayerNumber] (You need another variable to store the value of any of them just for the data transition, otherwise you would overwrite the variable values)

Good look with this ;) I can try to make it on the night.
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
I really understood although I don't know much about JASS codes . Look what i wrote to create a hashtable :
  • Custom script: call InitHashtableBJ( )
  • Custom script: set udg_MovementHashtable = GetLastCreatedHashtableBJ()
Do they work instead ?

* And How can I save an Unit Handle into another unit handle and viceversa ?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
-- Replace Custom script: call InitHashtableBJ( ) with
Custom script: set udg_YourHashtableVariable = InitHashtable()

--To save a unit handle into another unit handle

set udg_IntVariable1 = GetHandleId(Unit1)
set udg_IntVariable2 = GetHandleId(Unit2)

call SaveInteger(Hashtable, udg_IntVariable1, 0, udg_IntVariable2)
call SaveInteger(Hashtable, udg_IntVariable2, 0, udg_IntVariable1)
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Ok Thank you :D
Alright ... After Pressing Right ( the unit walks a bit) then i press left (the unit 'opposite') walks a bit too . Then The trigger starts working perfectly as I wanted . Hehehehe , Now How can I run its animation 'walk' ? Because I use a periodic loop for right-left-jump .... Hahahah That's the only thing that is missing .

Trink-Trank !!!
 
Last edited:
Level 15
Joined
Oct 29, 2012
Messages
1,474
Ye That's the problem... The trigger uses 0.05 second as a periodic event . But the animation has a longer length about 1.333 seconds :/ . Aaaaah . I create another loop trigger for every 1.3333 seconds then I play its animation . (solved)
But what do you advice to remove the first moves' leaks ? I mean the unit should move weirdly twice or 3 times . Then it starts moving normally .
2nd - How can I make when some one sells an unit from tavern , the opposite unit of sold unit is created and hidden .For example : Some one chooses mario , so mario left should be created , but when he chooses luigi , luigi left is created . That's pretty hard .
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Does the animation replay if you re-order the animation? I tough that the animation wouldn't be interrupted if you're ordering the same that is already being played.

And no, it's not hard. That's done with the Hashtable and the GetUnitTypeId. I've already explained before. Save the left-facing unittype on the right-faced unit type. Sell the right faced unit type, and retrieve the data from it to create the left-faced.
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Well How can I make the world editor recognize the left-facing unit-type of the right-facing one? Well That's the problem ..I can't save an UT (unit-type) into another one if it isn't even recognized . Because there are more than 1 UT , There are 12 right-facing UT . And 12 left-facing UT . Should I save one into other in Map initialization ? Or should I do so when choosing from tavern (that's the hard one)?
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Who says it's not recognized? You already know which one is. The unit type ID can be seen by pressing CTRL+D in the object editor. Just type those characters in single quotes ( ' ) as 'hfoo' (human footman) as an integer in the hashtable.
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
....
--To save a unit handle into another unit handle

set udg_IntVariable1 = GetHandleId(LeftFacing)
set udg_IntVariable2 = GetHandleId(RightFacing)

call SaveInteger(Hashtable, udg_IntVariable1, 0, udg_IntVariable2)
call SaveInteger(Hashtable, udg_IntVariable2, 0, udg_IntVariable1)
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
You won't understand what I wanna because it's really hard to explain ... We have many unit types ... How would I save right facing one into left facing while that left facing isn't even used ? Well I must use your way in the Map initialization ...Well when i want to use the left facing one of the right facing ... how can I do this ? ( already saved one into another and variables are set now how to use the left facing )
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Ok, i'll start working with JASS. I hate GUI.

There it is. It's heavily commented. You should be able to understand what everything does if you pay attention to function names, arguments, and comments.

It still doesn't includes the movement and animation, just the unit replacement.

It's a lot more efficient, faster, smoother, cleaner, clearer, better, than the GUI script.

You should AT LEAST be able to understand what i've already said about 8 times: How to save a unit handle into another unit handle.
 

Attachments

  • FacingTest.w3x
    19.7 KB · Views: 42
Last edited:
Level 15
Joined
Oct 29, 2012
Messages
1,474
Well Big thanks but who said I didn't understand what you were trying to say ? Well read :
1st - How can I have a JASS system working with a GUI one of movement ?
2nd - Should I remove 'Just for testing' lines?
3rd - Does pn work directly as 'player number' or not?
4th - How would I set my animations with this JASS?
5th - What are locals ?
Finally that works for me normally . But the only thing I wanna explain is :
- We have 24 Unit-types ( right + left ) , Your triggers are set in case of having 2 unit-types. But If player 1 chooses luigi ... Another one chooses Mario ...Another one chooses Peach , Another one chooses Toad..Well i should set for each one its left facing ... But I can't set them because there is no trigger that allows so ... It's like this :
Event : A unit is sold.
Actions : SaveInteger(udg_Hashtable, X[pn], 0,Y[pn]) .... Let's asume that X is mario . So Y is mario-op . But What if X wasn't mario . How would I set the unit-types of this unknown unit-type which shouldn't be mario ?
but
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Well Animation still doesn't work

  • SetVariables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- The maximum amount of players playing at the same time. --------
      • Set _AmountPlayers_2D = 4
      • -------- The speed your platformer will fall at. --------
      • Set _SpeedFall_2D = 25.00
      • -------- The terrain type you are able to stand at. --------
      • Set _GroundStable_2D = Cityscape - Dirt
      • -------- The terrain type that kills you. --------
      • Set _GroundKill_2D = Dungeon - Lava
      • -------- The speed your platformer moves at. --------
      • Set _SpeedMove_2D = 30.00
      • -------- The angle your platformer moves when the right arrow key is pressed. --------
      • Set _AngleRight_2D = 0.00
      • -------- The angle your platformer moves when the left arrow key is pressed. --------
      • Set _AngleLeft_2D = 180.00
      • -------- The angle you fall towards. --------
      • Set _Integer_2D = 1
      • For each (Integer A) from 1 to 4, do (Actions)
        • Loop - Actions
          • Set _AngleGravity_2D[_Integer_2D] = 270.00
          • Set _Integer_2D = (_Integer_2D + 1)
      • -------- The distance between your platformer and stable ground. --------
      • Set _BlockDistance_2D = 50.00
      • -------- Leave this at 5~ above _BlockDistance_2D --------
      • Set _BlockDistance2_2D = 5.00
      • -------- The distance between the platformer and the special effect which is created when jumping. --------
      • Set _JumpSED_2D = 20.00
      • -------- The angle at which the special effect created when jumping is created. --------
      • Set _Integer_2D = 1
      • For each (Integer A) from 1 to _AmountPlayers_2D, do (Actions)
        • Loop - Actions
          • Set _JumpSEA_2D[_Integer_2D] = _AngleGravity_2D[_Integer_2D]
          • Set _Integer_2D = (_Integer_2D + 1)
      • -------- The angle your platformer moves when pressing the up arrow key. --------
      • Set _Integer_2D = 1
      • For each (Integer A) from 1 to _AmountPlayers_2D, do (Actions)
        • Loop - Actions
          • Set _AngleJump_2D[_Integer_2D] = 90.00
          • Set _Integer_2D = (_Integer_2D + 1)
      • -------- The speed your platformer gains when jumping. --------
      • Set _SpeedJump_2D = 30.00
      • -------- The height of your platformers jumps. --------
      • Set _HeightJump_2D = 20
      • -------- The height of your platformers walljumps. --------
      • Set _HeightWJump_2D = 0
      • -------- If walljumping is prohibited or not. --------
      • Set _Integer_2D = 1
      • For each (Integer A) from 1 to _AmountPlayers_2D, do (Actions)
        • Loop - Actions
          • Set _WallJumpEnabled_2D[_Integer_2D] = True
          • Set _Integer_2D = (_Integer_2D + 1)
      • -------- The angle of your camera. --------
      • Set _ViewCamera_2D = 270.00
  • Gravity
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • -------- Makes the trigger run for each player set to play: --------
      • Set _IntegerG_2D = 1
      • For each (Integer A) from 1 to _AmountPlayers_2D, do (Actions)
        • Loop - Actions
          • -------- (Not gravity, sets camera:) --------
          • Camera - Pan camera for (Player(_IntegerG_2D)) to _Hero_Point_2D[_IntegerG_2D] over 0.15 seconds
          • Camera - Set (Player(_IntegerG_2D))'s camera Angle of attack to _ViewCamera_2D over 0.00 seconds
          • -------- Checks so there isn't any stable ground and the unit isn't jumping: --------
          • Set _tempPointG_2D = (Position of _Hero_2D[_IntegerG_2D])
          • Set _tempPointG2_2D = (_tempPointG_2D offset by _BlockDistance2_2D towards _AngleGravity_2D[_IntegerG_2D] degrees)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain type at _tempPointG2_2D) Not equal to _GroundStable_2D
              • _TimerJump_2D[_IntegerG_2D] Less than or equal to 0
            • Then - Actions
              • -------- Moves unit towards set gravity. --------
              • Custom script: call RemoveLocation( udg__tempPointG_2D )
              • Custom script: call RemoveLocation( udg__tempPointG2_2D )
              • Set _tempPointG_2D = (Position of _Hero_2D[_IntegerG_2D])
              • Set _tempPointG2_2D = (_tempPointG_2D offset by _SpeedFall_2D towards _AngleGravity_2D[_IntegerG_2D] degrees)
              • Unit - Move _Hero_2D[_IntegerG_2D] instantly to _tempPointG2_2D
              • Custom script: call RemoveLocation( udg__tempPointG_2D )
              • Custom script: call RemoveLocation( udg__tempPointG2_2D )
            • Else - Actions
          • -------- Reduces the jump timer: --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • _TimerJump_2D[_IntegerG_2D] Greater than or equal to 1
            • Then - Actions
              • Set _TimerJump_2D[_IntegerG_2D] = (_TimerJump_2D[_IntegerG_2D] - 1)
            • Else - Actions
          • Set _IntegerG_2D = (_IntegerG_2D + 1)
      • Custom script: call RemoveLocation( udg__tempPointG_2D )
      • Custom script: call RemoveLocation( udg__tempPointG2_2D )
  • MovementRightOn
    • Events
      • Player - Player 1 (Red) Presses the Right Arrow key
      • Player - Player 2 (Blue) Presses the Right Arrow key
      • Player - Player 3 (Teal) Presses the Right Arrow key
      • Player - Player 4 (Purple) Presses the Right Arrow key
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RightFace[IntegerVar] Equal to False
        • Then - Actions
          • -------- Just for optimization --------
          • Set IntegerVar = (Player number of (Triggering player))
          • -------- Take unit Facing --------
          • Set CurrentFacing = (Facing of _Hero_2D[IntegerVar])
          • -------- Replace model --------
          • Set _tempPoint_2D[IntegerVar] = (Position of _Hero_2D[IntegerVar])
          • Unit - Hide _Hero_2D[IntegerVar]
          • Unit - Move _Hero2_2D[IntegerVar] instantly to _tempPoint_2D[IntegerVar]
          • Set _Hero_2D[IntegerVar] = _Hero2_2D[IntegerVar]
          • Unit - Unhide _Hero_2D[IntegerVar]
          • Custom script: call RemoveLocation(udg__tempPoint_2D[udg_IntegerVar])
          • Set RightFace[IntegerVar] = True
        • Else - Actions
      • -------- -------------------------------------------------- Set the correct Animation ----------------------------------------- --------
      • Animation - Remove the Stand - 1 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Stand - 2 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Stand Ready animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Attack - 1 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Attack - 2 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Attack - 3 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Death animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Dissipate animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Spell First - Spin animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Spell Second - Jump animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Spell Throw - Fireball animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Add the Walk animation tag to _Hero_2D[(Player number of (Triggering player))]
      • -------- Turns on right movement for player: --------
      • Set _MovingRight_2D[(Player number of (Triggering player))] = True
  • MovementRight
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • -------- Makes the trigger run for each player set to play: --------
      • Set _IntegerR_2D = 1
      • For each (Integer A) from 1 to _AmountPlayers_2D, do (Actions)
        • Loop - Actions
          • -------- Checks so there is no stable ground to the right of the player and that the player is actually moving right: --------
          • Set _tempPointR_2D = (Position of _Hero_2D[_IntegerR_2D])
          • Set _tempPointR2_2D = (_tempPointR_2D offset by _BlockDistance2_2D towards _AngleRight_2D degrees)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • _MovingRight_2D[_IntegerR_2D] Equal to True
              • (Terrain type at _tempPointR2_2D) Not equal to _GroundStable_2D
            • Then - Actions
              • -------- Moves the player to the right: --------
              • Set _tempPointR_2D = (Position of _Hero_2D[_IntegerR_2D])
              • Set _tempPointR2_2D = (_tempPointR_2D offset by _SpeedMove_2D towards _AngleRight_2D degrees)
              • Unit - Make _Hero_2D[_IntegerR_2D] face 0.00 over 0.00 seconds
              • Unit - Move _Hero_2D[_IntegerR_2D] instantly to _tempPointR2_2D
            • Else - Actions
          • Set _IntegerR_2D = (_IntegerR_2D + 1)
      • Custom script: call RemoveLocation( udg__tempPointR_2D )
      • Custom script: call RemoveLocation( udg__tempPointR2_2D )
  • MovementRightOff
    • Events
      • Player - Player 1 (Red) Releases the Right Arrow key
      • Player - Player 2 (Blue) Releases the Right Arrow key
      • Player - Player 3 (Teal) Releases the Right Arrow key
      • Player - Player 4 (Purple) Releases the Right Arrow key
    • Conditions
    • Actions
      • -------- -------------------------------------------------- Getting Back The Original Animation ----------------------------------------- --------
      • Animation - Add the Stand - 1 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Stand - 2 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Stand Ready animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Attack - 1 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Attack - 2 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Attack - 3 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Death animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Dissipate animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Spell First - Spin animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Spell Second - Jump animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Spell Throw - Fireball animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Walk animation tag to _Hero_2D[(Player number of (Triggering player))]
      • -------- Turns off right movement for player: --------
      • Set _MovingRight_2D[(Player number of (Triggering player))] = False
  • MovementLeftOn
    • Events
      • Player - Player 1 (Red) Presses the Left Arrow key
      • Player - Player 2 (Blue) Presses the Left Arrow key
      • Player - Player 3 (Teal) Presses the Left Arrow key
      • Player - Player 4 (Purple) Presses the Left Arrow key
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RightFace[IntegerVar] Equal to True
        • Then - Actions
          • -------- Just for optimization --------
          • Set IntegerVar = (Player number of (Triggering player))
          • -------- Take unit Facing --------
          • Set CurrentFacing = (Facing of _Hero_2D[IntegerVar])
          • -------- Replace model --------
          • Set _tempPoint_2D[IntegerVar] = (Position of _Hero_2D[IntegerVar])
          • Unit - Hide _Hero_2D[IntegerVar]
          • Set _Hero_2D[IntegerVar] = _Hero1_2D[IntegerVar]
          • Unit - Move _Hero_2D[IntegerVar] instantly to _tempPoint_2D[IntegerVar]
          • Unit - Unhide _Hero_2D[IntegerVar]
          • Custom script: call RemoveLocation(udg__tempPoint_2D[udg_IntegerVar])
          • Set RightFace[IntegerVar] = False
        • Else - Actions
      • -------- -------------------------------------------------- Set the correct Animation ----------------------------------------- --------
      • Animation - Remove the Stand - 1 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Stand - 2 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Stand Ready animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Attack - 1 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Attack - 2 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Attack - 3 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Death animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Dissipate animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Spell First - Spin animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Spell Second - Jump animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Spell Throw - Fireball animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Add the Walk animation tag to _Hero_2D[(Player number of (Triggering player))]
      • -------- Turns on left movement for player: --------
      • Set _MovingLeft_2D[(Player number of (Triggering player))] = True
  • MovementLeft
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • -------- Makes the trigger run for each player set to play: --------
      • Set _IntegerL_2D = 1
      • For each (Integer A) from 1 to _AmountPlayers_2D, do (Actions)
        • Loop - Actions
          • -------- Checks so there is no stable ground to the left of the player and that the player is actually moving left: --------
          • Set _tempPointL_2D = (Position of _Hero_2D[_IntegerL_2D])
          • Set _tempPointL2_2D = (_tempPointL_2D offset by _BlockDistance2_2D towards _AngleLeft_2D degrees)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • _MovingLeft_2D[_IntegerL_2D] Equal to True
              • (Terrain type at _tempPointL2_2D) Not equal to _GroundStable_2D
            • Then - Actions
              • -------- Moves the player to the left: --------
              • Set _tempPointL_2D = (Position of _Hero_2D[_IntegerL_2D])
              • Set _tempPointL2_2D = (_tempPointL_2D offset by _SpeedMove_2D towards _AngleLeft_2D degrees)
              • Unit - Make _Hero_2D[_IntegerL_2D] face 180.00 over 0.00 seconds
              • Unit - Move _Hero_2D[_IntegerL_2D] instantly to _tempPointL2_2D
            • Else - Actions
          • Set _IntegerL_2D = (_IntegerL_2D + 1)
      • Custom script: call RemoveLocation( udg__tempPointL_2D )
      • Custom script: call RemoveLocation( udg__tempPointL2_2D )
  • MovementLeftOff
    • Events
      • Player - Player 1 (Red) Releases the Left Arrow key
      • Player - Player 2 (Blue) Releases the Left Arrow key
      • Player - Player 3 (Teal) Releases the Left Arrow key
      • Player - Player 4 (Purple) Releases the Left Arrow key
    • Conditions
    • Actions
      • -------- -------------------------------------------------- Getting Back The Original Animation ----------------------------------------- --------
      • Animation - Add the Stand - 1 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Stand - 2 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Stand Ready animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Attack - 1 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Attack - 2 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Attack - 3 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Death animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Dissipate animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Spell First - Spin animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Spell Second - Jump animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Spell Throw - Fireball animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Walk animation tag to _Hero_2D[(Player number of (Triggering player))]
      • -------- Turns off left movement for player: --------
      • Set _MovingLeft_2D[(Player number of (Triggering player))] = False
  • JumpExecute
    • Events
      • Player - Player 1 (Red) Presses the Up Arrow key
      • Player - Player 2 (Blue) Presses the Up Arrow key
      • Player - Player 3 (Teal) Presses the Up Arrow key
      • Player - Player 4 (Purple) Presses the Up Arrow key
    • Conditions
    • Actions
      • -------- Checks so the player is standing at stable ground: --------
      • Set _tempPointJE_2D = (Position of _Hero_2D[(Player number of (Triggering player))])
      • Set _tempPointJE2_2D = (_tempPointJE_2D offset by _BlockDistance2_2D towards _AngleGravity_2D[(Player number of (Triggering player))] degrees)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Terrain type at _tempPointJE2_2D) Equal to _GroundStable_2D
        • Then - Actions
          • -------- Increases jump timer and creates special effect: --------
          • Custom script: call RemoveLocation( udg__tempPointJE_2D )
          • Custom script: call RemoveLocation( udg__tempPointJE2_2D )
          • Set _tempPointJE_2D = (Position of _Hero_2D[(Player number of (Triggering player))])
          • Set _tempPointJE2_2D = (_tempPointJE_2D offset by _JumpSED_2D towards _JumpSEA_2D[(Player number of (Triggering player))] degrees)
          • Special Effect - Create a special effect at _tempPointJE2_2D using Abilities\Spells\Human\Polymorph\PolyMorphTarget.mdl
          • Special Effect - Destroy (Last created special effect)
          • Set _TimerJump_2D[(Player number of (Triggering player))] = _HeightJump_2D
        • Else - Actions
          • -------- Checks if there's stable ground towards the facing of the player and if walljump is enabled: --------
          • Set _tempPointJE_2D = (Position of _Hero_2D[(Player number of (Triggering player))])
          • Set _tempPointJE2_2D = (_tempPointJE_2D offset by _BlockDistance2_2D towards (Facing of _Hero_2D[(Player number of (Triggering player))]) degrees)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain type at _tempPointJE2_2D) Equal to _GroundStable_2D
              • _WallJumpEnabled_2D[(Player number of (Triggering player))] Equal to True
            • Then - Actions
              • -------- Increases jump timer and creates special effect: --------
              • Set _tempPointJE_2D = (Position of _Hero_2D[(Player number of (Triggering player))])
              • Set _tempPointJE2_2D = (_tempPointJE_2D offset by _JumpSED_2D towards _JumpSEA_2D[(Player number of (Triggering player))] degrees)
              • Special Effect - Create a special effect at _tempPointJE2_2D using Abilities\Spells\Orc\FeralSpirit\feralspiritdone.mdl
              • Special Effect - Destroy (Last created special effect)
              • Set _TimerJump_2D[(Player number of (Triggering player))] = _HeightWJump_2D
            • Else - Actions
      • -------- -------------------------------------------------- Set Jump Animation ----------------------------------------- --------
      • Animation - Remove the Stand - 1 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Stand - 2 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Stand Ready animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Attack - 1 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Attack - 2 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Attack - 3 animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Death animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Dissipate animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Spell First - Spin animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Add the Spell Second - Jump animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Spell Throw - Fireball animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Animation - Remove the Walk animation tag to _Hero_2D[(Player number of (Triggering player))]
      • Custom script: call RemoveLocation( udg__tempPointJE_2D )
      • Custom script: call RemoveLocation( udg__tempPointJE2_2D )
  • Jump Copy
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • -------- Makes the trigger run for each player set to play: --------
      • Set _IntegerJ_2D = 1
      • For each (Integer A) from 1 to _AmountPlayers_2D, do (Actions)
        • Loop - Actions
          • -------- Checks if there's stable ground above the player: --------
          • Set _tempPointJ_2D = (Position of _Hero_2D[_IntegerJ_2D])
          • Set _tempPointJ2_2D = (_tempPointJ_2D offset by _BlockDistance_2D towards _AngleJump_2D[_IntegerJ_2D] degrees)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain type at _tempPointJ2_2D) Not equal to _GroundStable_2D
              • _TimerJump_2D[_IntegerJ_2D] Greater than or equal to 1
            • Then - Actions
              • -------- Moves the player upwards: --------
              • Set _tempPointJ_2D = (Position of _Hero_2D[_IntegerJ_2D])
              • Set _tempPointJ2_2D = (_tempPointJ_2D offset by _SpeedJump_2D towards _AngleJump_2D[_IntegerJ_2D] degrees)
              • Unit - Move _Hero_2D[_IntegerJ_2D] instantly to _tempPointJ2_2D
            • Else - Actions
              • -------- -------------------------------------------------- Getting Back The Original Animation ----------------------------------------- --------
              • Animation - Add the Stand - 1 animation tag to _Hero_2D[(Player number of (Triggering player))]
              • Animation - Remove the Stand - 2 animation tag to _Hero_2D[(Player number of (Triggering player))]
              • Animation - Remove the Stand Ready animation tag to _Hero_2D[(Player number of (Triggering player))]
              • Animation - Remove the Attack - 1 animation tag to _Hero_2D[(Player number of (Triggering player))]
              • Animation - Remove the Attack - 2 animation tag to _Hero_2D[(Player number of (Triggering player))]
              • Animation - Remove the Attack - 3 animation tag to _Hero_2D[(Player number of (Triggering player))]
              • Animation - Remove the Death animation tag to _Hero_2D[(Player number of (Triggering player))]
              • Animation - Remove the Dissipate animation tag to _Hero_2D[(Player number of (Triggering player))]
              • Animation - Remove the Spell First - Spin animation tag to _Hero_2D[(Player number of (Triggering player))]
              • Animation - Remove the Spell Second - Jump animation tag to _Hero_2D[(Player number of (Triggering player))]
              • Animation - Remove the Spell Throw - Fireball animation tag to _Hero_2D[(Player number of (Triggering player))]
              • Animation - Remove the Walk animation tag to _Hero_2D[(Player number of (Triggering player))]
          • Set _IntegerJ_2D = (_IntegerJ_2D + 1)
      • Custom script: call RemoveLocation( udg__tempPointJ_2D )
      • Custom script: call RemoveLocation( udg__tempPointJ2_2D )
  • TerrainKill
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • -------- Makes the trigger run for each player set to play: --------
      • Set _IntegerT_2D = 1
      • For each (Integer A) from 1 to _AmountPlayers_2D, do (Actions)
        • Loop - Actions
          • -------- Checks if the player is at harmfull ground: --------
          • Set _tempPointT_2D = (Position of _Hero_2D[_IntegerT_2D])
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Terrain type at _tempPointT_2D) Equal to _GroundKill_2D
            • Then - Actions
              • -------- Kills the player: --------
              • Unit - Kill _Hero_2D[_IntegerT_2D]
            • Else - Actions
          • Set _IntegerT_2D = (_IntegerT_2D + 1)
      • Custom script: call RemoveLocation( udg__tempPointT_2D )
URL ==> http://www.hiveworkshop.com/forums/spells-569/2dengine-1-08b-149850/?prev=search%3D2DEngine%26d%3Dlist%26r%3D20
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
For God's sake xD Did you test the map? Did you notice how I added 2 unit types in map initialization? Just do the same with all your unit types.

Locals are variables that only works withing a single function.

Al you have to do is add your units types in map initialization (right/left) and add the right facing units the shop. The system cares for the rest.

About the Movement Thing, that's a bit harder. There are tons of triggers >.< BTW; the triggers shouldn't collide. You can have your movements triggers as they are. Mine will just swap units, yours will move the unit. The only thing is that in my system the Unit for Player 1 is not Unit[1] but Unit[0]. That's easy to fix. Just add a +1 to all the local pn variables.
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
Heheheh I saw it , I will add +1 to them ... My movement system is the only 2D system i've found in Hiveworkshop..It's not smoother ... I email-ed Soldiers' mapmaker ... He didn't reply ... eh uses cliffs as a platform recognizer ... My System makes the unit jumps with the same speed always ... it's not parabola... It should make the unit gets higher everytime with a decreasing speed till it reaches 0 and it starts falling .... Well My system is dumb !!! Use units below 'it includes right facing and left facing units (all)' . Well You can add them in your map initializing ...
Would you tell me how to load an unit form hashtable when using movement system ? I forgot LOL
 

Attachments

  • ObjectsR.rar
    10 KB · Views: 32
Status
Not open for further replies.
Top