Data Realms Fan Forums http://45.55.195.193/ |
|
MovableMan:AddParticle Problem/Pie Menu Question http://45.55.195.193/viewtopic.php?f=73&t=36806 |
Page 1 of 1 |
Author: | kungfuchan13 [ Wed Dec 12, 2012 9:15 pm ] |
Post subject: | 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. |
Author: | CaveCricket48 [ Wed Dec 12, 2012 9:40 pm ] |
Post subject: | 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? |
Author: | kungfuchan13 [ Wed Dec 12, 2012 10:34 pm ] |
Post subject: | 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! |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |