Page 2 of 2

Re: Weapon ReCharging - Without replacing with new item

Posted: Wed Nov 14, 2012 3:22 pm
by cromcrom
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

Re: Weapon ReCharging - Without replacing with new item

Posted: Wed Nov 14, 2012 4:45 pm
by undeaddemon
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

Re: Weapon ReCharging - Without replacing with new item

Posted: Wed Nov 14, 2012 4:54 pm
by undeaddemon
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....

Re: Weapon ReCharging - Without replacing with new item

Posted: Wed Nov 14, 2012 6:01 pm
by undeaddemon
Asset Pack.. I suspect that is what I am missing...
Live and Learn....

Re: Weapon ReCharging - Without replacing with new item

Posted: Thu Nov 15, 2012 4:05 am
by undeaddemon
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

Posted: Wed Mar 06, 2013 10:55 pm
by akroma222
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!! :D fun times...

Anyways, here is a recharge item spell script Grimwold and I came up with... :D
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,
}
with this pasted into a lua script...
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
I like the idea of the evil sword! Cursed and all ... (good ol onEquip hooks :D )

Re: Weapon ReCharging - Without replacing with new item

Posted: Sat Mar 09, 2013 1:17 pm
by akroma222
scottruss wrote:[quote="akroma222"I like the idea of the evil sword! Cursed and all ... (good ol onEquip hooks :D )
that is interesting. I like the idea also of the evil sword.I want to see more weapons in this site

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!)