• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

How to make a unit turn instantly?

Status
Not open for further replies.

Dun

Dun

Level 2
Joined
Jan 22, 2010
Messages
8
Hello there!

I've been working now and then on a boss map for roughly a half year now, and i simply just love it. I've used this site very often in order to improve my map, as well as finding help.

But now i've come to a problem that i seem to be unable to solve - I'm creating a boss with a Spell Breaker as model, and i want him to make some sort of bladestorm custom spell thing.

What i do, is to repeatedly queue his stand ready animation at 200% speed, while rotating around his own axis
But the problem is that even at 1.00 turn rate, he isn't able to turn around himself fast enough - It looks weird and silly.

Pic:


I've been trying to look in the constants of WE, and doing some trigger stuff, but it seems i'm unable to solve this problem at own hand.

Does anybody here know what i could do to make him turn around his own axis like 'super-fast'? I'm thinking about 600-900 degrees /sec here...
 
Level 1
Joined
Feb 23, 2010
Messages
5
I agree with what Haxel96 did except all you have to do is this:
- pick all units of type - move: [picked unit] to: [current position of unit] facing: [whatever] degrees -
KEEP IT SIMPLE!!! it works better when you can incorperate all parts into one neat, easy trigger!
(Note: i dont use udg_point much, i prefer much simpler triggers)
OR you could also make the custom spell with the caster art of the tornado, making look like a tornado when in the spell mode...
you could also remove the need to turn to attack in the unit stats(unit it transforms into, ie the tornado) and make the spell a sort of "transformation spell" and make the unit to transform into a tornado, making it look like bladestorm...
 
Try modulo:
  • Unit - Move TheEvilWithin instantly to EvilBladestormPoint, facing (((Facing of TheEvilWithin) + 50.00) mod 360.00) degrees
The reason your trigger wasn't working is probably because the unit's facing was greater than 310. (311+50 = 361 degrees) I am not positive whether or not it doesn't automatically convert 361 to 1 degree, but I am pretty sure it doesn't.

EDIT: By the way, you find Modulo in "Math". Basically, go to "Math -> Modulo -> Dividend -> Arithmetic" and set the first to the facing and the second to 50. Then go back and change the divisor to 360.
 
Level 9
Joined
Oct 17, 2009
Messages
370
no, it wont automatically convert 361 to 1 degree, but u can use a real.
"Set TheEvilWithinFacing = (Facing of TheEvilWithin) + 50" and to check it:
"If TheEvilWithinFacing greater than 360 set TheEvilWithinFacing = TheEvilWithinFacing - 360" this will change it so it never goes above 360, (yes i was to lame to open the world editor this time so i didnt use trigger tags...)

BTW:
Try modulo:
  • Unit - Move TheEvilWithin instantly to EvilBladestormPoint, facing (((Facing of TheEvilWithin) + 50.00) mod 360.00) degrees
The reason your trigger wasn't working is probably because the unit's facing was greater than 310. (311+50 = 361 degrees) I am not positive whether or not it doesn't automatically convert 361 to 1 degree, but I am pretty sure it doesn't.

EDIT: By the way, you find Modulo in "Math". Basically, go to "Math -> Modulo -> Dividend -> Arithmetic" and set the first to the facing and the second to 50. Then go back and change the divisor to 360.


I didnt see this :D
 
Level 14
Joined
Aug 31, 2009
Messages
775
I'm quite sure it actually does convert automatically, as in one of my own maps the angles of unit's facing I save as a real number, and it can easily get way over 360 degrees and the facing works perfectly.

Also, Dun, the trigger you posted above leaks a unit group.

