Shield spell, Conditions and Hard-coding

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
Marebre
Posts: 5
Joined: Wed Feb 01, 2017 4:12 pm

Shield spell, Conditions and Hard-coding

Post by Marebre »

Hello. Please note that I'm very new to this forum and Grimrock Modding in general, so forgive me if I ask something that has already been answered.

So. Is it possible to make custom spell, that gives caster +n protection for some duration? In other words, exactly like original Shield spell, except that +25 flat bonus is replaced with some other number?

I downloaded original game asset pack and it states:

Code: Select all

onCast = "shield",
but I can't find the "shield" function.

I downloaded Multiple magic schools spells pack and inside is a function called shield, which:

Code: Select all

  onCast = function(champion, x, y, direction, elevation, skillLevel)
    ...
    spells_functions.script.addConditionValue("protective_shield", duration, not champion:hasTrait("aura") and champion:getOrdinal())
    spells_functions.script.setConditionIcons("protective_shield", "shield")
  end
which, after following imaginary stack trace, leads to

Code: Select all

    local c = party.party:getChampionByOrdinal(ordinal)
    c:setConditionValue(condition, c:getConditionValue(condition)+duration)
I am reaching the conclusion that the +25 bonus is hard-coded. In other words I can fiddle around with duration, and which party members it affects, etc. but not with the actual +25 value.

To make the question more general, are all conditions hard-coded and if not, how to make custom conditions?
Post Reply