Forcing the players to learn spells before using them.
Forcing the players to learn spells before using them.
I would like to control spell progression through my dungeon.
For example, suppose I don't want the player to use Fireball until they 'learn' it from the scroll on floor 3 of the dungeon. Is it possible to make a consumable item that looks like a scroll, that enables use of a spell once it is used?
Is it possible to set a global variable to track if a party has learned a given spell?
For example, suppose I don't want the player to use Fireball until they 'learn' it from the scroll on floor 3 of the dungeon. Is it possible to make a consumable item that looks like a scroll, that enables use of a spell once it is used?
Is it possible to set a global variable to track if a party has learned a given spell?
Re: Forcing the players to learn spells before using them.
You can re define the spells, and just change the runes required to cast.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Re: Forcing the players to learn spells before using them.
Better than that, you should be able to change the spells to return false until a certain condition is met or something.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!
Re: Forcing the players to learn spells before using them.
Because the scroll must be in the inventory to be read, you can use the new onEquipItem hook on the spell scroll, and have it set a variable to true somewhere on the first call of the hook. Then, put an onCast hook on the party and check for that variable for that spell and return false if scroll wasn't read.
Re: Forcing the players to learn spells before using them.
Just to expand on the earlier solutions... for the spellbook/party hook part, add a script entity to your dungeon and name it appropriately e.g. spellbook_script
add to it the following code:
note - you will need to expand the spellbook array (at the start of the script entity) to include the names of all the spells, and their initial learned state (where 1 = learnt, 0 = not learnt)
next clone the party definition, probably in init.lua as follows:
Then for each spell you will need to clone the scroll for that spell as follows:
and make sure for each scroll you include the name of the relevant spell, and the skill to check for as a variable in learnSpell()
The skill check works by testing to see if the champion who equipped the scroll has the relevant skill above level 0.. so that, say, only if a fire mage equips the scroll does he get to learn fireball!
add to it the following code:
Code: Select all
spellbook = {fireburst=1,fireball=0,enchant_fire_arrow=0,fire_shield=0}
function checkSpellbook(caster,spell)
if spellbook[spell] == 1 then
return true
elseif spellbook[spell] == 0 then
hudPrint(caster:getName() .. " does not know " .. spell)
return false
end
end
function learnSpell(champ,spell,skill)
if champ:getSkillLevel(skill) > 0 and spellbook[spell] == 0 then
spellbook[spell] = 1
end
end
next clone the party definition, probably in init.lua as follows:
Code: Select all
cloneObject{
name = "party",
baseObject = "party",
onCastSpell = function(caster,spell)
return spellbook_script.checkSpellbook(caster,spell)
end,
}
Then for each spell you will need to clone the scroll for that spell as follows:
Code: Select all
cloneObject{
name = "scroll_fireball",
baseObject = "scroll_fireball",
onEquipItem = function(champion,slot)
spellbook_script.learnSpell(champion,"fireball","fire_magic")
end,
}
The skill check works by testing to see if the champion who equipped the scroll has the relevant skill above level 0.. so that, say, only if a fire mage equips the scroll does he get to learn fireball!
Puzzle Frameworks - http://www.grimrock.net/forum/viewtopic.php?f=14&t=4564
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Magic Pack - https://www.nexusmods.com/grimrock/mods/70
Area of Effect Spell System - http://www.grimrock.net/forum/viewtopic ... 150#p44382
Re: Forcing the players to learn spells before using them.
This topic has been brought up before, and I agree AH's spell acquisition system could be improved upon. Making spells unavailable until you get the scroll brings some good things into the game. Scrolls are now actually useful and can give the player one of those "yay!" moments when you find one, similar to when you find a new axe for your fighter. Plus some people will be alt+tabbing less since they now can't automatically use spells as soon as they reach the right level, if they haven't found the scroll.
Of course there's now the danger of the player missing scrolls, but that's easily solved by making them easy to find, by providing an ample supply of them, or both.
I'm definitely going to check out Grimwold's script.
Of course there's now the danger of the player missing scrolls, but that's easily solved by making them easy to find, by providing an ample supply of them, or both.
I'm definitely going to check out Grimwold's script.
Re: Forcing the players to learn spells before using them.
Don't forget about a party with multiple mages as well.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!
Re: Forcing the players to learn spells before using them.
I modified Grimwold's script a bit so scrolls are used similar to other items - you right click on them. If the character isn't skilled enough or already knows the spell, it says that on the screen. If it's a new spell, and the character is skilled enough, it plays a sound and tells the player he learned the spell. The way it works now the scroll doesn't disappear and can thus potentially be read by other mages in the party.Don't forget about a party with multiple mages as well.
But the question is, how is a mage going to learn the spells that have no scrolls? I suppose you could create new spell scrolls, but I assume the rune images on the existing scrolls aren't dynamic, so the new scrolls would suck.
Re: Forcing the players to learn spells before using them.
Found out the spell variable when put on scrolls solves this issue. I'll flesh out the stuff, based on Grimwold's code, and post it here.Ixnatifual wrote:But the question is, how is a mage going to learn the spells that have no scrolls? I suppose you could create new spell scrolls, but I assume the rune images on the existing scrolls aren't dynamic, so the new scrolls would suck.
Re: Forcing the players to learn spells before using them.
Actually this solution can also solve some balance/consistency problems. For example, it wouldn't make sense to make a strictly-better-than-fireball fire spell in AH system; if you have to find the scroll it makes sense to do it and simply hide the better spell in a very secret area while the standard spell could be easy to find (or in some cases even provided at game start - heck if you are a mage you are supposed to know something ).Of course there's now the danger of the player missing scrolls, but that's easily solved by making them easy to find, by providing an ample supply of them, or both.
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com
The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563
My preciousss: http://www.moonsharp.org
The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563
My preciousss: http://www.moonsharp.org