Page 3 of 3

Re: spawner/spawning problem

Posted: Thu Nov 29, 2012 3:07 am
by Komag
don't forget the () in the function name

Code: Select all

function specialPatrolRemove()
   special_skeleton_warrior_1:destroy()
   special_skeleton_warrior_2:destroy()
   special_skeleton_warrior_2:destroy()
   special_skeleton_warrior_4:destroy()
end

Re: spawner/spawning problem

Posted: Thu Nov 29, 2012 3:09 am
by Neikun
Ahh typos, how many hairs I've lost to you~

Re: spawner/spawning problem

Posted: Thu Nov 29, 2012 3:11 am
by Komag
if they are the only ones of that type on the entire level, you could do something like: (for level in example)

Code: Select all

function killThem()
  for i in allEntities(1) do
    if i.name == "special_skeleton_warrior" then
       i:destroy()
    end
  end
end

Re: spawner/spawning problem

Posted: Thu Nov 29, 2012 3:12 am
by SpiderFighter
Komag wrote:don't forget the () in the function name

Code: Select all

function specialPatrolRemove()
   special_skeleton_warrior_1:destroy()
   special_skeleton_warrior_2:destroy()
   special_skeleton_warrior_2:destroy()
   special_skeleton_warrior_4:destroy()
end
Yes, I have that; sorry. Was typing in here too fast. :) It still won't work, because the game doesn't recognize a patrol as a single entity, so there's no way that I can tell to refer to it in a script. Had I known that prior to starting this map, I would have made the focus something else.

I still have to believe there's a way to do it though.

Re: spawner/spawning problem

Posted: Thu Nov 29, 2012 3:14 am
by SpiderFighter
Komag wrote:if they are the only ones of that type on the entire level, you could do something like: (for level in example)

Code: Select all

function killThem()
  for i in allEntities(1) do
    if i.name == "special_skeleton_warrior" then
       i:destroy()
    end
  end
end
Hmm...lemme give that a try. If anything should work, that's it.

[EDIT:]Ok..that was unexpected. It didn't crash this time, but it didn't remove them, either.
[EDIT to my edit:] Hold the phone. The second time it worked. Very strange.
[EDIT ^3] Ok, it seems to be stable now, but it's now telling me that addIten is a nil value, on a line of script that worked before all this craziness started. Something is tweaking this map. I think the assets are all ok but, regardless, you've made me stop ripping my hair out, Komag. Thank you so much.

Re: spawner/spawning problem

Posted: Thu Nov 29, 2012 11:56 am
by Komag
hunting down and solving issues is always a big challenge, especially with programming stuff that is so non-physical

Re: spawner/spawning problem

Posted: Thu Nov 29, 2012 1:25 pm
by SpiderFighter
Komag wrote:hunting down and solving issues is always a big challenge, especially with programming stuff that is so non-physical
Yeah, especially when there is no reason for the error. It absolutely will not let me use addItem to any skelly patrol now. I've called it properly, I've spawned other things in the same room using it, I've copied and pasted it from another map I've did...nothing works. Weird, but I've accepted and moved on.

Thanks again for that code; the switch happens so beautifully now, they don't even miss a footstep. :)

Re: spawner/spawning problem

Posted: Thu Nov 29, 2012 2:37 pm
by Komag
you are trying to addItem to the patrol? I think you would have to do addItem to each skeleton separately, or is that what you are already trying to do and it's not working?

Re: spawner/spawning problem

Posted: Thu Nov 29, 2012 3:31 pm
by SpiderFighter
Komag wrote:you are trying to addItem to the patrol? I think you would have to do addItem to each skeleton separately, or is that what you are already trying to do and it's not working?
I was going to say it worked perfectly before the switch-off between patrols started to work, but now that I think about it, it may have been a warrior that was holding the key.