Author Topic: Randomizing models on every mount...  (Read 653 times)

How would you make a item on every mount, say you press Q and hold the item then you press Q again and de-mount then press Q yet again and mount at it, but the model has randomly switched. thanks

You would edit code for [ItemName]::onUse to change what image it uses.

A short (hacky-ish but not laggy in any way) version of the code:
Quote
function gunItem::onUse(%this,%a,%b,%c,%d,%e)
{
 %random = getRandom(0,2);
 switch(%random)
 {
  case 0:
   %this.image = gunImage;
  case 1:
   %this.image = rocketLauncherImage;
  case 2:
   %this.image = swordImage;

 }
 Parent::onUse(%this,%a,%b,%c,%d,%e);
}

When you use the gun, you get a random weapon out of the Gun, Rocket Launcher and Sword. Change the bold parts and add more case X: conditions for other weapons.