of     2   
chevron_rightchevron_rightchevron_right

Syntropy
#188701152Saturday, May 07, 2016 2:24 AM GMT

I can program this easy, but not efficiently. I want for every person after the first person to add 6 to a value and remove 6 when every people other than the last to subtract 6.
ReallyExpensive
#188701306Saturday, May 07, 2016 2:27 AM GMT

Show me what code you have done that isn't efficient, I'll try to make it more efficient R$2,182 lol im poor
Syntropy
#188702511Saturday, May 07, 2016 2:50 AM GMT

I haven't yet so I'll just do it live. [Edit] Well it was harder than I thought... And I feel like it wouldn't work. v={} v[1]=0 v[2]=6 v[3]=12 --etc. v2=10 --Value to add or subtract v3=0 -- Amount being added or subtracted np = game.Players.NumPlayers np.Changed:connect(function(nn) for i, v in ipairs(v) do v3=v[nn] if nn > np then v2 = v2+v3 else v2 = v2-v3 end end end)
TimeTicks
#188702792Saturday, May 07, 2016 2:55 AM GMT

uh wtf are you trying to do?
Syntropy
#188702999Saturday, May 07, 2016 2:59 AM GMT

Recreating COD zombies. In COD for every extra player is 6 extra zombies. People come and go a lot on so I need to also need to subtract 6. As far as what I scripted don't ask me because I don't know either lol.
SoapyDishy
#188703139Saturday, May 07, 2016 3:01 AM GMT

What the hell???? Do you mean: 1.GetPlayers 2.get NumPlayers 3. Multiply NumPlayers * 6 4. Plug that into a for loop to poop out the zombies 5. Repeat constantly if a character leaves the game
TimeTicks
#188703231Saturday, May 07, 2016 3:03 AM GMT

number of zombies = game.players.numplayers * 6 is it that hard
SoapyDishy
#188703257Saturday, May 07, 2016 3:04 AM GMT

Lel Ikr... It's truly common sense
Syntropy
#188703355Saturday, May 07, 2016 3:05 AM GMT

Number 1 is unnecessary right? that would work if 1 * 6 = 0. I guess I could make an if statement to subtract one, but is there not an answer yet?
SoapyDishy
#188703484Saturday, May 07, 2016 3:07 AM GMT

Anyways, time ticks, may I ask that how would you remove the zombies within the game if people leave? If you do a count each round and make the amount of zombies stay the same for a round, then the question is answered. But if you keep checking repetitively, even while a round occurs, wouldn't it be complicated to remove zombies if a player leaves mid-round?
Syntropy
#188703537Saturday, May 07, 2016 3:08 AM GMT

The second player in the game adds 6. The first player adds nothing. Its making sense now that I could just start the value 6 low or something to that effect, but what if I couldn't? Just trying to learn something here. Is there a way I can keep 1 active player adding 0?
SoapyDishy
#188703604Saturday, May 07, 2016 3:09 AM GMT

You can learn more from the wiki. Obviously you don't know the simple stuff of scripting
cntkillme
#188703641Saturday, May 07, 2016 3:10 AM GMT

Keeping it linear actually might make it to easy, so instead of multiplying it by 6 you should do something more than that (maybe 3^numplrs + 3 or something)
SoapyDishy
#188703694Saturday, May 07, 2016 3:11 AM GMT

If anything, I think the relationship should be exponential. The more zombies, the fun XD
Syntropy
#188703858Saturday, May 07, 2016 3:14 AM GMT

I have a function named StartNewRound. Self-explanatory. If a character leaves mid-round then just like COD the extra zombies will just stay for the round. But when the StartNewRound function is called I want those bonus zombies taken out of algorithm. The simple answer is to start lower or subtract when there is only one player. But is there a way I can keep 1 player not adding to the number of zombies?
cntkillme
#188703890Saturday, May 07, 2016 3:14 AM GMT

3^x is an awful idea don't listen to me, it gets way too extreme. Maybe 2^(x+1) or something
Syntropy
#188704102Saturday, May 07, 2016 3:18 AM GMT

You can see my join date. I haven't programmed since I was a kid and I'm 19 now. So I'm sorry. This is mostly what would be the thought process of creating a pattern, but excluding one number.
Syntropy
#188704211Saturday, May 07, 2016 3:20 AM GMT

Flux that would still keep it linear, but not a bad idea.
SoapyDishy
#188704277Saturday, May 07, 2016 3:21 AM GMT

The simple answer is every round you clean up the map of zombies, and do the math to get the new total of zombies, then repeat for each round. If you have one player, you can make an algorithm like: math.pow(6,numberOfPlayers - 1) that would make it If there's one player, there's 1 zombie 2 players: 6 zombies 3 players: 36 zombies 4 players: 36*6 zombies 5 players: 36*36 zombies As you can see exponential relationships grow fast, which is why you should put like max 5 players in a server if you do this way. But this way will guarantee like one zombie if there's one player, which I think you are asking for.
cntkillme
#188704417Saturday, May 07, 2016 3:24 AM GMT

Syntropy do you know what linear means?
SoapyDishy
#188704455Saturday, May 07, 2016 3:24 AM GMT

Flux I don't think this guys an idiot, he's 19
Syntropy
#188704507Saturday, May 07, 2016 3:25 AM GMT

I found the simple answer already with the help of you guys. Now I'm asking how to do create a pattern and exclude one number. For a learning experience.
SoapyDishy
#188704661Saturday, May 07, 2016 3:28 AM GMT

Use an if-statement. Done
cntkillme
#188704664Saturday, May 07, 2016 3:28 AM GMT

Soapy you sure about that? 2^(x+1) is not linear, it's exponential
SoapyDishy
#188704743Saturday, May 07, 2016 3:30 AM GMT

@Flux, I just read that.... Lol yeah you're right, he doesn't know 7th grade math

    of     2   
chevron_rightchevron_rightchevron_right