SS2 QBR Breaker
1 Guest is here.
664a0665431c7
664a0665433a8
664a06654345c
664a0665436dd
01. January 2018, 04:03:41
Bam!#13
This version spawns a random object at the object switchlinked to when frobbed.
class spawnRandom extends SqRootScript {
function OnFrobWorldEnd() {
local items = ["Mug", "Cigarettes", "Chips", "Basketball", "Soda Can"];
local item = items[floor(Data.RandFlt0to1() * items.len())];
local dest = sLink(Link.GetOne("SwitchLink", self)).dest;
if (dest) {
local obj = Object.BeginCreate(item);
Object.Teleport(obj, Object.Position(dest), Object.Facing(dest));
Physics.SetVelocity(obj, vector(Data.RandFlt0to1() * 6 - 3, Data.RandFlt0to1() * 6 - 3, 0));
Object.EndCreate(obj);
}
}
}
This version is placed directly on the object that will be spawning random objects and responds to TurnOn signals.
class spawnRandom extends SqRootScript {
function OnTurnOn() {
local items = ["Mug", "Cigarettes", "Chips", "Basketball", "Soda Can"];
local item = items[floor(Data.RandFlt0to1() * items.len())];
local obj = Object.BeginCreate(item);
Object.Teleport(obj, Object.Position(self), Object.Facing(self));
Physics.SetVelocity(obj, vector(Data.RandFlt0to1() * 6 - 3, Data.RandFlt0to1() * 6 - 3, 0));
Object.EndCreate(obj);
}
}
01. January 2018, 09:55:32
add an always spawning SpawnSFX, an Once flag, and in it goes - the idea is to spawn one random item and then stop working, as we don't want to provide the player with an endless stream of recyclable items. or do we?#14
Legal stuff
Privacy Policy & Terms of Service Contact