English Getting boolean...shouldn't it be string or number

3 replies
Goto Page
To the start Previous 1 Next To the start
Up
KaBooMa
User
Offline Off
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...

Spoiler >


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?
06.07.11 06:29:38 am
Up
EngiN33R
Moderator
Offline Off
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
06.07.11 09:31:02 am
Up
Apache uwu
User
Offline Off
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.
06.07.11 09:40:23 am
Up
DannyDeth
User
Offline Off
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 ).
To the start Previous 1 Next To the start