Make chat -lvlup work for all players when player 1 types it in

shinjay5882

New Member
Reaction score
0
I want to make this trigger work for all player when player 1 types it in. Something to test around with bots on a normal map.
Trigger:
  • Chat Level Up
    • Events
      • Player - Player 1 (Red) types a chat message containing -lvlup as A substring
      • Player - Player 2 (Blue) types a chat message containing -lvlup as A substring
      • Player - Player 3 (Teal) types a chat message containing -lvlup as A substring
      • Player - Player 4 (Purple) types a chat message containing -lvlup as A substring
      • Player - Player 5 (Yellow) types a chat message containing -lvlup as A substring
      • Player - Player 6 (Orange) types a chat message containing -lvlup as A substring
      • Player - Player 7 (Green) types a chat message containing -lvlup as A substring
      • Player - Player 8 (Pink) types a chat message containing -lvlup as A substring
      • Player - Player 9 (Gray) types a chat message containing -lvlup as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -lvlup as A substring
      • Player - Player 11 (Dark Green) types a chat message containing -lvlup as A substring
      • Player - Player 12 (Brown) types a chat message containing -lvlup as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 7)) Equal to -lvlup
    • Actions
      • Set tempintlvlup = (Integer((Substring((Entered chat string), 8, (Length of (Entered chat string))))))
      • Set tempgrouplvlup = (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))
      • Unit Group - Pick every unit in tempgrouplvlup and do (Actions)
        • Loop - Actions
          • Hero - Set (Picked unit) Hero-level to ((Hero level of (Picked unit)) + tempintlvlup), Show level-up graphics
      • Custom script: call DestroyGroup( udg_tempgrouplvlup )
 

inevit4ble

Well-Known Member
Reaction score
38
The leveling up part of the trigger looks good. I believe its just the substrings that are not referenced properly
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
First of all the condition is not nessesary, the event already does that with "A Substring"
And you have to put in a condition if/then/else so if Player 1 is Triggering Player then pick all heroes and set their lvl to tempintlvlup
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
"-lvlup" only has 6 characters, "-lvlup " has 7. So this fails to work because the condition says a 7-character substring needs to have 6 characters.

Remove the condition, then make sure the Substring is referenced correctly: if you type "-lvlup9", then you start at 7; if you type "-lvlup 9", then you start at 8.
 

shinjay5882

New Member
Reaction score
0
Trigger:
  • Chat Level Up
    • Events
      • Player - Player 1 (Red) types a chat message containing -lvlup as A substring
      • Player - Player 2 (Blue) types a chat message containing -lvlup as A substring
      • Player - Player 3 (Teal) types a chat message containing -lvlup as A substring
      • Player - Player 4 (Purple) types a chat message containing -lvlup as A substring
      • Player - Player 5 (Yellow) types a chat message containing -lvlup as A substring
      • Player - Player 6 (Orange) types a chat message containing -lvlup as A substring
      • Player - Player 7 (Green) types a chat message containing -lvlup as A substring
      • Player - Player 8 (Pink) types a chat message containing -lvlup as A substring
      • Player - Player 9 (Gray) types a chat message containing -lvlup as A substring
      • Player - Player 10 (Light Blue) types a chat message containing -lvlup as A substring
      • Player - Player 11 (Dark Green) types a chat message containing -lvlup as A substring
      • Player - Player 12 (Brown) types a chat message containing -lvlup as A substring
    • Conditions
    • Actions
      • Set tempintlvlup = (Integer((Substring((Entered chat string), 8, (Length of (Entered chat string))))))
      • Set tempplayergroup = (All players controlled by a Computer player)
      • Set tempgrouplvlup = (Units owned by (Picked player) matching (((Matching unit) is A Hero) Equal to True))
      • If ((Triggering player) Equal to Player 1 (Red)) then do (Player Group - Pick every player in tempplayergroup and do (Unit Group - Pick every unit in tempgrouplvlup and do (Hero - Set (Picked unit) Hero-level to ((Hero level of (Picked unit)) + tempintlvlup), Show level-up graphics))) else do (Do nothing)
      • Custom script: call DestroyGroup( udg_tempplayergroup )
      • Custom script: call DestroyGroup( udg_tempgrouplvlup )


Custom script: call DestroyGroup( udg_tempplayergroup )
Custom script: call DestroyGroup( udg_tempgrouplvlup )

These two are causing script errors and I am not sure why and I just want to see if the trigger setup is correct. I had it working for player 2 at one point but now i cant get it to work for player 3 and 4. This the the current trigger so far.
 

inevit4ble

Well-Known Member
Reaction score
38
No spaces and a player group is consider a force
ie
call DestroyForce(udg_tempplayergroup)
call DestroyGroup(udg_tempgrouplvlup)
 

ZakkWylde-

New Member
Reaction score
14
Call me dumb, but without the condition, wouldnt the trigger respond to (potentially) "blah3 -lvlup ", in which case finding the 8th character wouldn't do much good... (but I guess that doesn't really matter does it...nothing weird/leaky happens when you try to set an integer to a string?)
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
No, that wouldnt be possible only after the -lvlup can anything be entered, so like -lvlup blah3 but if it is not "-lvlup" at the start its wouldnt trigger cause of the "A substring"
 

ZakkWylde-

New Member
Reaction score
14
Ah, so "a substring" checks only the first characters to match the desired string? I was unaware of this. (lol sorry for the irrelevance to the actual topic this is causing.)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top