Disabling specific Spells Help
Disabling specific Spells Help
So I'm trying to give special attention to the ambiance and lighting in levels. Id really like if folks couldn't just run around with light spell on 100% through the campaign. Is there anyway to disable a spell(specifcally the light spell) using a script that I could just copy and paste into each level?
Re: Disabling specific Spells Help
Hi,
I'm searching for a way to check if the spell light is active or cast darkness on the party, too.
It seems that they cannot be cast by spawners. I managed to check if the party is holding a torch, but with the spells I have no clue for now.
So... push. :)
Kind regards,
Joerg
I'm searching for a way to check if the spell light is active or cast darkness on the party, too.
It seems that they cannot be cast by spawners. I managed to check if the party is holding a torch, but with the spells I have no clue for now.
So... push. :)
Kind regards,
Joerg
Re: Disabling specific Spells Help
Hi,
I still have not solved this problem, so if anyone can help...
Here is what I do so far:
In \mod_assets\scripts\init.lua I check if the spell "light" is cast, and if this happens, the script and function script_entity_88.script:darknesscast() are called.
I noticed, that a character who casts the spells light or darkness has the Traits "Darkness" and/or "Light" in his trait window together with other traits like "Aura", "Meditation" and so on.
However, when I check with an extra script for these traits, I get no result:
It doesn't matter if I search with hasTrait for Aura, Meditation, Light, Darkness... they are never found.
Also when I try to set or remote traits with addTrait(string) or removeTrait it doesn't work.
Has anyone an idea what's up with the trait functions?
They are from the Champion-class, setFood(number) from the same class for example works without problems:
for i = 1,4 do
party.party:getChampion(i):setFood(400)
end
Kind regards,
Joerg
I still have not solved this problem, so if anyone can help...
Here is what I do so far:
In \mod_assets\scripts\init.lua I check if the spell "light" is cast, and if this happens, the script and function script_entity_88.script:darknesscast() are called.
Code: Select all
defineObject{
name = "party",
baseObject = "party",
components = {
{
class = "Party",
onCastSpell = function(party,champion,spellName)
if spellName == "light" then
--hudPrint(spellName)
script_entity_88.script:darknesscast()
end
end
}
},
}
However, when I check with an extra script for these traits, I get no result:
Code: Select all
for i = 1,4 do
if party.party:getChampion(i):hasTrait("Aura") then
hudPrint("found")
end
end
Also when I try to set or remote traits with addTrait(string) or removeTrait it doesn't work.
Has anyone an idea what's up with the trait functions?
They are from the Champion-class, setFood(number) from the same class for example works without problems:
for i = 1,4 do
party.party:getChampion(i):setFood(400)
end
Code: Select all
class Champion
setEnabled(boolean)
setName(string)
setRace(string)
setSex(string)
setClass(string)
setHealth(number)
getEnabled
getName
getRace
getSex
getClass
getDualClass
getLevel
getOrdinal
setPortrait(string)
isAlive
gainExp(number)
levelUp
getSkillPoints
addSkillPoints(number)
getSkillLevel(string)
trainSkill(number,string,string)
addTrait(string)
removeTrait
hasTrait(string)
setFood(number)
getFood
consumeFood(number)
modifyFood(number)
setCondition(string)
removeCondition(string)
hasCondition(string)
setConditionValue(number,string,string)
getConditionValue
damage(string,number)
playDamageSound(string)
playSound
showAttackResult(string,any)
setBaseStat(number,string)
modifyBaseStat(number,string)
upgradeBaseStat(number,string)
addStatModifier(number,string,string)
getBaseStat(string)
getCurrentStat(number)
regainHealth(number)
regainEnergy(number)
getHealth
getMaxHealth
getEnergy
getMaxEnergy
getProtection
getEvasion(string)
getResistance
getLoad
getMaxLoad(string)
getArmorSetPiecesEquipped(string)
isArmorSetEquipped
insertItem(ItemComponent,number,ItemComponent)
removeItem(number)
removeItemFromSlot(number)
getItem(number)
getOtherHandItem
playHealingIndicator
Kind regards,
Joerg
Re: Disabling specific Spells Help
Can't you just redefine the light spell with defineSpell{} to have a nil gesture so it's uncastable like blob? Or if that doesn't work anymore in LoG2, redefine it and give it impossible requirements (e.g. concentration skill 500).
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Disabling specific Spells Help
Hi,
I don't want to disable the light spell, because I think that general disabling of function is not a good design.
I want do temporarily make light unavailable in certain level areas because of the level design.
When the player casts light before he enters that area, he could get around this.
So I need to remove the light-spell/trait when he enters the area and if he casts light in the area he gets punished for it because of lore.
The punish-part is possible as I can check if light is cast and then use a normal script to check the area and do other things.
What I haven't found out is how to remove the light-trait when entering that area so that the player really has no own light in that part of the dungeon.
Or how to overwrite light with casting a darkness spell.
Kind regards,
Joerg
I don't want to disable the light spell, because I think that general disabling of function is not a good design.
I want do temporarily make light unavailable in certain level areas because of the level design.
When the player casts light before he enters that area, he could get around this.
So I need to remove the light-spell/trait when he enters the area and if he casts light in the area he gets punished for it because of lore.
The punish-part is possible as I can check if light is cast and then use a normal script to check the area and do other things.
What I haven't found out is how to remove the light-trait when entering that area so that the player really has no own light in that part of the dungeon.
Or how to overwrite light with casting a darkness spell.
Kind regards,
Joerg
Re: Disabling specific Spells Help
Try
IIRC this worked in LoG1.
Code: Select all
onCastSpell = function(party,champion,spellName)
if spellName == "light" then
return false
end
end
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
- cloneObject viewtopic.php?f=22&t=8450
Re: Disabling specific Spells Help
Hello JKos,
thank you for your answer, but unfortunately this is not the desired behaviour as I don't want do disable the light spell.
I need to remove the light trait or cast a darkness spell (see posts above).
It might however be the solution for Echoplex.
Kind regards,
Joerg
thank you for your answer, but unfortunately this is not the desired behaviour as I don't want do disable the light spell.
I need to remove the light trait or cast a darkness spell (see posts above).
It might however be the solution for Echoplex.
Kind regards,
Joerg
Re: Disabling specific Spells Help
How about this?
Disables light spell on level 2 only.
Code: Select all
onCastSpell = function(party,champion,spellName)
if party.level == 2 and spellName == "light" then
hudPrint("Light spell doesn't seem to have effect in here...blablabla")
return false
end
end
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
- cloneObject viewtopic.php?f=22&t=8450
Re: Disabling specific Spells Help
The problem is that the duration of the light spell is really long:
The party can cast the light spell on the stairs of level 1 and proceed to level 2.
They could have light through the whole level 2.
The party can cast the light spell on the stairs of level 1 and proceed to level 2.
They could have light through the whole level 2.
Re: Disabling specific Spells Help
one possible solution is that you create your own "light spell" and implement it so that it can be turned off. You can for example try to add LightComponent to the party and then in onCastSpell you can do something like this:
then you can disable it any time you want by calling party.light.setDisable(true)
This code isn't tested, and probably doesn't work, but I hope you got the idea.
Code: Select all
onCastSpell = function(party,champion,spellName)
if spellName == "light" then
--activate party.light. Don't know if it works this way.
party.light.setDisable(false)
return false
end
end
then you can disable it any time you want by calling party.light.setDisable(true)
This code isn't tested, and probably doesn't work, but I hope you got the idea.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
- cloneObject viewtopic.php?f=22&t=8450