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

[Trigger] Facing Angles

Status
Not open for further replies.
Level 3
Joined
Apr 18, 2011
Messages
23
:witch_doc_sad:

So I need a trigger that works where you type -angle [X]
and the unit that is selected faces that angle
I know how to do part of this,
but can someone help me with the rest?

Here is what I have so far:
2upehcz.png


For the red part i need:
[unit that triggering player has selected]
and for the blue part:
[selected unit is owned by triggering player]

There is probably some other stuff that needs to be added too
 
Level 3
Joined
Mar 20, 2011
Messages
35
ok try this out I dont know if you wanted to make all units the player has selected face the angle but thats what ive gone on, and i dont know if you wanted all the players to have this ability but if not just remove them from the event.

  • Angle facing
    • 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
    • Conditions
    • Actions
      • Set Angle_Units = (Units currently selected by (Triggering player))
      • Unit Group - Pick every unit in Angle_Units 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
 
Level 3
Joined
Apr 18, 2011
Messages
23
Although 1 thing, where is 'real' from (real((Substring((entered chat string)...

EDIT: of course I found it right after I post...
 
Your trigger leaks group, and btw you do not need to set group here:

  • Actions
    • Custom script: set bj_wantDestroyGroup = true
    • 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
 
It would be more efficient in Jass though in case you're interested ;)
You don't need JNGP for this:

JASS:
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
 
Last edited:
Level 3
Joined
Apr 18, 2011
Messages
23
ok so I tested the trigger, and at first it worked :) but then I realised two problems...
1) all the units you had selected before rotate with it
2) it doesn't work on buildings which is an important part to it

@magtheridon does that work for buildings?
 
It is, look here for my mini-system here, click first map.
It can be improved a bit, but I was in hurry so efficency ins't perfect.

stop abusing bugs o_O
anyway it won't work with SetUnitFacing and your system is useless since adding a single ability has the same effect without affecting attacks
though this will probably work for what TheDestroyer is looking for
 
D4RK_G4NDALF you must have serious problems with reading. Linking me post for what sake? You didn't understood what've said there?
I just clarified that I had no idea that you can face towers via root, because I've never needed to do such things, and thats why I experimented and created small trigger which do what he has to do. It is good alternative after all.

Make up your midn and what I've said I repeat: don't be so ignorant, there are other words to discribe that something is not perfect.
 
Status
Not open for further replies.
Top