Something wrong with my spawnwave function?

So this is my spawnwave function:

def spawnWave(self): = True
        for i in range(self.maxZombieInThisWave):
            x = i-1
            self.zombie[x] = loader.loadModel("zombie")
            r = x/3
            rowUp = r[0]
            length = len(x)
            x[length+1] = lastDigit
            if lastDigit == 1 or 4 or 7:
                rowLeft = 1505.4
            if lastDigit == 2 or 5 or 8:
                rowLeft = 1502.9
            if lastDigit == 3 or 6 or 9:
                rowLeft == 1498.2

            if rowUp == 1:
                realRowUp = 245.3
            if rowUp == 2:
                realRowUp = 155.3
            if rowUp == 3:
                realRowUp = -14.6

            self.zombie[x].setPos((rowLeft), (realRowUp), 12)
            self.zombie[x].setPythonTag(HP, 100)
            self.zombie[x].setPythonTag(COLNODE, self.colNode[x])
            self.colNode[x] = self.zombie[x].attachNewNode(CollisionNode("z"+str(x)))
            self.colNode[x].node().addSolid(CollisionTube(self.zombie[x].getX(), self.zombie[x].getY(), self.zombie[x].getZ()+10, self.zombie[x].getX(), self.zombie[x].getY(), self.zombie[x].getZ()-10, 10))
            base.cTrav.addColidder(self.colNode[x], self.notifier)
            self.zombie[x].setPythonTag(ZDummy, self.zdummy[x])
            self.zdummy[x] = self.loader.loadModel("smiley")
            self.zombie[x].setPythonTag(next2Player, False)
            self.zombie[x].setPythonTag(justHit, False)
So, this is supposed to spawn zombies, but its just not working, and I know the function is being called ( that's what is for).

And in case you were wondering, yes I am a beginner.  A lot of people on these forums have asked me that.

Well, what is happening? Is the program crashing? Are there error messages? Is there simply no result other than “” being set to True? Have you checked the value of “self.maxZombieInThisWave”, in case it’s simply not entering the loop?

Well, I just can’t see any zombies. You don’t think anything is wrong with this? Maybe its just the placement of the zombie’s that screwing up.

Fair enough.

First, may I suggest using “print” statements to check for execution entering a particular piece of code? This should make for particularly easy and reliable checks of the path that the code takes, I think.

Hmm… Looking over the code, I do notice something: the values that you seem to be using to place your zombies are enormous, I do believe - where did you get those numbers, if I may ask?

Otherwise, I’m also inclined to check that the code is getting into your loop by placing a print statement within it, something like this:

for i in range(self.maxZombieInThisWave):
    print "Entered loop!"
    x = i-1

Finally, where are you placing the camera, and what orientation are you giving it, if any?

Yes, I know I’m entering the loop. I will also check with the zombie placement, that is easily the most difficult part of the function.

Thank you for your help.

Fair enough. If I may suggest, try creating just a single zombie, without setting its position or creating the collider. If that works, re-instate the collider, and if it still works, re-instate the position. If it’s working after that, increase the number of zombies, starting with a total of two and working up from there. That should hopefully help you to figure out where the problem lies.