Use
  • Set tempgroup = (Units within 250.00 of EvilBladestormPoint matching ((Matching Unit) not equal to TheEvilWithin)
  • Unit Group - Pick every unit in tempgroup and do (actions)
    • Loop - Actions
      • (Whatever)
  • Custom script: call DestroyGroup(udg_tempgroup)
You are also leaking the special effect. Make sure you put a "Destroy (Last Created Special Effect)" at the end of each special effect created. The majority of special effects will still display even if instantly destroyed.

Also, you don't need to screenshot your triggers and host it via an image website, just right click your trigger, select "Copy as Text" and paste it in your post with
  • tags.
 
Level 9
Joined
Oct 17, 2009
Messages
370
I'm quite sure it actually does convert automatically, as in one of my own maps the angles of unit's facing I save as a real number, and it can easily get way over 360 degrees and the facing works perfectly.

Also, Dun, the trigger you posted above leaks a unit group.

Use
  • Set tempgroup = (Units within 250.00 of EvilBladestormPoint matching ((Matching Unit) not equal to TheEvilWithin)
  • Unit Group - Pick every unit in tempgroup and do (actions)
    • Loop - Actions
      • (Whatever)
  • Custom script: call DestroyGroup(udg_tempgroup)
Also, you don't need to screenshot your triggers and host it via an image website, just right click your trigger, select "Copy as Text" and paste it in your post with
  • tags.[/QUOTE]
  • That unit group is not needed, there is something like bj_destroygroup = true
 
bj_ functions (well, actually they are variables) are not slower. Yeah, you can always input their value in first, but they are modified a lot by GUI functions so it is useful to be able to modify them. BJ functions are slower. =D Most should be inlined, but some it is just a hassle to inline and some are actually useful if they aren't just swap functions. =)

In the case of groups (if you don't recycle them) then destroying the group directly with DestroyGroup() would be more efficient since they both end up executing the same function, and since DestroyGroup() is more versatile in the fact that you can alter when you want it to be destroyed (rather than immediately after enumeration).

Speed-wise, it shouldn't make a difference. They are essentially equal.
 

Dun

Dun

Level 2
Joined
Jan 22, 2010
Messages
8
That was a lot of answers there !

Damage is right, 361 degrees automatically converts into 1 degree - I have boss in my map doing that, and it works out fine :)

About the leaking groups and special effects you're talking about... Why do i have to remove them? Do they cause lag if not?

I've made function into a stand-alone trigger now, looking like this:

Whirlwind 3
Events
Time - Every 0.10 seconds of game time
Conditions
Actions
Set EvilBladestormPoint = (Position of TheEvilWithin)
Unit - Move TheEvilWithin instantly to EvilBladestormPoint, facing ((Facing of TheEvilWithin) + 50.00) degrees
Custom script: call RemoveLocation(udg_EvilBladestormPoint)


He is to turn around himself for 3 seconds, which with a 500 degree turn per second, he should be able to do 500 * 3 = 1500 / 360 = About 4½ 360 degree rotations during those 4½ seconds. But no matter what, he still only does 1½ 360 degree rotation ? :(


EDIT: Pfft, how do you make this trigger stuff above work ? :p
 
Level 14
Joined
Aug 31, 2009
Messages
775
Leaking anything eventually causes lag. Groups and points generate lag depending on how many times you're making groups/points without removing them. Once you've leaked enough, you'll hit a limit and the map will begin to run very slowly with a great deal of lag - eventually, it will crash entirely with a "Ran out of memory" error.

As a general rule, it can take a very long time for that to happen, but it depends how rapidly and how often you cause these leaks.

Special effects on the other hand, create tens of thousands of times more lag. You absolutely must remove them after use. Having over 300 special effects or so on the screen can absolutely cripple the map's performance (even if they're invisible - you must still destroy them), compared to having to leak over a million groups/points to cause problems.

EDIT:
Rather than using "Facing Angle of <Unit> + 50.00" try using a loop that sets a Real Variable to the variable + 50 and set his facing to that.

Eg.
  • Events
    • Time - Every 0.1 seconds of game time.
  • Conditions
  • Actions
    • Set WhirlWindReal = WhirlwindReal + 50.00
The reason he may not be spinning at the right speed is that it is picking up what his facing is incorrectly, so it gets the facing of the unit to be what it was say, 0.2 seconds ago, so it missed out some of the rotations. Using a constantly increasing real though should work out fine if that is the case.
 

Dun

Dun

Level 2
Joined
Jan 22, 2010
Messages
8
First of all, thanks for the info about removing special effects n such. I just tested it, and after having done about 30 boss spells, i noticed my fps had decreased by almost 20%. I will fix this sooner or later :)

Well - I've been researching a bit on this subject.

In some other topics, people say that there is no trigger that can make a unit turn INSTANTLY - Yeah, the one you wrote didn't work either :( Actually it only made him turn around in a very odd way xD

  • Whirlwind 3 Copy
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set EvilWithinFacing = (EvilWithinFacing + 30.00)
      • Set EvilBladestormPoint = (Position of TheEvilWithin)
      • Unit - Make TheEvilWithin face EvilWithinFacing over 0.00 seconds
But I read, that there is one way to turn units instantly, which is creating a new unit! I tried it out:

  • Whirlwind 3
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Set EvilWithinFacing = (Facing of TheEvilWithin)
      • Set EvilWithinHP = (Life of TheEvilWithin)
      • Set EvilBladestormPoint = (Position of TheEvilWithin)
      • Unit - Remove TheEvilWithin from the game
      • Unit - Create 1 The Evil Within for Player 10 (Light Blue) at EvilBladestormPoint facing (EvilWithinFacing + 40.00) degrees
      • Unit - Pause (Last created unit)
      • Animation - Play (Last created unit)'s stand ready animation
      • Set TheEvilWithin = (Last created unit)
      • Unit - Set life of TheEvilWithin to EvilWithinHP
      • Hero - Set (Last created unit) Hero-level to 10, Hide level-up graphics
      • Hero - Learn skill for (Last created unit): Finger of Super Death
      • Hero - Learn skill for (Last created unit): Super Frost Nova
      • Custom script: call RemoveLocation(udg_EvilBladestormPoint)
It actually worked, he turned around super-fast as intended.
But due to the way he respawns every ~0.10 sec, he looks extremely awkward when spinning, as well as his hp bar flashes, and he becomes almost untargetable. The way he looks awkward, is because each time he spawns, there is a splitsecond where he does 'stand' animation before doing the 'stand ready' animation.

I'm a bit on rough ground here, it seems that making him spin is a lot harder than expected :/
 

Dun

Dun

Level 2
Joined
Jan 22, 2010
Messages
8
I think this might be the first time I have to redecide something, due to the engine limit d: Well, then I've experienced that too. I'll reconsider his bladestorm ability then ^^

Thinking of it, maybe a custom animation could solve the problem...

nah. I think I'll just thank you for your help and tips, I'll hand over some rep :)
 
