• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[General] Help w/ Projectile Timed Distance

Status
Not open for further replies.

sentrywiz

S

sentrywiz

I'm simply trying to make floating texts displaying damage done. This can be easily done for instant attacks, but projectiles don't go so well. I am wondering how can I determine the distance between unit X and unit Y into seconds?

Basically the triggers would use timers and timers would have that time for when the projectile hits the target, the timer would stop and a floating text would appear.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
I'm simply trying to make floating texts displaying damage done. This can be easily done for instant attacks, but projectiles don't go so well. I am wondering how can I determine the distance between unit X and unit Y into seconds?

Basically the triggers would use timers and timers would have that time for when the projectile hits the target, the timer would stop and a floating text would appear.

if u do a timer then the time what u must wait its

(distance between attacker and target)/missile speed, but since wait not too accurated u need a timer for this, and if u dont use jass then its a bit harder, i guess

but u can give a try for wait if u dont care about milisecond and it is siingle player map .
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
You could make a loop that saves 0.1 every 0.1seg from the moment it's shoot to the moment it arrives the target, then deal the damage. You can save it into hashtable or unit array using indexer.
 

sentrywiz

S

sentrywiz

Unit takes damage event

If there is such an event, it would of solved many many problems. But that event doesn't exist. I can only think of using a gui damage engine here from hive, but then I wouldn't need distance in seconds :S

(distance between attacker and target)/missile speed

I know this much, but then I'd have to set static variables and a check for every unit type on attack. Plus your forgetting that range plays a part here, hence the longer missile moves the longer the wait or the timer. Then I would need a while or a for loop, which kinda messes lot of things when you use them too often.

You could make a loop that saves 0.1 every 0.1seg from the moment it's shoot to the moment it arrives the target, then deal the damage. You can save it into hashtable or unit array using indexer.

That is a computer sabotage. Plus saving every 0.01 seconds triggers an error and a very possible system crash. I think the minimum is 0.03, but same answer - that is just using a large infinite loop that drains lots of ram. I'd rather have 1000 checks than a few loops.


Thanks. I see that if this must be done its either big ass loops or custom damage engines. Obviously, damage engines wins.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
I know this much, but then I'd have to set static variables and a check for every unit type on attack. Plus your forgetting that range plays a part here, hence the longer missile moves the longer the wait or the timer. Then I would need a while or a for loop, which kinda messes lot of things when you use them too often.

i dont see any reason why could be mess up anything until u dont have damn much unit on map.

anyway u can use timer array too what is accurated....

in gui - Timer[custom value of unit] if expire blabla things :p, this way u can attach easily any info because when u start the timer, make hashtable, save there what u want, and add event with action about when timer[custom value of unit] expired then do something and flush hashtable
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
If there is such an event, it would of solved many many problems. But that event doesn't exist. I can only think of using a gui damage engine here from hive, but then I wouldn't need distance in seconds :S

And how do you think damage detection systems work? The event is called Unit takes damage under Specific unit events. I wonder what you are currently using for the instant attacks because any other event won't be precise and won't provide the taken damage to you.
 

sentrywiz

S

sentrywiz

And how do you think damage detection systems work? The event is called Unit takes damage under Specific unit events. I wonder what you are currently using for the instant attacks because any other event won't be precise and won't provide the taken damage to you.

Didn't knew about that event. + rep for you!
I take it back, you don't deserve it. This event is pretty much useless, unless you are going for single player. It really is about specific unit, you can't assign any vars to it.

And no, damage detection systems don't use this. Maybe with jass, if they can modify it to use vars.

  • Untitled Trigger 001
    • Events
      • Game - some_unit_var becomes Equal to 0.00
    • Conditions
      • Do something...
    • Actions
This is what gui-damage detections use. If you don't believe me, here:

http://www.hiveworkshop.com/forums/spells-569/gui-damage-engine-201016/

I've done my homework. You probably skipped through that class :p

p.s kidding. you still get rep


i dont see any reason why could be mess up anything until u dont have damn much unit on map.

anyway u can use timer array too what is accurated....

in gui - Timer[custom value of unit] if expire blabla things :p, this way u can attach easily any info because when u start the timer, make hashtable, save there what u want, and add event with action about when timer[custom value of unit] expired then do something and flush hashtable

You are possibly right. I'll give it a try, it might just work and not cause lot of lag in multiplayer. Anycase thanks!
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Being a Specific unit event does not matter, you can register new units during runtime via Trigger - Add New Event and filter it out again if you need to. And this is highly probably done by the damage detection system you use too. The var becomes value event is only the interface to GUI, works as a listener.
 

sentrywiz

S

sentrywiz

Being a Specific unit event does not matter, you can register new units during runtime via Trigger - Add New Event and filter it out again if you need to. And this is highly probably done by the damage detection system you use too. The var becomes value event is only the interface to GUI, works as a listener.

Sorry for my dick attitude, don't know what was going on when I was writing this. What you say has a point, though I haven't seen damage detection systems use what you described.

Can you link one?

just a tip, u can check if timer is already created or no if u use a boolean array and also can pause then destory the timer if unit dead then dont have that much timer on map :)

If i use a timer array, I can't set it as event. That leaves me with only trying to jass it, and since I Don't know jass...
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Sorry for my dick attitude, don't know what was going on when I was writing this. What you say has a point, though I haven't seen damage detection systems use what you described.

Can you link one?

The gui damage engine you have posted above uses it. It detects new units through UnitIndexer, creates an EVENT_UNIT_DAMAGED event for each, accumulates these events on a single trigger, to reduce leaks, the trigger gets rebuild every 15th registration. This trigger runs some functions of the system and finally sets the value of the DamageEvent variable in order to fire your triggers via the Variable becomes value events.

If i use a timer array, I can't set it as event. That leaves me with only trying to jass it, and since I Don't know jass...

Again, you can register new events during runtime. So use any timer you want in the Trigger - Add New Event To Trigger action. But the problem would be rather to be able to allocate new timers since GUI does not allow that. You would have to have a stack of free timers prepared and fetch your instances from it/lay them back when their task is completed.

I did not know lua/am still looking into it but saw the potential to improve mapmaking and learn something more universal as an extra. I guess most only need a little introduction and/or initiative to get a first starting clue.
 
Status
Not open for further replies.
Top