View unanswered posts | View active topics It is currently Mon Jul 08, 2024 5:25 pm



Reply to topic  [ 5 posts ] 
 Script: Spraying random bullet types. [Request fulfilled] 
Author Message
User avatar

Joined: Tue Apr 01, 2008 4:49 pm
Posts: 1972
Location: The Netherlands
Reply with quote
Post 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.


Last edited by Gotcha! on Wed Sep 07, 2011 5:09 pm, edited 1 time in total.



Tue Sep 06, 2011 5:17 pm
Profile
Forum Moderator
User avatar

Joined: Fri Feb 02, 2007 3:53 pm
Posts: 1896
Location: in my little gay bunker
Reply with quote
Post 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?


Tue Sep 06, 2011 5:26 pm
Profile
User avatar

Joined: Tue Apr 01, 2008 4:49 pm
Posts: 1972
Location: The Netherlands
Reply with quote
Post 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:


Tue Sep 06, 2011 5:45 pm
Profile
Forum Moderator
User avatar

Joined: Fri Feb 02, 2007 3:53 pm
Posts: 1896
Location: in my little gay bunker
Reply with quote
Post 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


Tue Sep 06, 2011 6:34 pm
Profile
User avatar

Joined: Tue Apr 01, 2008 4:49 pm
Posts: 1972
Location: The Netherlands
Reply with quote
Post Re: Script: Spraying random bullet types.
Thanks a bunch. I'll play around with it. :)


Tue Sep 06, 2011 7:50 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.035s | 13 Queries | GZIP : Off ]