View unanswered posts | View active topics It is currently Wed Dec 25, 2024 5:06 pm



Reply to topic  [ 2 posts ] 
 Can't Find Pointers, etc. 
Author Message
User avatar

Joined: Sat Jul 23, 2011 6:15 am
Posts: 82
Reply with quote
Post 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


Tue Jun 26, 2012 9:53 pm
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post 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.


Tue Jun 26, 2012 10:01 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 2 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.053s | 13 Queries | GZIP : Off ]