05-07-2013, 02:39 AM
no each entity in the server has a unique ID. that way you can separate them.
Check if there are mobs alive
|
05-07-2013, 02:39 AM
no each entity in the server has a unique ID. that way you can separate them.
05-07-2013, 02:41 AM
Yes. A number that uniquely identifies the mob throughout its life. It's used for networking and it's also used if you need to "remember" an entity between different callbacks in the plugin (you cannot store the entity object!)
What's wrong with this?
function HandleCheckCommand( Player ) local EachEntity = function( Entity ) if Entity:IsMob() == true then Mobs = Mobs + 1 end end local loopPlayer = function ( Player ) Player:SendMessage( "Killed " .. Mobs .. " mobs." ) return true end endIt gives me Unknown command
05-07-2013, 05:03 AM
do "return true" before the last end
Currently your code does nothing. You declare two local functions, but never use them.
Also, don't compare boolean vars to constants, use them directly. And last but not least, the code won't do what you want - supposing you fix everything, the first function will count all the *living* mobs. function HandleCheckCommand(Player) local CountIfMob = function(Entity) if Entity:IsMob() then Mobs = Mobs + 1; end end Player:GetWorld():ForEachEntity(CountIfMob); Player:SendMessage("There are currently " .. Mobs .. " mobs." ); return true; end
05-07-2013, 06:36 AM
05-08-2013, 05:26 AM
It gives me an error with GetWorld
05-08-2013, 05:31 AM
It's broken
05-08-2013, 05:34 AM
05-08-2013, 06:13 AM
What else can I tell you? You didn't say what the error was, you didn't post your code, nothing. So there's really nothing else I can say.
|
« Next Oldest | Next Newest »
|