Jump to content
Sign in to follow this  
FapFap

Get Ship ID ERROR

Recommended Posts

13 hours ago, FapFap said:

Im having this errors at log/log/getshipid_err.txt:

err.png.793d863a3f4ae29e38a6bfaa50b49772.png

It keeps spamming alot in each sec

that means that a function is calling this function each second (or a lot of times a second),

 

try to search ur files for TurnToShip and see what function is triggering this function

(example would be cha_timer)

 

the log appears because x_role in this function is nil based on some function that is running it.

 

it probably happens because you are using TurnToShip (role) function on something that doesnt require the character to be in a ship (so GetCtrlBoat is nil) and returning this message.

Share this post


Link to post
Share on other sites

@Inuarashi this is the function on function.lua:

function TurnToShip ( role ) 
	local x_role = role 
	if ChaIsBoat ( role ) == 0 then 
		x_role = GetCtrlBoat ( role ) 
		if x_role == nil then 
			LG ( "getshipid_err" , " get a nil shipid " ) 
		end 
	end 
	return x_role 
end 

and this is the hook-timer:
 

-- Ship Fuel Fixed
function ResumeFuel(cha)
	cha = TurnToShip(cha);
	if(ChaIsBoat(cha) == 1)then
		local boat = TurnToShip(cha)
		local fuel,mxfuel,fuelrec = GetChaAttr(boat, ATTR_SP),GetChaAttr(boat, ATTR_MXSP),GetChaAttr(boat, ATTR_SREC) 
		local dura,mxdura,durarec = GetChaAttr(boat, ATTR_HP),GetChaAttr(boat, ATTR_MXHP),GetChaAttr(boat, ATTR_HREC)
		if(fuel <= 0)then
			if(dura > 0)then
				SystemNotice(boat, 'No more fuel! ['..GetChaDefaultName(boat)..'] is slowly getting damaged.')
				durarec = durarec - 0.025 * mxdura
				dura = math.min(mxdura, dura + durarec)
				SetCharaAttr(dura, boat, ATTR_HP)
			end
			if(dura <= 0)then
				return
			end
		else
			fuel = math.max(0, fuel - fuelrec)
			SetCharaAttr(fuel, boat, ATTR_SP)
		end
	end
end

ResumeHook = Resume
Resume = function(role)
	ResumeHook(role)
	ResumeFuel(role)
end

 

Share this post


Link to post
Share on other sites

@FapFap

what are you trying to do with this script? o.o

 

anyways, try this, might work.

 

function ResumeFuel(cha)
	local Cha_Boat = ChaIsBoat(cha)

		if Cha_Boat ~= 1 then 
			return
		end

	local boat = TurnToShip(cha)

		local fuel,mxfuel,fuelrec = GetChaAttr(boat, ATTR_SP),GetChaAttr(boat, ATTR_MXSP),GetChaAttr(boat, ATTR_SREC) 
		local dura,mxdura,durarec = GetChaAttr(boat, ATTR_HP),GetChaAttr(boat, ATTR_MXHP),GetChaAttr(boat, ATTR_HREC)
		if(fuel <= 0)then
			if(dura > 0)then
				SystemNotice(boat, 'No more fuel! ['..GetChaDefaultName(boat)..'] is slowly getting damaged.')
				durarec = durarec - 0.025 * mxdura
				dura = math.min(mxdura, dura + durarec)
				SetCharaAttr(dura, boat, ATTR_HP)
			end
			if(dura <= 0)then
				return
			end
		else
			fuel = math.max(0, fuel - fuelrec)
			SetCharaAttr(fuel, boat, ATTR_SP)
		end
	end
end

ResumeHook = Resume

Resume = function(role)
	ResumeHook(role)
	ResumeFuel(role)
end

 

Edited by Inuarashi

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...