View unanswered posts | View active topics It is currently Fri Dec 27, 2024 9:01 am



Reply to topic  [ 32 posts ]  Go to page Previous  1, 2, 3
 I need help with a script I am making 
Author Message
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: I need help with a script I am making
I would assume self.maxlazerlength = 500;


Wed Jan 20, 2010 5:50 am
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: I need help with a script I am making
Edit: Here.

Code:
function Create(self)
   self.mapwrapx = SceneMan.SceneWrapsX;
   self.maxlazerlength = 500;
   self.particlespacing = 10;
   self.parspeed = 10 -- SPEED OF PARTICLE HERE
   self.weaponname = "Justice";

   local curdist = 50;
   for i = 1,MovableMan:GetMOIDCount()-1 do
      gun = MovableMan:GetMOFromID(i);
    if gun.PresetName == self.weaponname and gun.ClassName == "HDFirearm" and (gun.Pos-self.Pos).Magnitude < curdist then
      actor = MovableMan:GetMOFromID(gun.RootID);
     if MovableMan:IsActor(actor) then
   self.parent = ToActor(actor);
   self.parentgun = ToHDFirearm(gun);

   local terrcheck = Vector(0,0);
   local terrainray = SceneMan:CastStrengthRay(self.parentgun.MuzzlePos,Vector(i*10,0):RadRotate(self.parent:GetAimAngle(true)),0,terrcheck,4,0,true)
      if terrainray == true then
   self.lazerlength = math.floor(SceneMan:ShortestDistance(self.parentgun.MuzzlePos,terrcheck,self.mapwrapx).Magnitude/self.particlespacing)
      else
   self.lazerlength = math.floor(self.maxlazerlength/self.particlespacing);
      end

      for i = 1, self.lazerlength do
   self.lazerpar = CreateMOPixel("Justice Shot"); -- CHANGE THIS TO YOUR PARTICLE
   self.lazerpar.Pos = self.parentgun.MuzzlePos + Vector(i*self.particlespacing,0):RadRotate(self.parent:GetAimAngle(true));
   self.lazerpar.Vel = Vector(self.parspeed,0):RadRotate(self.parent:GetAimAngle(true));
   MovableMan:AddParticle(self.lazerpar);
      end

     end
    end
   end

end


self.maxlazerlength and self.particlespacing in the create funtion are the things to change.


Wed Jan 20, 2010 5:52 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 32 posts ]  Go to page Previous  1, 2, 3

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.135s | 13 Queries | GZIP : Off ]