• 🏆 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!

[General] Quick Simple Loop interger question

Status
Not open for further replies.
Level 7
Joined
Nov 6, 2019
Messages
186
Quick question, to check before I set up

I plan to set up a Loop Int A that will be updating 36 custom UI Text Boxes ever second fir 7 players total

Be using

Set LoopPlayer to Player ID Of Loop A
Set Loop String to Players Current ScoreInt get ID loop A
Change text of custom ui ID1 to loop string
Set loop string
Change text ID2

I am not at pc so I can’t get exactly trigger text but basically it gonna update a text box to that players score for 36 text boxes, different score per time so one is gold, second lumber 3rd copper changing the sane string 36 times per loop and loop 7 times

Wanna know if that is safe dunno if it will crash map or anything

Unsure if they be leaks or if it can update 36 things 7 times a second

1. set PlayerID to PlayerID [Loop a]
2. Set PlayerString to Players Current Copper [Loop a]
3. Set Text1 to PlayerString
4. Set PlayerString to Players Current Silver [Loop A]
5. Set Text2 To PlayerString

So on for 36 Custom Reagents
 

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,641
That sounds like it'd be fine, there's no String related leaks that you can actually do anything about.

I would use a Player Group instead of a For Loop if your game can have a variable number of players since some may have left the game or may not be playing from the start. You would remove unwanted Players from the Player Group so it only ever contains active players, for instance when someone leaves the game.
 
Level 7
Joined
Nov 6, 2019
Messages
186
But doing that if player 4 leaves the game and removes from group so loop be from 1 to PlayerGroup

So it be 6 ID and when it updates players Storage it be doing 1 to 6 ID player number so it wouldn’t update Player 7 Storage then as there ID 7
 

Uncle

Warcraft Moderator
Level 65
Joined
Aug 10, 2018
Messages
6,641
If you want to update leavers/unused player slots then go for it, maybe that's something you'd want, I just figured I'd suggest the more efficient option in most cases. You can still do that with Player Groups as well, just have multiple Player Groups, one for everyone regardless of player state, one for only active users, etc...
 
Status
Not open for further replies.
Top