naf4ever
Mar 30, 2006, 12:44 PM
I keep getting this error when trying:
http://www.naf.cc/civ4/cerror.jpg
Though it should be noted the function still works exactly like it should and kills the unit just like i want and if your not in debug mode you wont see or be aware of that error in the first place. So should i even worry about it or can i correct this? This is what ive been using to kill units:
pUnit.kill(False, 0)
EDIT: Nevermind i think i got it
The Great Apple
Mar 30, 2006, 12:52 PM
I hate those errors.
According the the API the second arguament should be the player ID of the unit. May be your problem.
Alternatively you could use pUnit.doCommand(CommandTypes.COMMAND_DELETE, 1, 1) which should work.
surt
Mar 30, 2006, 12:53 PM
pUnit.kill(False, 0)
EDIT: Nevermind i think i got it
What was the solution, you should post so someone who does a search can find the right answer?
TheLopez
Mar 30, 2006, 01:13 PM
What was the solution, you should post so someone who does a search can find the right answer?
From: http://www.sthurlow.com/cvDocs/cvDoc/CyUnit.htm
kill(...) - void (bool bDelay, int /*PlayerTypes*/ ePlayer)
But, I found that pUnit.kill(false, PlayerTypes.NO_PLAYER) works the best.
naf4ever
Mar 30, 2006, 02:42 PM
What was the solution, you should post so someone who does a search can find the right answer?
Sorry,,, my problem was i had the command under some loop so that it was getting executed a million times, but on the same unit. Guess the computer doesnt like that. I moved it out of the loop and it works fine now!
RogerBacon
Mar 30, 2006, 03:13 PM
kill(...) - void (bool bDelay, int /*PlayerTypes*/ ePlayer)
But, I found that pUnit.kill(false, PlayerTypes.NO_PLAYER) works the best.
That's strange because I use pUnit.kill(0,0) and it always kills the unit even if it doesn't belong to player 0.
Roger Bacon
TheLopez
Mar 30, 2006, 04:41 PM
Yes that works too, internally though I think it will log all of the manual, scripted kills to player 0.