settings { main { Mode Name: "Create and pickup coins" } modes { disabled Assault { Limit Roles: 2 Of Each Role Per Team } disabled Control { Limit Roles: 2 Of Each Role Per Team } disabled Escort { Limit Roles: 2 Of Each Role Per Team } disabled Hybrid { Limit Roles: 2 Of Each Role Per Team } Skirmish { enabled maps { Workshop Island } } } } variables { global: 0: orangeBolts 1: yellowBolts 2: whiteBolts 3: blueBolts 4: orangeAmount 5: yellowAmount 6: whiteAmount 7: blueAmount 8: boltSize 9: boltHeight 10: boltPickupRange player: 0: coins } rule("Setup") { event { Ongoing - Global; } actions { Create HUD Text(Local Player, Null, Null, Custom String("Coins: {0}", Local Player.coins), Left, 0, Color(White), Color(White), Color(Yellow), Visible To and String, Default Visibility); Global.orangeBolts = Empty Array; Global.yellowBolts = Empty Array; Global.whiteBolts = Empty Array; Global.blueBolts = Empty Array; Global.orangeAmount = 10; Global.yellowAmount = 5; Global.whiteAmount = 3; Global.blueAmount = 1; Global.boltSize = 0.500; Global.boltHeight = 0.500; Global.boltPickupRange = 1; } } rule("Create orange bolts") { event { Ongoing - Global; } actions { While(Count Of(Global.orangeBolts) < Global.orangeAmount); Modify Global Variable(orangeBolts, Append To Array, Vector(Random Integer(-19, 19), Global.boltHeight, Random Integer(-19, 19))); Create Effect(All Players(All Teams), Sphere, Color(Orange), Global.orangeBolts[Evaluate Once(Count Of(Global.orangeBolts) - 1)], Global.boltSize, Visible To Position and Radius); End; } } rule("Collect orange bolts") { event { Ongoing - Each Player; All; All; } conditions { Is True For Any(Global.orangeBolts, Distance Between(Current Array Element, Event Player) < Global.boltPickupRange) == True; } actions { Global.orangeBolts[Index Of Array Value(Global.orangeBolts, First Of(Sorted Array(Global.orangeBolts, Distance Between( Current Array Element, Event Player))))] = Nearest Walkable Position(Vector(Random Integer(-19, 19), Global.boltHeight, Random Integer(-19, 19))); Event Player.coins += 10; } } rule("Create yellow bolts") { event { Ongoing - Global; } actions { While(Count Of(Global.yellowBolts) < Global.yellowAmount); Modify Global Variable(yellowBolts, Append To Array, Vector(Random Integer(-19, 19), Global.boltHeight, Random Integer(-19, 19))); Create Effect(All Players(All Teams), Sphere, Color(Yellow), Global.yellowBolts[Evaluate Once(Count Of(Global.yellowBolts) - 1)], Global.boltSize, Visible To Position and Radius); End; } } rule("Collect yellow bolts") { event { Ongoing - Each Player; All; All; } conditions { Is True For Any(Global.yellowBolts, Distance Between(Current Array Element, Event Player) < Global.boltPickupRange) == True; } actions { Global.yellowBolts[Index Of Array Value(Global.yellowBolts, First Of(Sorted Array(Global.yellowBolts, Distance Between( Current Array Element, Event Player))))] = Nearest Walkable Position(Vector(Random Integer(-19, 19), Global.boltHeight, Random Integer(-19, 19))); Event Player.coins += 25; } } rule("Create white bolts") { event { Ongoing - Global; } actions { While(Count Of(Global.whiteBolts) < Global.whiteAmount); Modify Global Variable(whiteBolts, Append To Array, Vector(Random Integer(-19, 19), Global.boltHeight, Random Integer(-19, 19))); Create Effect(All Players(All Teams), Sphere, Color(White), Global.whiteBolts[Evaluate Once(Count Of(Global.whiteBolts) - 1)], Global.boltSize, Visible To Position and Radius); End; } } rule("Collect white bolts") { event { Ongoing - Each Player; All; All; } conditions { Is True For Any(Global.whiteBolts, Distance Between(Current Array Element, Event Player) < Global.boltPickupRange) == True; } actions { Global.whiteBolts[Index Of Array Value(Global.whiteBolts, First Of(Sorted Array(Global.whiteBolts, Distance Between( Current Array Element, Event Player))))] = Nearest Walkable Position(Vector(Random Integer(-19, 19), Global.boltHeight, Random Integer(-19, 19))); Event Player.coins += 50; } } rule("Create blue bolts") { event { Ongoing - Global; } actions { While(Count Of(Global.blueBolts) < Global.blueAmount); Modify Global Variable(blueBolts, Append To Array, Vector(Random Integer(-19, 19), Global.boltHeight, Random Integer(-19, 19))); Create Effect(All Players(All Teams), Sphere, Color(Blue), Global.blueBolts[Evaluate Once(Count Of(Global.blueBolts) - 1)], Global.boltSize, Visible To Position and Radius); End; } } rule("Collect blue bolts") { event { Ongoing - Each Player; All; All; } conditions { Is True For Any(Global.blueBolts, Distance Between(Current Array Element, Event Player) < Global.boltPickupRange) == True; } actions { Global.blueBolts[Index Of Array Value(Global.blueBolts, First Of(Sorted Array(Global.blueBolts, Distance Between( Current Array Element, Event Player))))] = Nearest Walkable Position(Vector(Random Integer(-19, 19), Global.boltHeight, Random Integer(-20, 20))); Event Player.coins += 100; } }