attempting to make a plugin to spawn giants
#1
Hi,
I am new to Lua and I wanted to modify the tutorial code a bit to create a plugin to spawn giants (1.12.2). I think I got most of it down, but I am having an issue with two different parts of it. 
Console Errors:

[12:58:58] LUA: Plugins/SpawnGiants/spawngiants.lua:28: attempt to call method 'SpawnMob' (a nil value)
[12:58:58] Stack trace:
[12:58:58]  Plugins/SpawnGiants/spawngiants.lua(28): (no name)
[12:58:58]  [C](-1): FindAndDoWithPlayer
[12:58:58]  Plugins/SpawnGiants/spawngiants.lua(35): (no name)
[12:58:58] Stack trace end
[12:58:58] Error in <attached> calling function <callback>()


Code:
Code:
PLUGIN = nil function Initialize(Plugin)     Plugin:SetName("GiantSpawn")     Plugin:SetVersion(1)     -- Hooks     PLUGIN = Plugin -- NOTE: only needed if you want OnDisable() to use GetName() or something like that     -- Command Bindings     cPluginManager.BindCommand("/spawngiant", "SpawnGiants.main", SpawnGiant, " ~ Spawn a Giant at someone's location")     LOG("Initialised version " .. Plugin:GetVersion())     return true end function SpawnGiant(Split, Player)     if (#Split ~= 2) then         -- Send the proper usage to the player and exit         Player:SendMessage("Usage: /spawngiant [PlayerName]")         return true     end     local CommandSent = false     local GiantSpawnPerson = function(Giantee)         if (Giantee:GetName() == Split[2]) then             Player:SpawnMob(giant)             Player:SendMessageSuccess(Split[2] .. " has been attacked by a giant")             CommandSent = true             return true         end     end     cRoot:Get():FindandDoWithPlayer(Split[2], GiantSpawnPerson)     if not(CommandSent) then         Player:SendMessageFailure:(Split[2] .. " was not found")     end     return true end function OnDisable()     LOG("Shutting down...") end


I am new to Lua and new to programming in general. Any help would be appreciated (This is running on a raspberry pi, I am not sure if that makes any difference.)
Reply
Thanks given by:


Messages In This Thread
attempting to make a plugin to spawn giants - by Code_Blue - 07-14-2021, 03:04 AM



Users browsing this thread: 1 Guest(s)