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

Requesting help with triggers, please

Status
Not open for further replies.
Level 17
Joined
Apr 13, 2008
Messages
1,597
Hi. I want to make a turn based multiplayer map and I want to make the units on the map to use their HitPoints as "movement points" or "action points". So if the unit would move its hp would decrease until the unit would stop. At the end of the turn it would regain hp of course.
The problem is, I'm pretty new to the trigger editor and I'm afraid it would take weeks to figure out myself how to make the units lose hp and how to stop the hp loss effect after they stop effectively without using hundreds of variables.

My current idea is:
If unit is issued an order(move) then save its last position and run a trigger:
Every 0.15 sec check the difference between the last pos variable and its current pos then make it lose hp based on the difference.
But I would need hundreds of variables and triggers for this one so it's an awful idea.

Help me out please (and sorry for my lousy english, it's pretty late here).

Update: problem solved, thanks for the help.
 
Last edited:
Level 15
Joined
Jan 16, 2008
Messages
1,244
There may be one problem in that idea. When unit's hitpoints hit zero, the unit dies. I advise using mana instead. First thing you should do is set that unit's mana regeneration so 0(we don't want it to regenerate move points). Then you do your idea, it is not that hard after all. You need 2 point variables, one old and one new. Then you need a looping trigger, of course. So you check the unit's position and set it to new. Calculate the distance between old and new points and adjust mana according to that value. Finnaly, set the old point to equal new point and the loop goes again, taking the new new point. Oh, and when that unit's mana hits zero, use the set unit property trigger to set it's movespeed to 1(it can still move but nobody will notice, also you have to set minimum movespeed to 1 in the gameplay constants).
 
Level 17
Joined
Apr 13, 2008
Messages
1,597
I came up with letting the player move only one unit at a time, but I encountered an obstacle here as well.

When you tell a unit to move with the right click it's actually not a 'move' order, but something else :S
-What's its name?

When a unit stops moving it doesn't 'stop' but does something else..
-What does it do?

-Isn't there an event like "order carried out"?

Thanks for the help in advance :)
 
Level 8
Joined
Jan 23, 2008
Messages
334
Hmm, Im not sure but I think right-click is different then an actual move command Im not sure thought because some triggers will let you choose either unit move order or right-click for all the right-click commands. also I think when a unit stops at the end of their move order I dont think it actually tells the unit to stop.

Try using the actual buttons to move instead of right-click that might help, unless you have it configured differently.
 
Level 17
Joined
Apr 13, 2008
Messages
1,597
I'm sure right-click is different than the move command and at the end of the move command the game does not tell the unit to 'stop' (even though, when you play the map the stop button is highlighted on the GUI).
So I'm still looking for the answers to the questions:

When you tell a unit to move with the right click it's actually not a 'move' order, but something else :S
-What's its name?

When a unit stops moving it doesn't 'stop' but does something else..
-What does it do?

-Isn't there an event like "order carried out"?

Thanks for the help in advance :)
 
Level 17
Joined
Apr 13, 2008
Messages
1,597
If you think it's possible to do it with Jass I'll try to learn it, thanks, but I can't believe that the developers didn't make an event or a condition to check if the unit was moved with a right click move then stopped ...
- which is not a fricking order at all.. - (the stop after the movement, I mean)
At least not an order with no target.. not an order targeting a point.. not an order targeting an object.. what the hell it is then..
 
Last edited:
Level 15
Joined
Jan 16, 2008
Messages
1,244
Here, i did it in gui ^^

  • movement_limiting_trigger
  • events
    • time - every 0.1 seconds of game time
  • conditions
    • none
  • actions
    • if(all conditions are true) then do (then actions) else do (else actions)
      • if conditions
        • (x of newloc) not equal to (x of oldloc)
        • (y of newloc) not equal to (y of oldloc)
      • then actions
        • set oldloc = newloc
        • set newloc = (position of mover)
        • if ((mana of mover) less than 1.00) then do (unit - set mover movement speed to 1.00) else do (do nothing)
        • unit - set mana of mover to ((mana of mover)-(distance between newloc and oldloc))
      • else actions
        • set oldloc = newloc
        • set newloc = (position of mover)
        • if ((mana of mover) less than 1.00) then do (unit - set mover movement speed to 1.00) else do (do nothing)
 
Level 17
Joined
Apr 13, 2008
Messages
1,597
Thanks, but I already did that in the begining and I'm not happy with it because I want to move many units at the same time. And this method would require 5 variable/unit and global arrays/player what would make things very complicated.

I know that whenever a unit is issued an order targeting a point and if the issued order is not a 'move' or 'patrol' order I could order the unit to really -'move'-, but that would be again unnecessary complication.

Also, I would really like to know now how did the developers name the right click move order and the stop action at the end of it and at the end of the move order.
 
Level 17
Joined
Apr 13, 2008
Messages
1,597
I don't like the idea of 0 movement speed change since the minimum movement speed is 1. You can change the minimum movement speed game constant to 0 with a shift+click on it, but its absolute minimum IS 1 :( Sadly.
Units with 1 ms will still move, it's hardly noticable but it is noticable.

And..
Mystery gets revealed (thanks to HappyTauren):
When a unit finishes an action and is idle it's current order is called.... 'idle' :D

So problem solved.
 
Last edited:
Status
Not open for further replies.
Top