Data Realms Fan Forums
http://45.55.195.193/

Script: Spraying random bullet types. [Request fulfilled]
http://45.55.195.193/viewtopic.php?f=75&t=25435
Page 1 of 1

Author:  Gotcha! [ Tue Sep 06, 2011 5:17 pm ]
Post subject:  Script: Spraying random bullet types. [Request fulfilled]

Helloes,

Would it be easily possible to make a script that would allow a weapon to fire off about 20 different kinds of bullets randomly?
So a single shot could have a chance of 1 out of 20 to be 'round 1', 1/20 chance to be 'round 2' and so on.

Basically a gun that has 20 different rounds and when you fire you won't know which one you'll get.

Author:  p3lb0x [ Tue Sep 06, 2011 5:26 pm ]
Post subject:  Re: Script: Spraying random bullet types.

Couldn't you just add a luascript to the fired projectile that turned it into a random other projectile?

Author:  Gotcha! [ Tue Sep 06, 2011 5:45 pm ]
Post subject:  Re: Script: Spraying random bullet types.

If you mean me specifically, I couldn't lua myself out of a paper bag.
Made my own lua script last week. 3 lines long. :oops:

Author:  p3lb0x [ Tue Sep 06, 2011 6:34 pm ]
Post subject:  Re: Script: Spraying random bullet types.

Code:
    function Create(self)
     
            local randprojectilearray = {projectile1, projectile2, etc};
            local randprojectiletype = randprojectilearray[math.random(20)];
            local randprojectile = CreateMOSRotating(randprojectiletype);
            randprojectile.Pos = self.Pos;
            randprojectile.Vel = self.Vel;
            MovableMan:AddParticle(randprojectile);
            self.ToDelete = true;
     
    end


Here's some pseudo code, I have no idea if this would even work. Yes, I do realize that if this would work it would only be able to create MOSRotatings

Author:  Gotcha! [ Tue Sep 06, 2011 7:50 pm ]
Post subject:  Re: Script: Spraying random bullet types.

Thanks a bunch. I'll play around with it. :)

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/