This is a real issue, because, afaik, when an item reaches 0, it either disappear or show his empty self. However, if you make it that it keeps a last charge, it could go on forever.
I ran into this issue some time ago, and couldn't find a way. I have no answer, sorry
Weapon ReCharging - Without replacing with new item
- cromcrom
- Posts: 549
- Joined: Tue Sep 11, 2012 7:16 am
- Location: Chateauroux in a socialist s#!$*&% formerly known as "France"
Re: Weapon ReCharging - Without replacing with new item
A trip of a thousand leagues starts with a step.
- undeaddemon
- Posts: 157
- Joined: Fri Mar 02, 2012 3:38 pm
Re: Weapon ReCharging - Without replacing with new item
Right, because.. this is part of an onUseItem function - and emptying the item of charges is occurring outside of that function.
So... How do I get all the parameters available for the item - in this case I was working off of lightning_blade? Is the modeling toolkit something that helps with functions??
Thanks so much for all the help!

UD
So... How do I get all the parameters available for the item - in this case I was working off of lightning_blade? Is the modeling toolkit something that helps with functions??
Thanks so much for all the help!
UD
- undeaddemon
- Posts: 157
- Joined: Fri Mar 02, 2012 3:38 pm
Re: Weapon ReCharging - Without replacing with new item
I have considered an additional option... such as work with the system of "empty blade" but.. instead of just being empty.. it might also be quite angry....
- undeaddemon
- Posts: 157
- Joined: Fri Mar 02, 2012 3:38 pm
Re: Weapon ReCharging - Without replacing with new item
Asset Pack.. I suspect that is what I am missing...
Live and Learn....
Live and Learn....
- undeaddemon
- Posts: 157
- Joined: Fri Mar 02, 2012 3:38 pm
Re: Weapon ReCharging - Without replacing with new item
This works, for unlimited charges:
Code: Select all
defineObject{
name = "BladeOfLightning",
class = "Item",
uiName = "Blade of Lightning",
model = "assets/models/items/long_sword.fbx",
description = "This Blade vibrates with Electricity.",
skill = "swords",
gfxIndex = 210,
attackPower = 13,
accuracy = 0,
coolDownTime = 5,
attackMethod = "castWandSpell",
spell = "lightning_bolt",
wandPower = 10,
charges = 1,
emptyItem = "BladeOfLightning",
attackSwipe = "vertical",
attackSound = "swipe",
impactSound = "impact_blade",
weight = 2.0,
}
Re: Weapon ReCharging - Without replacing with new item
Hehe I like the unlimited charges wand/sword....
I have created a wand that has one charge with 1 particular spell, once used, the empty version is a new wand with a different spell >> and the empty version of that is the original!!
fun times...
Anyways, here is a recharge item spell script Grimwold and I came up with...
with this pasted into a lua script...
I like the idea of the evil sword! Cursed and all ... (good ol onEquip hooks
)
I have created a wand that has one charge with 1 particular spell, once used, the empty version is a new wand with a different spell >> and the empty version of that is the original!!
Anyways, here is a recharge item spell script Grimwold and I came up with...
SpoilerShow
defineSpell{
name = "recharge_item",
uiName = "Recharge Item",
skill = "staves",
level = 32,
runes = "FH",
manaCost = 90,
onCast = function(caster, x, y, direction, skill)
return rechargeitem_script.rechargeItem(caster,x,y,direction,skill)
end,
}
name = "recharge_item",
uiName = "Recharge Item",
skill = "staves",
level = 32,
runes = "FH",
manaCost = 90,
onCast = function(caster, x, y, direction, skill)
return rechargeitem_script.rechargeItem(caster,x,y,direction,skill)
end,
}
SpoilerShow
function isInTable(table, element)
for _,value in pairs(table) do
if value == element then
return true
end
end
return false
end
function rechargeItem(caster,x,y,direction,skill)
local charge_table = {"venom_edge","lightning_rod","lightning_blade","fire_blade","arrowflash_bow","storm_bolter",
"reaper_axe","amulet_life","amulet_growth","amulet_rainbows","boots_of_speed","shield_glacial",
"shield_fiery","stormbuster_shield","shock_lance","winter_wand","flarefeather_cap"}
for i = 7,8 do
if caster:getItem(i) ~= nil and isInTable(charge_table,caster:getItem(i).name) then
if caster:getItem(i):getCharges() >= 9 then
hudPrint("This item is already fully charged")
else
caster:getItem(i):setCharges(9)
playSound("blob_hit_receptor")
hudPrint("Item Charged")
return true
end
end
end
hudPrint("You must be holding a wand that is not empty to use this spell")
return false
end
for _,value in pairs(table) do
if value == element then
return true
end
end
return false
end
function rechargeItem(caster,x,y,direction,skill)
local charge_table = {"venom_edge","lightning_rod","lightning_blade","fire_blade","arrowflash_bow","storm_bolter",
"reaper_axe","amulet_life","amulet_growth","amulet_rainbows","boots_of_speed","shield_glacial",
"shield_fiery","stormbuster_shield","shock_lance","winter_wand","flarefeather_cap"}
for i = 7,8 do
if caster:getItem(i) ~= nil and isInTable(charge_table,caster:getItem(i).name) then
if caster:getItem(i):getCharges() >= 9 then
hudPrint("This item is already fully charged")
else
caster:getItem(i):setCharges(9)
playSound("blob_hit_receptor")
hudPrint("Item Charged")
return true
end
end
end
hudPrint("You must be holding a wand that is not empty to use this spell")
return false
end
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Re: Weapon ReCharging - Without replacing with new item
that is interesting. I like the idea also of the evil sword.I want to see more weapons in this sitescottruss wrote:[quote="akroma222"I like the idea of the evil sword! Cursed and all ... (good ol onEquip hooks)
scott[/quote]
Scottruss - I think we will start to see a lot more goodies floating around soon... a lot of mods are being released now with custom gear...
I certainly feel like I am hoarding stuff like that, but I do want a few surprises for people when they play through my dungeon
What kind of weapons are you after?? (apart from an evil sword!)
Labyrinth of Lies (viewtopic.php?f=14&t=4400)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)
Legacy of Lies (viewtopic.php?f=22&t=12983&hilit=+legacy)