• 🏆 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] Calculating distance traveled?

Status
Not open for further replies.
Level 13
Joined
Jun 5, 2008
Messages
504
How should I do this? Periodic trigger sound best option for me, but it would pretty much require using global variables, which I dislike...

So I would like to know if there is some smart way to do this. I havent yet adapted to action/event/condition definition, so dunno if there would be somekind of function to help with this.
 
Level 2
Joined
Aug 2, 2010
Messages
17
Periodic trigger is the only way to do it if you want to do it cleanly. You don't need globals. You can use units' custom values to store the information you need.
 
Level 5
Joined
Jul 10, 2010
Messages
124
you dont need a periodic trigger if you use an action definition

attachment.php
 

Attachments

  • act.jpg
    act.jpg
    213.1 KB · Views: 169
Level 13
Joined
Jun 5, 2008
Messages
504
The problem with the action definition would be:
That only counts distance between 2 points after duration, so it doesnt work properly if unit walks back and forth, but that gave me some ideas maybe I can use loop on there to store distance periodicly.

Ill have to look if I can get something done
 
Level 13
Joined
Jun 5, 2008
Messages
504
Meh I need to know how to return value to variable from action definition. There is return option, but I dont know how to return it to variable....sight*

I did this meanwhile...I dont know how to use the return function so I used global variable to transfer values. The triggers work, but cause lagg. It runs like 500 events/actions in half a minute, which seems to be too much.

*edit*
Doh...I had another triggers running too, will see how it affects....

*edit2*
Yea it works. But I REALLY NEED TO KNOW HOW TO USE THE RETURN FUNCTION!!! HELP MEEEEEEE

attachment.php
 

Attachments

  • tirgrs.JPG
    tirgrs.JPG
    60.3 KB · Views: 194
Last edited:
Status
Not open for further replies.
Top