Page 1 of 1
Changing item descriptions on equip
Posted: Tue Jun 17, 2014 8:47 pm
by Gradunk
how? that's all i really need to say.
onEquipItem = function(champion,slot)
description = "It seems to have glued itself to your body. You have no knowledge of how to remove it. You then feel a dark connection to the shield and a surge of power flows through you. You never want to take it off anyway."
end
that for some reason wont even let me run the game.
onUnequipItem = function(champion,slot)
if slot == 8 then
equipStopper.stopUnequip(champion,slot)
end
end
but that will. i'm trying to make it so you can't remove the item and the description to change to reflect that. but neither are working properly.
any help on this one?
Re: Changing item descriptions on equip
Posted: Tue Jun 17, 2014 11:46 pm
by Leki
Make two items, if first is equiped, get slot and replace it with the second one with that new description, in UnEqupi handler work with 2nd item. I guess you can define onUnequip hook in that 2nd item to return false and you no need that stoppers.
P.S: Use "Code" tags if you post codes.
Re: Changing item descriptions on equip
Posted: Wed Jun 18, 2014 4:25 am
by Isaac
Additionally... Your onEquipItem hook is a function without a closing End. That would stop the game, unless you've abridged the code here.
Re: Changing item descriptions on equip
Posted: Wed Jun 18, 2014 4:42 am
by Gradunk
Isaac wrote:Additionally... Your onEquipItem hook is a function without a closing End. That would stop the game, unless you've abridged the code here.
not quite sure what you mean by that. I've found out a way to change the description but that entails a pressure plate and the item having been previously equipped.
I haven't once been able to get any onEquipItem OR on onUnequipItem hook to actually execute. they will compile and the game will run but they do nothing.
can you paste an onEquipItem hook that you've used and say how you got it to run? cause i'm at a loss here... again.
Re: Changing item descriptions on equip
Posted: Wed Jun 18, 2014 4:48 pm
by Isaac
Gradunk wrote:Isaac wrote:Additionally... Your onEquipItem hook is a function without a closing End. That would stop the game, unless you've abridged the code here.
not quite sure what you mean by that. I've found out a way to change the description but that entails a pressure plate and the item having been previously equipped.
I haven't once been able to get any onEquipItem OR on onUnequipItem hook to actually execute. they will compile and the game will run but they do nothing.
can you paste an onEquipItem hook that you've used and say how you got it to run? cause i'm at a loss here... again.
Example: (This adds a 'Dagger Hook Example' item; place and equip with any character.)
Code: Select all
defineObject{
name = "dagger_hook",
class = "Item",
uiName = "Dagger Hook Example",
model = "assets/models/items/dagger.fbx",
skill = "daggers",
gfxIndex = 10,
attackPower = 7,
accuracy = 5,
coolDownTime = 2.5,
attackMethod = "meleeAttack",
attackSwipe = "vertical",
attackSound = "swipe_light",
impactSound = "impact_blade",
weight = 0.8,
onEquipItem = function(champion, slot)
local pronoun = {["male"]="his",["female"]="her"} -- Gender word
local hand = {["7"]="left", ["8"]="right"} -- left/right hand word
hudPrint(" ") hudPrint(" ") hudPrint(" ") hudPrint(" ") -- clear the previous texts
hudPrint(champion:getName().." holds the dagger ")
hudPrint("in "..pronoun[champion:getSex()].." "..hand[tostring(slot)].." hand.")
end,
onUnequipItem = function(champion, slot)
hudPrint(" ") hudPrint(" ") hudPrint(" ") hudPrint(" ") -- clear the previous texts
hudPrint(champion:getName().." puts the dagger away.")
end,
}
Re: Changing item descriptions on equip
Posted: Wed Jun 18, 2014 6:15 pm
by Gradunk
Thanks. now i got it working. i wasn't putting it in the right place. now my question is.
How do i insertItem() on one of those onEquipItem or onUnequipItem commands?
Code: Select all
onEquipItem = function(champion, slot)
if slot == 7 or slot == 8 then
champion:removeItem(slot)
champion:insertItem(doesn't, matter)
end
end
the obvious line crashes the game regardless of what i try to insert.
Re: Changing item descriptions on equip
Posted: Wed Jun 18, 2014 7:38 pm
by Isaac
Gradunk wrote:...
'Item' cannot be by name, it must be spawned. (There are two ways shown in the updated code.)
Code: Select all
defineObject{
name = "dagger_hook",
class = "Item",
uiName = "Dagger Hook Example",
model = "assets/models/items/dagger.fbx",
skill = "daggers",
gfxIndex = 10,
attackPower = 7,
accuracy = 5,
coolDownTime = 2.5,
attackMethod = "meleeAttack",
attackSwipe = "vertical",
attackSound = "swipe_light",
impactSound = "impact_blade",
weight = 0.8,
onEquipItem = function(champion, slot)
local pronoun = {["male"]="his",["female"]="her"} -- Gender word
local hand = {["7"]="left", ["8"]="right"} -- left/right hand word
hudPrint(" ") hudPrint(" ") hudPrint(" ") hudPrint(" ") -- clear the previous texts
hudPrint(champion:getName().." holds the dagger ")
hudPrint("in "..pronoun[champion:getSex()].." "..hand[tostring(slot)].." hand.")
hudPrint("But it magically changes to an axe!")
champion:removeItem(slot)
champion:insertItem(slot, spawn("tricky_axe"))
return false
end,
}
cloneObject{
name = 'tricky_axe',
baseObject = 'hand_axe',
onUnequipItem = function(champion, slot)
hudPrint(" ") hudPrint(" ") hudPrint(" ") hudPrint(" ") -- clear the previous texts
hudPrint(champion:getName().." puts the axe away, but")
hudPrint("it magically changes to a dagger again!")
local newItem = spawn("dagger_hook")
setMouseItem(newItem)
end,
}
Re: Changing item descriptions on equip
Posted: Fri Jun 20, 2014 11:13 am
by Eleven Warrior
You can also do this with LOG Framework system by Jkos check it out