CosmicGerbil I am trying to code a spell that lets the player steal a monster's soul. So far the spell looks like this:
PETTYSTEAL = add_spell
{
["name"] = "Petty Soul Steal",
["school"] = {SCHOOL_SOUL},
["level"] = 1,
["mana"] = 2,
["mana_max"] = 2,
["fail"] = 5,
["spell"] = function()
##Insert spell here
end,
["info"] = function()
return ""
end,
["desc"] = {
"Steals the soul of a low level monster",
"You must be wearing a Petty Soul cage amulet to cast it",
}
}
This is what I want the spell to do:
Monster dies. Use Soul Steal. Does the monster have a soul? If No then display message "This monster does not have a soul". If Yes then ... Display message "Do you want to steal this monster's soul y/n?" If No then display message "The Blue yeek's soul flees to the afterlife". If Yes then... Are you carring a suitable Soul Cage Amulet? If No then display message "You do not have a suitable recepticle to store this soul in" If Yes then... Are you successful? If No then display message "Death appears, takes the blue yeek's soul and says to you 'Not this time mortal'". If Yes then capture the soul and display suitable message :)
I know how to do the following things:
Write a script to check for flags to see if the monster is suitable (e.g. undead monsters are not suitable.
Check to see if the player is carrying an empty Soul cage amulet.
Write a script to swop an empty Soul cage amulet for a full one.
However I don't know how to make all these things come together in a spell.
Also I don't know how to check what type of monster was recently killed and so create the correct Soul cage amulet. I know that I will need to create lots of seperate amulets for the k_info file. What I mean is... if the player has just killed a Novice Ranger and then casts the spell, the result of the spell should be that the empty Soul cage amulet is removed from the player's inventory and swapped with a Soul cage amulet containing the soul of a Novice Ranger. How do I make the spell choose the correct amulet from k_info?
If anyone can help me with this, I'd be really grateful
Thanks in advance.
NeilStevens: The game won't just track for you what monsters are already dead. You'll have to do your own hook on monster death and store it yourself.
Sorgath You'll have to make it so they use the spell before the monster dies then when they kill a monster the spell activates. As for choosing the right item to store the soul in you could get the player to select the item they want to use like the fire golem spell.
How many amulets were you planning on making for the k_info.txt file?
CosmicGerbil Thanks guys
How would I code the spell before the monster dies? Would the Soul Steal power be an attack so that the chance of stealing a soul related directly do whether or not you successfully killed the monster. Maybe the Soul Steal power could only be used if, say, the monster had less than 10% of its HP left. Would that be possible to code?
As for the amulets I was going to have six empty ones and lots of full ones...probably one for each type of monster that you could steal a soul from. Although of course some monsters would "overlap"...for example stealing the soul of either a blue or a brown yeek would create the same amulet.
That's what I was puzzled about :S If you kill a yeek with the Soul Steal power, how do you select the correct amulet from k_info? I mean it would be impossible to have a seperate power for each type of amulet. Would it involve creating a table in the spell, or a variable that would link up to a seperate script and this new script would contain a table.
Hope this is clear enough...I have problems explaining things clearly
ToME Wiki