• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Getting error in a trigger for whena player leave

Status
Not open for further replies.
Level 6
Joined
Apr 26, 2007
Messages
225
please move this tread to the right place, any moderator/admin.

I get errors about the set leaver_xp and set leaver_gold lines, but i dont know why, both variables are integrer, team1_number is integrer too.

  • Player 1
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
      • (Player 1 (Red) slot status) Equal to Has left the game
    • Actions
      • Trigger - Turn off (This trigger)
      • Game - Display to (All players) for 25.00 seconds the text: ((|cffff0000 + (Name of Player 1 (Red))) + left the game!|r?n His gold has ben split and his item droped. His xp has also ben shared.)
      • Player Group - Remove Player 1 (Red) from Team1
      • Set leaver_gold = ((Player 1 (Red) Current gold) / team1_number)
      • Player - Add leaver_gold to Player 2 (Blue) Current gold
      • Player - Add leaver_gold to Player 3 (Teal) Current gold
      • Player - Add leaver_gold to Player 4 (Purple) Current gold
      • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • Set leaver_xp = ((Hero experience of (Picked unit)) / team1_number)
      • Unit Group - Pick every unit in (Units owned by Player 2 (Blue)) and do (Actions)
        • Loop - Actions
          • Hero - Add leaver_xp experience to (Picked unit), Show level-up graphics
      • Unit Group - Pick every unit in (Units owned by Player 3 (Teal)) and do (Actions)
        • Loop - Actions
          • Hero - Add leaver_xp experience to (Picked unit), Show level-up graphics
      • Unit Group - Pick every unit in (Units owned by Player 4 (Purple)) and do (Actions)
        • Loop - Actions
          • Hero - Add leaver_xp experience to (Picked unit), Show level-up graphics
      • Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
        • Loop - Actions
          • Hero - Drop (Item carried by (Picked unit) in slot 1) from (Picked unit)
          • Hero - Drop (Item carried by (Picked unit) in slot 2) from (Picked unit)
          • Hero - Drop (Item carried by (Picked unit) in slot 3) from (Picked unit)
          • Hero - Drop (Item carried by (Picked unit) in slot 4) from (Picked unit)
          • Hero - Drop (Item carried by (Picked unit) in slot 5) from (Picked unit)
          • Hero - Drop (Item carried by (Picked unit) in slot 6) from (Picked unit)
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 1 (Red)) and do (Unit - Remove (Picked unit) from the game)
      • Leaderboard - Change the label for Player 1 (Red) in (Last created leaderboard) to |cffff0000Leaver|r
      • Set team1_number = (team1_number - 1)
      • Trigger - Run Bounty chooser <gen> (ignoring conditions)
I did not scan it for leaks yet and i think i could make this way smaller but well i wan to get it working first heh
 
Last edited:
Level 6
Joined
Apr 26, 2007
Messages
225
O my god! i posted it in map dev?! totaly sorry, ive been a lot tired these last days... i'm realy sorry i'll try not to make it happen again.:bored:
 
Level 6
Joined
Apr 26, 2007
Messages
225
The trigger IS working when i remove the following lines:
Set leaver_gold = ((Player 1 (Red) Current gold) / team1_number)

Unit Group - Pick every unit in (Units owned by Player 1 (Red)) and do (Actions)
Loop - Actions
Set leaver_xp = ((Hero experience of (Picked unit)) / team1_number)

so its not about time and i know i should make it when a player leave but when i did it i was too high and i forgot where to find it :hohum: so hum... for now its gonna be time based till i get it working and decide to fix it :wink:

could the problem be about the "/team1_number" (a player group where all team players are added, used to set bounty shared and all)

(this tread haven't been moves yet? i felt stupid making this here by mistake and now continuing it here make me feel even more stupid :eekani:)
 
Level 7
Joined
Jul 29, 2009
Messages
276
maybe there is a problam when you mess with things (units and gold) of a player that left?
and i must say your triggers could use some loops at all kinds of places.
 
Level 6
Joined
Apr 26, 2007
Messages
225
Why cant i even do:
  • Set leaver_gold = (leaver_gold + 4)
thats not normal ive done it before! when i set lifes for exemple! i already divided a variable or added into it before!

EDIT: i tried making the variable reals but it ended up the same way... By the way the error i get is: (when variavle is REAL)

Line 4520: Expected a name
set udg_leaver_xp = E_Real_Arithmetic(udg_leaver_xp, 3, 4.00)

Line 4551: expected a name
set udg_leaver_gold = E_Real_Arithmetic(I2R(GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD)), 3, 4.00)
 
Level 12
Joined
Jul 27, 2008
Messages
1,181
JASS:
    set udg_leaver_xp = E_Real_Arithmetic(udg_leaver_xp, 3, 4.00)
Err, uhhh.

Better use Custom Text
JASS:
    set udg_leaver_xp = udg_leaver_xp + 4
  //    And..
    set udg_leaver_gold = I2R(GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD)) / udg_team1_number
 
Level 6
Joined
Apr 26, 2007
Messages
225
It's actually an example because I need it divided by team1_number so I'll try using: (following logic it should be that but tell me if am wrong)

set udg_leaver_xp = udg_leaver_xp / team1_number
// And..
set udg_leaver_gold = I2R(GetPlayerState(Player(0), PLAYER_STATE_RESOURCE_GOLD)) / udg_team1_number

EDIT: i get the exact same error... But the gold worked so far. I tried
(the variable is an integrer)
Set leaver_xp = ((Hero experience of (Picked unit))
custom script: set udg_leaver_xp = I2R(leaver_xp) / udg_team1_number
 
Status
Not open for further replies.
Top