Attempt to Call Method Error

Hello all,
I am trying to create a TTT version of rocket boots but I have encounted the error below

I am not entirely sure how to fix this error and so I am asking for your help. The instance in which it is used can be found below:
[lua]function SWEP:PrimaryAttack()
self.Owner:GiveRocketBoots(math.huge)
end[/lua]
So, how could I fix this? If any more information is needed, I’ll happily supply :slight_smile:
Thanks for any help in advance!

The error message is pretty straightforward: there is no method called GiveRocketBoots. You’re going to have to define it.

So is it saying that the function ‘GiveRocketBoots’ basically does not exist? How would I refer to a function/method that is in another file?

Sounds to me like you’re getting in well over your head. Why don’t you start with something smaller?

I’m just a tad confused as to why it’s not working as it’s a global function and should be able to be called perfectly fine.

[editline]27th March 2016[/editline]

Also I don’t really wanna just give up on it. It’d be kinda like accepting defeat if you know what I mean :slight_smile:

Well here’s my take on things:

I assume Rocket Boots is some kind of gamemode or addon, and it adds a method to the Player metatable called GiveRocketBoots. But you’re not using that gamemode, you’re deriving from TTT, so the GiveRocketBoots function was never defined in the context you’re using it.

You’ll have to migrate a lot of the RocketBoots code to work with TTT. I have no idea what RocketBoots are and I’ve actually never played or experimented with TTT either, so I have no idea how difficult that might be.

If you show me what RocketBoots is, maybe I can give you a better direction :wink:

This is the addon I am using: http://steamcommunity.com/sharedfiles/filedetails/?id=237544369
I’ll paste the contents of the file that I’m trying to call the function from (lua/autorun/server/wt_rocketboots_sv.lua):
[lua]do --player meta

local PLY = FindMetaTable("Player")

function PLY:GiveRocketBoots(intTime)
	intTime = intTime or 15
	
	self._wt_RocketBootsEquipped = true
	self._wt_RocketBootsEndTime = CurTime()+intTime
	
	if not IsValid(self._wt_RocketBootsEffect) then
		local e = ents.Create("wt_rocketboots_thinker")
		e:SetPos(self:GetPos()+Vector(0,0,5))
		e:SetPlayer(self)
		e:Spawn()
		e:SetParent( self )
		self:DeleteOnRemove( e )
		self._wt_RocketBootsEffect = e
	end
	
end
function PLY:RemoveRocketBoots()
	self._wt_RocketBootsEquipped = false
	self._wt_RocketBootsEndTime = CurTime()
	
	if IsValid(self._wt_RocketBootsEffect) then
		SafeRemoveEntity(self._wt_RocketBootsEffect)
		self._wt_RocketBootsEffect = nil
	end
end

function PLY:HasRocketBoots()
	return self._wt_RocketBootsEquipped
end

hook.Add("Think", "RemoveRocketBoots", function()
	for k,v in pairs(player.GetAll()) do
		if v:HasRocketBoots() then
			if v._wt_RocketBootsEndTime<CurTime() then
				v:RemoveRocketBoots()
			end
		end
	end
end)

end

function RemoveBoots(ply)
ply:RemoveRocketBoots()
end
hook.Add( “PlayerDeath”, “RemovedBoots”, RemoveBoots )[/lua]

[editline]27th March 2016[/editline]

It may be worth noting that it does work. The function is called and the effects take place, it’s just that an error is produced in the process.