Page 1 of 1

Shield spell, Conditions and Hard-coding

Posted: Mon Feb 06, 2017 12:51 pm
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?

Re: Shield spell, Conditions and Hard-coding

Posted: Mon Feb 06, 2017 1:27 pm
by AndakRainor
Hello!

You can use the defineCondition function described on this page: https://github.com/JKos/log2doc/wiki/Asset-Definitions