Getting boolean...shouldn't it be string or number
3 replies



06.07.11 04:44:41 am
Alright so im trying to do something will either...player...or...entity...and it keeps giving me comparing a number to boolean...or string to boolean..and i was wondering how this is a boolean...From information ive collected...boolean is true...or false...atleast thats how its suppose to be...Here is my coding...
Ignore the HasSpawnedNPCS = 1...im using it to make sure they only spawn once...ok so....as you see..this is randomly generating 30 npcs at random locations and a random rotation on a 50X50 map...but the msg...it is saying it a boolean...its saying that entity(Spawnx,Spawny,'type') is a boolean and it also says entity(Spawnx,Spawny,'name') is a boolean..and just about everything else..ive ran into this error before with the player(id,'something')...can anyone give me some information how this is boolean and how to fix it?
Ignore the HasSpawnedNPCS = 1...im using it to make sure they only spawn once...ok so....as you see..this is randomly generating 30 npcs at random locations and a random rotation on a 50X50 map...but the msg...it is saying it a boolean...its saying that entity(Spawnx,Spawny,'type') is a boolean and it also says entity(Spawnx,Spawny,'name') is a boolean..and just about everything else..ive ran into this error before with the player(id,'something')...can anyone give me some information how this is boolean and how to fix it?
NPCs are dynamic objects, not entities. Probably that's your problem.
I code, therefore I exist. | Visit my blog for Lua tips and other interesting info
When entities don't exist they return false, NPCs are not entities, however they are in the map editor--but it would be a pain to put NPC entities over the map.
Add the "HasSpawnedNPCs" thing after the for loop, it will save you some CPU cycles. Also, looking into using a boolean for said variable as Lua's VM will use less memory ( 1 bit instead of 4 or 8 bytes, fair difference ).



