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?
Changing item descriptions on equip
Changing item descriptions on equip
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
Re: Changing item descriptions on equip
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.
P.S: Use "Code" tags if you post codes.
I'm the Gate I'm the Key.
Dawn of Lore
Dawn of Lore
Re: Changing item descriptions on equip
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
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.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.
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.
I smell you, i do! You GRADUNK! No be hiding on TORGAL!
Re: Changing item descriptions on equip
Example: (This adds a 'Dagger Hook Example' item; place and equip with any character.)Gradunk wrote: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.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.
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.
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
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?
the obvious line crashes the game regardless of what i try to insert.
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
endI smell you, i do! You GRADUNK! No be hiding on TORGAL!
Re: Changing item descriptions on equip
'Item' cannot be by name, it must be spawned. (There are two ways shown in the updated code.)Gradunk wrote:...
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,
}- Eleven Warrior
- Posts: 752
- Joined: Thu Apr 18, 2013 2:32 pm
- Location: Australia
Re: Changing item descriptions on equip
You can also do this with LOG Framework system by Jkos check it out