Alas, I am out of luck again, for the last three hours or so, I've been trying to formulate a script that checks if a champion has a dagger in hand when attacking. I've used a print("check") as a way of testing if it works since I've not yet started scripting the effect I was planning. Currently I am using a party hook onAttack and then getItem(7) to see if the right hand slot has a dagger, and then printing check if it does. (I've treid it with both slots but to no avail) For some unknown to me reason the only result I reached was that if the champion did NOT have a dagger in the mentioned slot, it would print the message. Adding "not" to the script to see if this worked in reverse, showed that it doesn't. With a not, it didn't print anything. Here is the current code, albeit it is already gone through multiple iterations:
Code: Select all
cloneObject{
name = "party",
baseObject = "party",
onAttack = function(champion)
if champion:getItem(7) == dagger then
print("check")
else
print("No dagger")
end
end
}
Sorry again /_\
EDIT: Hmm, it seems there is something very wrong in the way I address the type of item in the hand. It actually prints check when I attack with an empty hand, and no dagger if I attack with any weapon...