SS2 QBR Breaker

1 Guest is here.
6649f5ba1870c
voodoo47Quote
yaaay.

also, random is not that trivial to do.
6649f5ba18865
ZylonBaneQuote
Squirrel. Trivial to do.
6649f5ba18934
voodoo47Quote
if you know squirrel.
6649f5ba18c5a
ZylonBaneQuote
Bam!

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);
   }
}
6649f5ba18d63
voodoo47Quote
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?
Reply

Legal stuff

Privacy Policy & Terms of Service Contact