Jump to content
Sign in to follow this  
FapFap

CheckMonsterDead

Recommended Posts

I'm having a error at lua_err spamming almost all the time when dw gets on, im using a dw boss checker if dw boss 1 is dead then you be able to go to dw 2 and im having this error at lua_err (but script works fine) it's just this error that keeps spamming:

lua_err.txt:
1234.png.a284e24466830790f5955a88ede8adbc.png

Function.lua:
123.png.38fba8cb08209f43efac160493ad8dc6.png

Share this post


Link to post
Share on other sites

Check that role is a valid descriptor of monster. Show your script where you use the CheckMonsterDead function.


Share this post


Link to post
Share on other sites
12 hours ago, V3ct0r said:

Check that role is a valid descriptor of monster. Show your script where you use the CheckMonsterDead function.

I use the script on ctrl.lua at map files to make a check for dw boss, the script works fine but i only getting those errors spamming lua_err.txt
123452.png.e6466d5e6f03f44bdfac47efca0ad895.png

Share this post


Link to post
Share on other sites
14 hours ago, Stinger said:

Use this:


function CheckMonsterDead(role)
  
  if (Hp(role) == nil or Hp(role) <= 0) then -- First of all, always check nil.
    	return 1
  end
  
end

 

 

should i replace my whole function to urs?

Share this post


Link to post
Share on other sites
2 hours ago, FapFap said:

should i replace my whole function to urs?

 

the problem error is that, sometimes it happens that the value hp(role) is nil , and there is nothing to handle that, so the error comes up

 

a way to fix it is to add something to handle that situation. such as the code above.

 

if the value is nil, or the value is less than 0 , do someting, end.

 

Edited by Inuarashi

Share this post


Link to post
Share on other sites

the function is not bugged (everyone is using it). You just need to pass in a role.
And because you check if the monster is dead inside map_run, it runs every second even if sometimes your variable DWboss1 is "null".

Better you go do your actions at GetExp_New / GetExp_PKM,
if dead == DWboss1 then
  DWport1 = 1
end

and inside map_close:
DWboss1 = nil -- note the nil here (one reason why you could be getting the errors


kong.png

a2.png

Share this post


Link to post
Share on other sites

i should add this at getexp_new or getexp_pkm?

1 hour ago, KONG said:


Better you go do your actions at GetExp_New / GetExp_PKM,
if dead == DWboss1 then
  DWport1 = 1
end
 

or maybe both

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...