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? :)
Printable View
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? :)
Here's a script to go to a label when a certain monster is killed. Should give you a good starting point.
Code: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
Here's the release thread that details how to handle message proxies: http://forums.xenobot.net/showthread...ssage-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.
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
No problem. I believe I already have you on Skype, but if I don't then add me if you need more help. ADD
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:
Code:-- 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.
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
Could anyone help me solve this plz? xD
Possibly @Spectrus ?:rolleyes:
You added in an extra parenthesis at the end of message, and didn't add one at the end of the last end :)
Code:-- 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)
@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..
The script is up and running so I guess I will find out eventually ><
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.
Because the message shows in white text on server log.Code:BattleMessageProxy.OnReceive('check_kill', function(proxy, message) if string.match(message, monsterToLeave) then
Walker.Goto(labelToLeave)
end
end)
Could you explain what the 'check_kill' part serves? Should I keep that as is?
Another fail...Code:-- 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)
Next try:
Code:-- 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)
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.
something like this
if Self.GetCreatureKills("BossName") > 0 then
Walker.Goto("Leave")
Self.ResetCreatureKills("BossName")
else
Walker.Goto("KillBoss")
end
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.
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?
No, normal tibs.. I never play OT's
@HjugO
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...
Could anyone produce this?:
It loads up properly, but nothing happens..Code:-- 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)
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:
Code:-- Leave after Boss --
Module.New("Fire Alarm", function(mod)
if Self.isBurning() then
gotoLabel(Leavehunt)
mod:Delay(6000)
end
end)
Thanks to @krille09 & @Kezzar I may have found a solution..
Another fail.
Will keep everyone updated, I'll just post the working script when I fix it.