Data Realms Fan Forums http://868000.nnhp.asia/ |
|
Can't Find Pointers, etc. http://868000.nnhp.asia/viewtopic.php?f=73&t=31352 |
Page 1 of 1 |
Author: | kungfuchan13 [ Tue Jun 26, 2012 9:53 pm ] |
Post subject: | Can't Find Pointers, etc. |
I have a piece of code, and it... Completely fills the console with errors. The first error it makes is for the ToActor function. It says something about a "simple conversion" thing... Next is that it makes my timer, HTT, nil. Then it can't use the GetController function, so it says that I'm trying to index a nil variable. Which I am. Code: Code: function Create(self) self.owner = ToActor(MovableMan:GetMOFromID(self.RootID)) self.ParCon = self.owner:GetController() self.spell = {} self.spell[0] = "Bunnyerified" self.spell[1] = "Bunny Cannon" self.Gauge = CreateMOSRotating("Mana Gauge","Mahou.rte") self.totspl = 1 self.numref = 0 self.HTT = Timer() self.Gauge.PosX = self.target.PosX self.Gauge.PosY = self.target.PosY - 100 MovableMan:AddParticle(self.Gauge) end function Update(self) if self.ParCon:IsState(10) then if self.HTT:IsPastSimMS(100) then self.HTT:Reset() end end if self.ParCon:IsState(10) then if not self.HTT:IsPastSimMS(100) then if self.numref < totspl then self.numref = self.numref + 1 self.SetNextMagazineName(spell[numref]) self.con:SetState(15) else self.numref = 0 self.SetNextMagazineName(spell[numref]) self.con:SetState(15) end end end end |
Author: | TheLastBanana [ Tue Jun 26, 2012 10:01 pm ] |
Post subject: | Re: Can't Find Pointers, etc. |
The problem is that you're assuming the gun is held when Create is called. If it isn't, self.RootID will be the weapon's ID, and you can't convert a gun into an actor. All the other errors will probably be solved if you implement a check and move the code that finds to the owner to the Update function. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |