• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Add event won't work

Status
Not open for further replies.
Level 8
Joined
Jul 29, 2010
Messages
319
DebugPlayer is a player variable, I can't get this to work, I've tested the variable in game and I know for sure that the trigger I'm using to set Debug player works, so it's not the variable, any help is greatly appreciated :D
  • Trigger - Add to setlives <gen> the event (Player - DebugPlayer types a chat message containing -setlives as A substring)
 
Level 8
Joined
Jul 29, 2010
Messages
319
Is the setlives trigger enabled/"initially on"? Only reason that wouldn't work if DebugPlayer is correct is if the trigger is unable to fire.
Yes the trigger is enabled. All this trigger is designed to do is set a variable based on the entered chat strings, so if DebugPlayer types "-setlives 1 10" then it should set the lives of player 1 to 10 and then display the number of lives that has just been set to confirm that the trigger worked, but it never displays the text. The way I tested DebugPlayer was by simply setting a trigger that displays the name of the player that it is set to at that time and it displayed the correct player. I'm quite puzzled by this.
  • setlives
    • Events
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Substring((Entered chat string), 1, 9)) Equal to -setlives
        • Then - Actions
          • Set NumberOfLives[(Integer((Substring((Entered chat string), 11, 13))))] = (Integer((Substring((Entered chat string), 15, 17))))
          • Game - Display to (All players) the text: ((Name of (Player((Integer((Substring((Entered chat string), 11, 13))))))) + ('s lives has been set to + (Substring((Entered chat string), 15, 17))))
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Substring((Entered chat string), 1, 1)) Equal to -
            • Then - Actions
              • Game - Display to (All players) the text: |c00FF7F00Unrecogni...
            • Else - Actions
 
Level 39
Joined
Feb 27, 2007
Messages
5,034
The problem is Substring(..., 11, 13). The upper bound should be 12 not 13. If you type "-setlives 1 10" the 11-13 substring is "1 1" which afaik is not going to come out as 11 from S2I and gives you an invalid player number, crashing the thread. Your 15-17 substring also needs to be 13-14 instead for the same reasons.

I realize this is a debug trigger for your testing purposes but if you try to setlives on a two-digit player number ("-setlives 13 10" for example) the substring logic will get a little funky and it might or might not work, depending on how the game engine wants to deal with a leading space in the I2S.
 
Level 8
Joined
Jul 29, 2010
Messages
319
The problem is Substring(..., 11, 13). The upper bound should be 12 not 13. If you type "-setlives 1 10" the 11-13 substring is "1 1" which afaik is not going to come out as 11 from S2I and gives you an invalid player number, crashing the thread. Your 15-17 substring also needs to be 13-14 instead for the same reasons.

I realize this is a debug trigger for your testing purposes but if you try to setlives on a two-digit player number ("-setlives 13 10" for example) the substring logic will get a little funky and it might or might not work, depending on how the game engine wants to deal with a leading space in the I2S.
Yeah i started to realise that it was my dodgy string system that was the issue when I changed up the trigger a bit, I have a debug folder in my triggers and basically I'm trying to create a system where I can view and edit almost all variables from in-game, most of this was pretty successful up until this issue, it started spitting out some really strange variables the more i tried to use it maybe I'll redo the trigger so that first you set a player variable to a particular player and then you edit the lives of whatever player that variable is set to at that time, thank you for the help :D
 
Status
Not open for further replies.
Top