Okay, I was missing "return true" from my sacrificial dagger script. But now that I added it in, clicking the dagger on a portrait no longer spawns the used dagger at all.
Thanks for bearing with me so far...
setmouseitem crash
- Shloogorgh
- Posts: 45
- Joined: Sat Sep 22, 2012 12:24 am
Re: setmouseitem crash
woo hoo! Got the script to do exactly what I want now! Had to insert "return false" in one of the if/then scenarios, but now everything works as intended!
Code: Select all
function sacrifice(self, champion)
playSound("party_crushed")
champion:damage(10000, "physical")
hudPrint(champion:getName().." has been sacrificed.")
if getMouseItem() ~= nil then
if getMouseItem().name == "sacrificial_dagger" then
setMouseItem(spawn("sacrificial_dagger_used"))
return false
else
spawn("sacrificial_dagger_used", party.level, party.x, party.y, party.facing)
end
else
setMouseItem(spawn("sacrificial_dagger_used"))
end
return true
end
Re: setmouseitem crash
nice, glad you got it working! Is this ready to add to the script repository?
Finished Dungeons - complete mods to play
- Shloogorgh
- Posts: 45
- Joined: Sat Sep 22, 2012 12:24 am
Re: setmouseitem crash
Done and done!
Here's the finalized version I posted in the script repository:
Here's the finalized version I posted in the script repository:
Code: Select all
cloneObject{
name = "sacrificial_dagger",
baseObject = "dagger",
uiName = "Sacrificial Dagger",
gfxIndex = 142,
model = "assets/models/items/assassin_dagger.fbx",
description = "Dark energy emanates from this ritualistic blade",
gameEffect = "Place against a comrade's throat to complete the dark ritual",
weight = 1.0,
onUseItem = function(self, champion)
playSound("party_crushed")
champion:damage(10000, "physical")
hudPrint(champion:getName().." has been sacrificed.")
if getMouseItem() ~= nil then
if getMouseItem().name == "sacrificial_dagger" then
setMouseItem(spawn("sacrificial_dagger_used"))
return false
else
spawn("sacrificial_dagger_used", party.level, party.x, party.y, party.facing)
end
else
setMouseItem(spawn("sacrificial_dagger_used"))
end
return true
end,
}
cloneObject{
name = "sacrificial_dagger_used",
baseObject = "dagger",
uiName = "Sacrificial Dagger",
gfxIndex = 142,
model = "assets/models/items/assassin_dagger.fbx",
description = "The essence of your comrade pulses within the blade",
attackPower = 10,
weight = 1.0,
}