SS2 QBR Breaker

1 Guest is here.
664a02f7362f1
voodoo47Quote
yaaay.

also, random is not that trivial to do.
664a02f736425
ZylonBaneQuote
Squirrel. Trivial to do.
664a02f7364b7
voodoo47Quote
if you know squirrel.
664a02f73680a
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);
   }
}
664a02f7368ef
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