View unanswered posts | View active topics It is currently Thu Dec 26, 2024 4:18 am



Reply to topic  [ 3 posts ] 
 MovableMan:AddParticle Problem/Pie Menu Question 
Author Message
User avatar

Joined: Sat Jul 23, 2011 6:15 am
Posts: 82
Reply with quote
Post MovableMan:AddParticle Problem/Pie Menu Question

Old ^



New v
So now that I've changed the code, I no longer need to find the gun or actor that shoots a bullet. Now I'm having problems with the MovableMan:AddParticle function. It's displaying the error message:
"ERROR: no overload of 'MovableManager:AddParticle' matched the arguments (MovableManager, MOPixel)
candidates are:
MovableManager:AddParticle(MovableManager o, MovableObject x)"

I found it strange since I looked at a coalition rifle script that used AddParticle, also with an MOPixel. This is my code right now:
Code:
function Create(self)
   self.Mode = 1
   self.TimeCheck = false
   self.timer = Timer()
end

function Update(self)
   if self:IsActivated() then
      if self.Mode == 1 then
         self.bullet = CreateMOPixel("TDG Bullet","Pro Defence.rte")
         self.bullet.Pos.X = self.Pos.X+(math.cos(self.RotAngle)*25)
         self.bullet.Pos.Y = self.Pos.Y+(math.sin(self.RotAngle)*-25)
         self.bullet.RotAngle = self.RotAngle
         local i = 0
         for i = 1, 10 do
            self.bullet.Vel.X = math.cos(self.RotAngle)*(math.random()*25)
            self.bullet.Vel.Y = math.sin(self.RotAngle)*(math.random()*-25)
            MovableMan:AddParticle(self.bullet)
         end
         self.timer:Reset()
         self.TimeCheck = true
      else
         self.bullet.RotAngle = self.RotAngle
         self.bullet.Vel.X = math.cos(self.RotAngle)*25
         self.bullet.Vel.Y = math.sin(self.RotAngle)*-25
         self.bullet.PinStrength = 0
      end
   end
   if self.TimeCheck == true and self.timer:IsPastSimMS(100) then
      self.bullet.PinStrength = -1
      self.TimeCheck = false
   end
end

function ModeToggle(self)
   if self.Mode == 1 then
      self.Mode = 2
   else
      self.Mode = 1
   end
end


And also is that the right way to code the pie menu things? The last function is intended to be that, but it seems that the pie menu scripts are handled in a file different from the script attached to the weapon.


Last edited by kungfuchan13 on Thu Dec 13, 2012 3:58 am, edited 1 time in total.



Wed Dec 12, 2012 9:15 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post Re: Finding the "owner" of a bullet
Have the gun spawn the bullet through a script so it tracks the bullet as soon as the bullet is created, and then handle the bullet's effects instead of the bullet itself.

Or

Have the gun's script add create a global table and create a pointer to the actor in the table, and then create the bullet and set the bullet's sharpness to the pointer position in the table. Once the bullet's script runs, it checks the spot in the table based on the bullet's sharpness, and once it grabs the pointer to the actor, clears that entry in the table.

Also, what exactly are you trying to do?


Wed Dec 12, 2012 9:40 pm
Profile
User avatar

Joined: Sat Jul 23, 2011 6:15 am
Posts: 82
Reply with quote
Post Re: Finding the "owner" of a bullet
Well... I wanted to make a gun that shot a bunch of bullets then after some time they froze. Then based on the direction the gun faces, they will move in that direction at a set speed. And yeah I got the idea from one of Asklar's questions a while back. Freeze the bullets but keep the velocity. I did want to keep the global attributes to none... Hmmm... Spawning the bullets through a script could work. But I'm making it so that the gun has two rounds. The normal would be the bullets and the other would be an activator. Although since I might want to shoot more than x amount of bullets, I could make the activator on a different setting... Okay. Thanks!


Wed Dec 12, 2012 10:34 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.048s | 14 Queries | GZIP : Off ]