Anti-Light Spell Script?
Anti-Light Spell Script?
Hello, all. I'm a complete newbie to scripting in LUA and curious about how I might create a script that would prevent players from casting the Light spell. I saw a script for anti-magic, but I'm only interested in blocking this particular spell. Any suggestions? My apologies if this has been covered elsewhere.
Re: Anti-Light Spell Script?
get the LoG asset pack and find "scripts/spells.lua" file and open it. find the light spell in there and copy it. Then go to your "mod_assets/scripts/spells.lua" file and insert the copy. You can then edit the spell however you like. One of the later lines is "onCast", change that from "Light" to "Darkness", and when they try to cast light, it won't work, in fact, if they try again, it will extinguish their torches, I believe. You can also just change the name of the spell to Destroy Light, or something and give the player a surprise when they cast it. Note: All assets can be altered in this way 
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: Anti-Light Spell Script?
Where can I find the asset pack? (edit: never mind, found it!)
Re: Anti-Light Spell Script?
Hmm... I've copied the text for the light spell into "mod_assets\scripts\spells.lua". I changed uiName to "Destroy Light" and onCast to "darkness," but when I cast I'm still getting "Discovered New Spell: Light" and... well, light. What might I be doing wrong?
(edit: fixed, just had to reload my game... thanks for your help!)
(edit: fixed, just had to reload my game... thanks for your help!)
Re: Anti-Light Spell Script?
simpler to use the party definition onCast hook, and if the spellname is light just return false
Finished Dungeons - complete mods to play
Re: Anti-Light Spell Script?
Okay. That sounds like the sort of thing I need, but I'm afraid I'm at a loss for how to implement it. With apologies-- still totally new-- what would the code for that look like?
Re: Anti-Light Spell Script?
There:
PS: Bookmark this, a very useful resource: https://sites.google.com/site/jkosgrimr ... heat-sheet
Code: Select all
cloneObject{
name = "party",
baseObject = "party",
onCastSpell = function(champion, spellName)
if spellName == 'light' then
hudPrint("You cannot cast light spells, mouahahaha...")
return false
end
end,
}
PS: Bookmark this, a very useful resource: https://sites.google.com/site/jkosgrimr ... heat-sheet
Re: Anti-Light Spell Script?
Thanks! This helps a lot and will no doubt cut down on my pesky questions. I appreciate everyone's help.Diarmuid wrote: PS: Bookmark this, a very useful resource: https://sites.google.com/site/jkosgrimr ... heat-sheet
