The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Random Exploding Barrel
overscore Offline
Junior Member

Posts: 10
Threads: 1
Joined: Apr 2012
Reputation: 1
#1
Random Exploding Barrel

void badbarrel(string &in asEntity)
{    
int iBarrel = RandInt(1, 3);    
if(iBarrel == 3)    
{    
SetPropHealth("badbarrel", 0);    
}
}


This is the code I have now that has a 1 in 3 chance of the barrel exploding when the player picks it up.

The thing is once it has chosen the random number it may not blow up until you load the map again.

I want it to choose a random number every time the barrel is picked up and check if int == 3 to see if it should explode.

What am I missing here? A For loop?
(This post was last modified: 04-23-2012, 11:29 PM by overscore.)
04-23-2012, 11:29 PM
Find


Messages In This Thread
Random Exploding Barrel - by overscore - 04-23-2012, 11:29 PM
RE: Random Exploding Barrel - by DRedshot - 04-24-2012, 12:12 AM
RE: Random Exploding Barrel - by overscore - 04-24-2012, 12:58 AM



Users browsing this thread: 1 Guest(s)