whats the proper way to kill a unit?

naf4ever

Dread Lord
Joined
Feb 8, 2003
Messages
405
Location
Southeast Washington State
I keep getting this error when trying:

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:

Code:
pUnit.kill(False, 0)

EDIT: Nevermind i think i got it
 
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 said:
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!
 
TheLopez said:
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
 
Yes that works too, internally though I think it will log all of the manual, scripted kills to player 0.
 
Back
Top Bottom