• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

VARIABLES PLEASE

Status
Not open for further replies.
Level 4
Joined
Oct 23, 2006
Messages
65
Ok, I'm trying to make an equation for my map (which is uber secret, but you will find out about soon). I have tomes which spawn in the middle every x seconds by having a trigger set a variable between 1 and 3 and selecting a random tome and placing it randomly in the region (this is designed to lure players into the center more). I want to make a formula so that x is scaled according to how many players are in the game (more players = faster tome spawn). When I go to do this in the 'Time - Every x seconds, I cannot seem to use my variable PlayersInGame (interger) in the equation in any way. I tried converting it to real, but couldn't get it to show up there either.

Code:
Init
    Events
        Map initialization
    Conditions
    Actions
        Set PlayersInGame = (Number of players in (All players))

Code:
TomeSpawn
    Events
        Time - Every X seconds of game time
    Conditions
    Actions
        Set WhatTome = (Random integer number between 1 and 3)
        If (WhatTome Equal to 1) then do (Item - Create Tome of Agility at (Random point in TheBowl <gen>)) else do (Do nothing)
        If (WhatTome Equal to 2) then do (Item - Create Tome of Intelligence at (Random point in TheBowl <gen>)) else do (Do nothing)
        If (WhatTome Equal to 3) then do (Item - Create Tome of Strength at (Random point in TheBowl <gen>)) else do (Do nothing)

BTW: If anyone can quickly whip up a formula that spawns tomes at a minimum rate of 1 tome per 45 seconds with 12 players to a maximum of 1 tome per 75 seconds with 1 player (if you can make this two player, you get a cookie, that'd be awesome).

I kind of figured out a formula.
X = 45 + (3 x [PlayersInGame - 2]) Oops, that's backwards.

X = 75 - (3 x [PlayersInGame - 2])
 
Level 4
Joined
Oct 23, 2006
Messages
65
low-life said:
Actually 75-(players-1)*(75-45)/11

Post deleted.

Ok, so I figured everything else out except your equation. Here's what I get.

75 - ( players - 1 ) * ( 2.73 )

1: 75
2: 72.27 (72)
3: 69.54 (70)
4: 66.81 (67)
5: 64.08 (64)
6: 61.35 (61)
7: 58.62 (59)
8: 55.89 (56)
9: 53.61 (54)
10: 50.43 (50)
11: 47.7 (48|)
12: 44.97 (45)

75 - (3 x [players - 2])

1: 78
2: 75
3: 72
4: 69
5: 66
6: 63
7: 60
8: 57
9: 54
10: 51
11: 48
12: 45

Ah, ha! Now I see why you suggested that. However, note that there will never be only one player. I now see my mistake was in my original question, sorry, and thanks though!
 
Status
Not open for further replies.
Top