• 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.

[Solved] rotating ingame

Status
Not open for further replies.
Level 7
Joined
Jan 28, 2012
Messages
266
you can make them turn if you give them movespeed, turn rate, and set their movement type to something other then none.

but to prevent them from having the movement commands i.e. patrol move...

you need to give them the ability root. you can even have the ability roots disabled by triggers.
 
Level 4
Joined
May 21, 2010
Messages
49
i made more then one

  • function SetImmovableUnitFacing takes unit u, real a returns nothing
    • call SetUnitPosition(u, GetUnitX(u), GetUnitY(u))
    • call SetUnitFacing(u, a)
  • endfunction
  • function Trig_SetFacingAngles_Enum takes nothing returns boolean
    • local unit u = GetFilterUnit()
    • local string s = GetEventPlayerChatString()
    • if IsUnitAlly(u,GetTriggerPlayer()) and GetWidgetLife(u)>0.405 then
      • call SetUnitFacing(u,S2R(SubString(s,7,StringLength(s))))
    • endif
    • set u = null
    • return false
  • endfunction
  • function Trig_SetFacingAngles_Actions takes nothing returns boolean
    • local group g = CreateGroup()
    • call GroupEnumUnitsSelected(g,GetTriggerPlayer(),Filter(function Trig_SetFacingAngles_Enum))
    • call DestroyGroup(g)
    • set g = null
    • return false
  • endfunction
  • function InitTrig_SetFacingAngles takes nothing returns nothing
    • local trigger t=CreateTrigger()
    • local integer i=0
    • loop
      • exitwhen i>11
      • call TriggerRegisterPlayerChatEvent(t,Player(i),"-angle",false)
      • set i=i+1
    • endloop
    • call TriggerAddCondition(t,Condition(function Trig_SetFacingAngles_Actions))
    • set t = null
  • endfunction
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing -angle as A substring
      • Player - Player 2 (Blue) types a chat message containing -angle as A substring
      • Player - Player 3 (Teal) types a chat message containing -angle as A substring
      • Player - Player 4 (Purple) types a chat message containing -angle as A substring
      • Player - Player 5 (Yellow) types a chat message containing -angle as A substring
      • Player - Player 6 (Orange) types a chat message containing -angle as A substring
      • Player - Player 7 (Green) types a chat message containing -angle as A substring
      • Player - Player 8 (Pink) types a chat message containing -angle as A substring
      • Player - Player 9 (Gray) types a chat message containing -angle as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -angle as A substring
      • Player - Player 11 (Dark Green) types a chat message containing -angle as A substring
      • Player - Player 12 (Brown) types a chat message containing -angle as A substring
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to (Triggering player)
            • Then - Actions
              • Unit - Make (Picked unit) face (Real((Substring((Entered chat string), 8, (Length of (Entered chat string)))))) over 0.01 seconds
            • Else - Actions
some of them are just copies that i found in the forums
 
Level 7
Joined
Jan 28, 2012
Messages
266
well, you aren't using it in your example, you have the triggers set up but, you aren't having it be used for buildings you should add a check like this,

if (Picked Unit) is a structure = true then
Custom Script: call SetUnitX(Picked Unit, GetUnitX(PickedUnit))
etc...

of course you would want to set picked unit to a variable, for effeciency
 
Level 4
Joined
May 21, 2010
Messages
49
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing -angle as A substring
      • Player - Player 2 (Blue) types a chat message containing -angle as A substring
      • Player - Player 3 (Teal) types a chat message containing -angle as A substring
      • Player - Player 4 (Purple) types a chat message containing -angle as A substring
      • Player - Player 5 (Yellow) types a chat message containing -angle as A substring
      • Player - Player 6 (Orange) types a chat message containing -angle as A substring
      • Player - Player 7 (Green) types a chat message containing -angle as A substring
      • Player - Player 8 (Pink) types a chat message containing -angle as A substring
      • Player - Player 9 (Gray) types a chat message containing -angle as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -angle as A substring
      • Player - Player 11 (Dark Green) types a chat message containing -angle as A substring
      • Player - Player 12 (Brown) types a chat message containing -angle as A substring
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units currently selected by (Triggering player)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Triggering unit) is A structure) Equal to True
              • (Owner of (Picked unit)) Equal to (Triggering player)
            • Then - Actions
              • Custom script: call SetUnitX(Picked Unit, GetUnitX(PickedUnit))
              • Unit - Make (Picked unit) face (Real((Substring((Entered chat string), 8, (Length of (Entered chat string)))))) over 0.01 seconds
            • Else - Actions
i done that but when i try to save it it gives syntax error and i cant test the map ingame

edit: i forgot the variable
 
Level 4
Joined
May 21, 2010
Messages
49
it works! thanks to all who helped me

i done the trigger in a test map to not wait the whole saving progress, it worked then i done the trigger to my map, and its not working: undeclared function setimmovableunitfacing
what's the problem now?
 
Last edited by a moderator:
Status
Not open for further replies.
Top