Trigger help please

Rakaesa

Member
Reaction score
5
I know this trigger must be pretty simple, as it's in practically every roleplaying map (Sotdrp, XRP, BSM dnd). Its the 'fa command. You know, you say 'fa ### and the building turns to that amount of degrees. I cant figure out how to do it. I know people don't make the trigger so that it's "Player 1 red says 'fa 001" "Player 1 red says 'fa 002" And all the way up to 360. So whats the proper and short way of doing it?
 

Moridin

Snow Leopard
Reaction score
144
You use the substring function. Essentially, with the event:

Player - Player types 'fa' as a substring

You can then use the key 3, 6 to get the number inputted after the "fa".
Essentially, substring works like this. It takes a part of the total string. So let's say I put in "fa 250". If I take the substring 3, 6 it takes out the part of the string between the 3rd and the 6th positions. In this case:

1st character - f
2nd character - a
3rd character - <space>
.... and so on

Spaces are counted as characters as well. So once you get the substring, you convert it to an integer and use that instead.
 

Rakaesa

Member
Reaction score
5
Damn that's confusing, I don't think I understand it clearly..Simpler if you can, though i'll take a look at it in world editor right now. Thanks for the help btw.
 

xXGauntletXx

New Member
Reaction score
4
Actually, shouldn't you convert the substring to a real, as the facing direction is a real, not an integer?
 

Rakaesa

Member
Reaction score
5
Lol you have to explain to me how to do all of that, NEVER done it before. Sorry if i'm being a pain.
 

laxperson808

New Member
Reaction score
9
player 1 types (message) as a substring
condtions
if substing 1-6 = angle_(<--space)
actions
pick every unit seletced by triggering unit and make picked unit face (convert string to real(Entered chat string 7-9)

so if angle (7-9)
or -angle (1-7) (8-10) is typed the number after becomes there angle
angle 006
-angle 130
so on
 

Rakaesa

Member
Reaction score
5
player 1 types (message) as a substring
condtions
if substing 1-6 = angle_(<--space)
actions
pick every unit seletced by triggering unit and make picked unit face (convert string to real(Entered chat string 7-9)

So, I only have to do this once, right? Not for multiple angles or substrings? Thanks for explaining, by the way.
 

trb92

Throwing science at the wall to see what sticks
Reaction score
142
Trigger:
  • Untitled Trigger 001
    • Events
      • Player - Player 1 (Red) types a chat message containing &#039;fa as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 4)) Equal to &#039;fa
    • Actions
      • Set Group = (Units currently selected by (Triggering player)) //Anti-leak
      • Unit Group - Pick every unit in Group and do (Actions)
        • Loop - Actions
          • Unit - Make (Picked unit) face (Real((Substring((Entered chat string), 5, 7)))) over 0.00 seconds
      • Custom script: call DestroyGroup(udg_Group) //Anti-leak


This works for all angles.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top