Level 19
Joined
Feb 4, 2009
Messages
1,313
since the first time someone posted here I were deciding if i post this:
http://www.wc3c.net/showthread.php?t=105830
there is also another option
export the z facing dummy of this map
http://www.hiveworkshop.com/forums/...-v1-03-a-112543/?prev=d=list&r=20&u=redscores
and change it so it rotates vertically
and because I am 1337 I even know a third option
make a dummy which rotates and has an attachment point(or ask some model maker (I think even I would be able to do it since it is quite simple)) and change the cyclone buff so it uses that model

-> rotating units with instant facing (imho the first thing had a bug with showing the wrong animation for the first frame but I never tried that anyway but it should work since it is a nice thread and bla...have fun with it)
 
  • Like
Reactions: Dun

Dun

Dun

Level 2
Joined
Jan 22, 2010
Messages
8
Been looking at your tips - To be honest, it seems to be a bit too heavy for me to do :) I've also started making another spell for the boss, so... :)

But hey, thanks anyway ! :D
 

Dun

Dun

Level 2
Joined
Jan 22, 2010
Messages
8
Been trying to mess around with tornado and cyclone, but it didn't seem to be as easy as expected...

What's the chance somebody would make an animation for one ? xD

- btw, I didn't understand Landy's post either :D
 
Status
Not open for further replies.
Top