View Full Version : Check kill?
Maximum Adam
08-12-2013, 09:00 PM
Working on a script, and I'm wondering if there is a way to check if it killed a certain creature, and that it will only leave once it kills said creature. Anyone fill me in? :)
Spectrus
08-12-2013, 09:04 PM
Here's a script to go to a label when a certain monster is killed. Should give you a good starting point.
local monsterToLeave = 'demon' -- make sure it's lowercase
local labelToLeave = 'Leave'
LootMessageProxy.OnReceive('check_kill', function(proxy, message)
if string.match(message, monsterToLeave) then
Walker.Goto(labelToLeave)
end
end
Maximum Adam
08-12-2013, 09:06 PM
Here's a script to go to a label when a certain monster is killed. Should give you a good starting point.
local monsterToLeave = 'demon' -- make sure it's lowercase
local labelToLeave = 'Leave'
LootMessageProxy.OnReceive('check_kill', function(proxy, message)
if string.match(message, monsterToLeave) then
Walker.Goto(labelToLeave)
end
end
Thank you very much, could you please explain to me how this works, getting there on my scripting, but new things, I'd like to know how it works, if you would be so kind :)
Edit: also, will it leave as soon as it kills it? Or should I have a check label still?
Spectrus
08-12-2013, 09:09 PM
Here's the release thread that details how to handle message proxies: http://forums.xenobot.net/showthread.php?15628-Update-XenoBot-v3.3.0-Lua-IPC-amp-Message-Handling
Basically, creating a loot message proxy that handles messages such as 'Loot of a xxx: ...'. The message is passed to a function you create, where you can deal with it. In the function I created, it checks if the name of your monster name is in the message, if it is it makes the walker go to the designated label.
Maximum Adam
08-12-2013, 09:14 PM
Bookmarked and thank you for the quick response, also sorry for being a noob pain in the ass :D
Really going to need the message proxies for the next part of my script, working on New Frontier :D
Spectrus
08-12-2013, 09:17 PM
No problem. I believe I already have you on Skype, but if I don't then add me if you need more help. ADD (skype:spectrus_?add)
Maximum Adam
08-12-2013, 10:16 PM
No problem. I believe I already have you on Skype, but if I don't then add me if you need more help. ADD (skype:spectrus_?add)
Yes, I'm pretty sure I do :)
Thats another question I have, how do you guys get ur skype/msn to show up like that, still haven't been able to figure that out lol
Odemis
12-30-2014, 06:00 AM
This is exactly the lua code I was looking for, but it doesn't seem to work when I add it into my script. :confused:
-- Leave after Boss --
local monsterToLeave = 'demodras' -- leave bosses name lowercase
local labelToLeave = 'Leavehunt'
LootMessageProxy.OnReceive('check_kill', function(proxy, message))
if string.match(message, monsterToLeave) then
Walker.Goto(labelToLeave)
end
end
So I'm trying to make it when you receive the message after the kill saying "Your deeds have been noticed...etc..etc.." It jumps the walker waypoint to the 'leave', or 'refil' label..
PS : I even tried placing the two 'locals' with the rest of the locals at the top of my script, and placed the "LootMessageProxy~" at the bottom of the script. Idk, confusing myself. When I try to launch the whole script, it bugs out and it give's an error.
Any help would be awesome, thanks.
Odemis
12-30-2014, 01:36 PM
I think I've tried everything I know of, just can't get it to work >.< Now I'm at work with bloodshot eyes because I stayed up all night working trial and errors. Many trials, and nothing but errors lol
Odemis
12-31-2014, 05:54 PM
Could anyone help me solve this plz? xD
Possibly Spectrus ?:rolleyes:
Proteus
12-31-2014, 08:37 PM
This is exactly the lua code I was looking for, but it doesn't seem to work when I add it into my script. :confused:
-- Leave after Boss --
local monsterToLeave = 'demodras' -- leave bosses name lowercase
local labelToLeave = 'Leavehunt'
LootMessageProxy.OnReceive('check_kill', function(proxy, message))
if string.match(message, monsterToLeave) then
Walker.Goto(labelToLeave)
end
end
So I'm trying to make it when you receive the message after the kill saying "Your deeds have been noticed...etc..etc.." It jumps the walker waypoint to the 'leave', or 'refil' label..
PS : I even tried placing the two 'locals' with the rest of the locals at the top of my script, and placed the "LootMessageProxy~" at the bottom of the script. Idk, confusing myself. When I try to launch the whole script, it bugs out and it give's an error.
Any help would be awesome, thanks.
You added in an extra parenthesis at the end of message, and didn't add one at the end of the last end :)
-- Leave after Boss --
local monsterToLeave = demodras-- leave bosses name lowercase
local labelToLeave = 'Leavehunt'
LootMessageProxy.OnReceive('check_kill', function(proxy, message)
if string.match(message, monsterToLeave) then
Walker.Goto(labelToLeave)
end
end)
Odemis
12-31-2014, 08:54 PM
Proteus, thanks brother man!
Think this will work though?
Since the new loot message for bosses just mentions the "Rewards can be found in your chest" I think... I'm not positive the boss' name appears in the channel when killed..
Odemis
12-31-2014, 08:55 PM
The script is up and running so I guess I will find out eventually ><
Proteus
12-31-2014, 09:14 PM
Proteus, thanks brother man!
Think this will work though?
Since the new loot message for bosses just mentions the "Rewards can be found in your chest" I think... I'm not positive the boss' name appears in the channel when killed..
Just replace bosses name with rewards and should be fine :)
Spectrus
12-31-2014, 10:56 PM
I'm going to guess it won't work as the type of message is probably different. Look through all the available message proxies in Xeno and try the one best suitable. If none work, you're out of luck.
Odemis
12-31-2014, 11:51 PM
I'm going to guess it won't work as the type of message is probably different. Look through all the available message proxies in Xeno and try the one best suitable. If none work, you're out of luck.
Yea, did not work. I will edit it.
BattleMessageProxy.OnReceive('check_kill', function(proxy, message) if string.match(message, monsterToLeave) then
Walker.Goto(labelToLeave)
end
end)
Because the message shows in white text on server log.
Could you explain what the 'check_kill' part serves? Should I keep that as is?
Spectrus
12-31-2014, 11:52 PM
Yea, did not work. I will edit it.
BattleMessageProxy.OnReceive('check_kill', function(proxy, message) if string.match(message, monsterToLeave) then Walker.Goto(labelToLeave) endend)
Because the message shows in white text on server log.
Could you explain what the 'check_kill' part serves? Should I keep that as is?
It's a name (or key) for the proxy. Not terribly important for your purposes.
Odemis
01-01-2015, 02:15 AM
-- Leave after Boss --
local monsterToLeave = 'deeds'
local labelToLeave = 'Leavehunt'
BattleMessageProxy.OnReceive('check_kill', function(proxy, message)
if string.match(message, monsterToLeave) then
Walker.Goto(labelToLeave)
end
end)
Another fail...
Next try:
-- Leave after Boss --
local monsterToLeave = 'deeds' -- leave bosses name lowercase
local labelToLeave = 'Leavehunt'
ErrorMessageProxy.OnReceive('check_kill', function(proxy, message)
if string.match(message, monsterToLeave) then
Walker.Goto(labelToLeave)
end)
end)
Nakuu
01-01-2015, 02:30 AM
Can't you just check if such monster is on the screen? Your function even if it starts working will fail sometimes (if you get a debuff - ie. a burn) and will keep going to leave label.
Odemis
01-01-2015, 05:03 AM
Can't you just check if such monster is on the screen? Your function even if it starts working will fail sometimes (if you get a debuff - ie. a burn) and will keep going to leave label.
Which could be the problem, because I get debuff (on fire) everytime I fight it.
How would I write that? :p I can't code for shit..lol.
example:
GoToLabel if item ID of (the remains of the boss) is seen on screen
HjugO
01-01-2015, 02:22 PM
Which could be the problem, because I get debuff (on fire) everytime I fight it.
How would I write that? :p I can't code for shit..lol.
example:
GoToLabel if item ID of (the remains of the boss) is seen on screen
You can use such function.
Self.GetCreatureKills("MONSTER")
and
Self.ResetCreatureKills("MONSTER")
Fatality
01-01-2015, 03:00 PM
something like this
if Self.GetCreatureKills("BossName") > 0 then
Walker.Goto("Leave")
Self.ResetCreatureKills("BossName")
else
Walker.Goto("KillBoss")
end
Odemis
01-01-2015, 05:35 PM
It still doesn't work. When I kill the boss, it doesn't even show the boss name in the recent kill HUD, or in server messages. That's why I think if I can make it like walker go to label IF item id is seen on screen, it should work.
Odemis
01-01-2015, 08:18 PM
And say you have a check for item id running nonstop would it slow down the script? Or is it like an hp/mana pot checker where I'd have to place a label for it over and over in the waypoints?
HjugO
01-01-2015, 09:04 PM
It still doesn't work. When I kill the boss, it doesn't even show the boss name in the recent kill HUD, or in server messages. That's why I think if I can make it like walker go to label IF item id is seen on screen, it should work.
Coz you are using this script on fucking Open Tibia Server - 10.41 version huh?
Odemis
01-01-2015, 09:08 PM
No, normal tibs.. I never play OT's
HjugO
Odemis
01-01-2015, 09:10 PM
To be honest, I didn't try your script, I just assumed it wouldn't work since the client doesn't even show the bosses name after killing it. Just says what your reward is...
HjugO
01-01-2015, 09:16 PM
To be honest, I didn't try your script, I just assumed it wouldn't work since the client doesn't even show the bosses name after killing it. Just says what your reward is...
What kind of boss? Grizzly Adams or other?
Odemis
01-01-2015, 09:24 PM
What kind of boss? Grizzly Adams or other?
Other, pmed..
Odemis
01-03-2015, 01:10 PM
Could anyone produce this?:
-- Leave after Boss --
local boss = { "deeds", "rewards", "boss name", "or boss remains id number"}
--[[ Don't touch below ]]--
function LootProxyCallback(proxy, message)
for index, name in ipairs(boss) do
if string.find(message:lower(), name) then
gotoLabel("Leavehunt")
end
end
end
LootMessageProxy.OnReceive('LootProxy', LootProxyCallback)
It loads up properly, but nothing happens..
Odemis
01-03-2015, 04:17 PM
Well still not success on leave after Boss kill. But about to test a module I found on another post, which should gotoLabel(Leavehunt), but also sound an alarm after each kill =]
Trial and error number: who knows
Lua Code:
-- Leave after Boss --
Module.New("Fire Alarm", function(mod)
if Self.isBurning() then
gotoLabel(Leavehunt)
mod:Delay(6000)
end
end)
Thanks to @krille09 (http://forums.xenobot.net/member.php?u=9755) & @Kezzar (http://forums.xenobot.net/member.php?u=25849) I may have found a solution..
Odemis
01-03-2015, 09:31 PM
Another fail.
Will keep everyone updated, I'll just post the working script when I fix it.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.