04-30-2017, 02:58 PM
(This post was last modified: 04-30-2017, 06:15 PM by Seadragon91.)
I wrote a example that spawns a sheep and set's the speed to zero.
Register the command handler in a plugin:
Sources:
cMonster
SpawnMob
DoWithEntityByID
Register the command handler in a plugin:
Code:
cPluginManager:BindCommand("/spawnmob", "spawnmob", CommandSpawnMob, "spawns a mob")
Code:
function CommandSpawnMob(a_Split, a_Player) -- I created a command handler, that will spawn a sheep and sets the speed to 0.
local mobID = a_Player:GetWorld():SpawnMob(a_Player:GetPosX(), a_Player:GetPosY(), a_Player:GetPosZ(), mtSheep) -- Spawns a sheep at player's position
assert(mobID ~= -1, "Mob spawn failed") -- This can happen, if for example a plugin denies the spawning of monsters
a_Player:GetWorld():DoWithEntityByID(mobID,
function(Entity)
Entity:SetRelativeWalkSpeed(0)
end)
a_Player:SendMessage("Spawned sheep.")
return true
end
Sources:
cMonster
SpawnMob
DoWithEntityByID