• 🏆 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] Rotate Buildings?

Status
Not open for further replies.
Level 4
Joined
May 17, 2011
Messages
106
Hello!

I've been trying to find a way to rotate buildings in game by making a custom ability which, when clicked, would replace the existing/triggering building with a same building having the equal amount of health but for some reason it won't work...

Anyone has an idea of how I could do this?
 
Level 4
Joined
May 17, 2011
Messages
106
I'm not really good at jass :s what would be the entire trigger? I supose it's more than 4 lines?
 
  • RotateBuilding
    • Events
    • Conditions
    • Actions
      • -------- Set Unit to the building you want to rotate --------
      • Set Unit = ...
      • -------- Set Angle to whatever you want --------
      • Set Angle = 90.00
      • -------- This will set the angle of the building --------
      • Custom script: call SetUnitPosition(udg_Unit, GetUnitX(udg_Unit), GetUnitY(udg_Unit))
      • Custom script: call SetUnitFacing(udg_Unit, udg_Angle)
 
Level 4
Joined
May 17, 2011
Messages
106
Angle variable is of type integer or real?

Edit: Your trigger doesn't work :( it only deletes the unit which used the ability to rotate
 
Last edited:
Level 4
Joined
May 17, 2011
Messages
106
real...

EDIT:
you dont need to learn jass, just put the script above your map header and do this...

  • Custom script: call SetImmovableUnitFacing(udg_UNIT, 90.0)
UNIT is your unit created via variable editor...
you must put 'udg_' coz its a prefix for UNIT...

Yeah I know about udg_

For some reason your custom script gives me an error when I attempt to save my map. (Yes, I replaced UNIT with my unit variable)
 
Level 4
Joined
May 17, 2011
Messages
106
Well I did what you told me to... I tried with your custom script being IN the header, which wouldn't work... I also tried with magthe's trigger, which just deleted the triggering unit.

It's only when I add your custom script that I get that error, else I don't get any.

Here is what my trigger looks like...

  • RotateUnit
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to RotateWall
    • Actions
      • Set RotatingUnit = (Casting unit)
      • Custom script: call SetImmovableUnitFacing(udg_RotatingUnit, 90.0)
 
Level 16
Joined
Mar 3, 2006
Messages
1,564
hmm... actually I took a scout tower and made it a wall using crates fences and stone walls.. you think that could work?

I am not 100% sure but buildings can't be rotated as long as they are classified building. The only thing you could do about building rotation is that they must have variations.

Like, gates and walls but buildings like town halls and barracks can not be rotated unless they are made a normal units with no movement they can be stationary and rotated in any direction (I tried this in my map and worked).
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
Well I did what you told me to... I tried with your custom script being IN the header, which wouldn't work... I also tried with magthe's trigger, which just deleted the triggering unit.

It's only when I add your custom script that I get that error, else I don't get any.

Here is what my trigger looks like...

  • RotateUnit
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to RotateWall
    • Actions
      • Set RotatingUnit = (Casting unit)
      • Custom script: call SetImmovableUnitFacing(udg_RotatingUnit, 90.0)

I got no errors in that trigger, Starquizer is right buildings cant be rotated coz
of their pathing, try making them as normal units and just add pathing blockers
around them...
 
Level 4
Joined
May 17, 2011
Messages
106
How come I can't find that custom script on the editor? I mean, in the functions lists when a trigger is in jass
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
"Custom Script" allows you to type in a line of JASS code instead of inserting pre-determined GUI code. You dont need to use custom script if ur using jass xD
 
Level 4
Joined
May 17, 2011
Messages
106
Heh... still won't work...

Got the stuff in the map header and this trigger...

  • RotateUnit
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to RotateWall
    • Actions
      • Custom script: call SetImmovableUnitFacing(GetSpellAbilityUnit(), GetRandomReal(0,360))
It just deletes the casting unit...

For some reason instead of the rotateunit trigger running, this one is running

  • DestroyBuilding
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Destroy Building
    • Actions
      • Set TempUnit = (Casting unit)
      • Set TempPoint = (Position of TempUnit)
      • Special Effect - Create a special effect at TempPoint using Units\NightElf\Wisp\WispExplode.mdl
      • Unit - Remove TempUnit from the game
      • Custom script: call RemoveLocation (udg_TempPoint)
I'm so confused...
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
What are your rotate wall and destroy building's base abilities? If they're the same, the game might be confused on the base order ids
 
Level 4
Joined
May 17, 2011
Messages
106
What are your rotate wall and destroy building's base abilities? If they're the same, the game might be confused on the base order ids

Really? Used roar skill for both... what if I just change their string order? I'll guess I'll find out soon enough :eek:
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Really? Used roar skill for both... what if I just change their string order? I'll guess I'll find out soon enough :eek:

Probably your problem. Make two new abilities, base them off channel, and change the base order id to barely used ones
 
Keep in mind that the base order id will have to be of a similar type as that of the kind of ability you want to use it for, for instance, if you want a "unit target" spell, you want to use an order id such as "storm bolt" or "firebolt", if it is a "no target" spell then you want to use "thunder clap", "war stomp", and so on. Not sure how important this is, i just noticed a couple of times that it bugged when i tried to use an order id from a spell that was too unsimilar.

And no, changing the order string of your ability will not make it work. It works only with the "channel" spell that has this "base order id" field.
 
Status
Not open for further replies.
Top