Ask a simple question, get a simple answer

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!
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post by zimberzimber »

AndakRainor wrote:
zimberzimber wrote:Isn't that part of what isBlocked() does?
No, you have at least to test if the party is not in front of a tile with a lower elevation, in that case the ice shards spell does nothing.
Right, it fizzles and does nothing.
The iceShard component is still responsible for not not doing anything in case the elevation is different, which it does even before isBlocked is check. (If I'm not mistaken)
My asset pack [v1.10]
Features a bit of everything! :D
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

zimberzimber wrote:
AndakRainor wrote:
zimberzimber wrote:Isn't that part of what isBlocked() does?
No, you have at least to test if the party is not in front of a tile with a lower elevation, in that case the ice shards spell does nothing.
Right, it fizzles and does nothing.
The iceShard component is still responsible for not not doing anything in case the elevation is different, which it does even before isBlocked is check. (If I'm not mistaken)
That's right, except for the first tile obviously, since you must decide to spawn or not to spawn before taking advantage of the IceShards component.
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post by zimberzimber »

AndakRainor wrote:
zimberzimber wrote:
AndakRainor wrote:That's right, except for the first tile obviously, since you must decide to spawn or not to spawn before taking advantage of the IceShards component.
Yea already noticed that with the wall_fire playing its sound even though nothing appeared.
My asset pack [v1.10]
Features a bit of everything! :D
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

Also another point about spells; you are supposed to make them more powerful by 20% per skill level of the caster. That is what is written on the player screen, and it is the responsibility of a modder to make it a reality. Again, spells are a serious matter! Unless you just want to code only a few spells, I would advice using functions in a script entity to avoid writing the same tests and formulas many times.
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post by zimberzimber »

AndakRainor wrote:Also another point about spells; you are supposed to make them more powerful by 20% per skill level of the caster. That is what is written on the player screen, and it is the responsibility of a modder to make it a reality. Again, spells are a serious matter! Unless you just want to code only a few spells, I would advice using functions in a script entity to avoid writing the same tests and formulas many times.
Oh? I was sure the trait simply amplified damage dealt by the associated damage type, which is one of the reasons I was sure it mattered from which hero the damage came from. Thanks for the heads up!
So I have to modify the power of the spawned object with a tiledamager:setAttackPower(tiledamager:getAttackPower() * 0.2 * champion:getSkillLevel("fire_magic") + tiledamager:getAttackPower()) for it to work?

Also, I'm having trouble calling functions from inside an 'if', how do you do that?
My asset pack [v1.10]
Features a bit of everything! :D
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

AndakRainor wrote:Also another point about spells; you are supposed to make them more powerful by 20% per skill level of the caster. That is what is written on the player screen, and it is the responsibility of a modder to make it a reality.
8-)
This I knew, but didn't know if the game applied it's own damage multiplier for skill. [never checked]
This is good to know; I had considered adjusting the damage (and even duration) based on the passed champion skill value, but hadn't actually tried to yet.
User avatar
AndakRainor
Posts: 674
Joined: Thu Nov 20, 2014 5:18 pm

Re: Ask a simple question, get a simple answer

Post by AndakRainor »

Yes you can use the generic formula:
power = base * (1 + 0.2*skill)

You can use the skill parameter in your spell instead of champion:getSkillLevel("fire_magic") because you already declared skill = "fire_magic" in the spell definition.

To call a function in an if statement is the same thing as anywhere else:

Code: Select all

if myScriptId.script.myTest() then ...
Now just to make things a little harder; what about special items like "shaman_staff" with gameEffect = "Earthbound (Poison spells deal 20% more damage)" or "zhandul_orb" with gameEffect = "Intense Fire (Fireball and Fireburst spells deal more damage)",? :roll:

So far I did not include such items in my mod, but it is also something to consider if you ever want to use them :twisted:

Edit: also note that the skill parameter may be given by the power of a CastSpell component instead of the caster skill if cast from an item!
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Zhandul's Orb in Grimrock 2 doesn't actually work, only the Shaman Staff does. Its functionality is built into the default poison cloud and poison bolt spells, so if you want it to affect custom spells you'll have to check for it yourself.
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.
User avatar
zimberzimber
Posts: 432
Joined: Fri Feb 08, 2013 8:06 pm

Re: Ask a simple question, get a simple answer

Post by zimberzimber »

AndakRainor wrote:To call a function in an if statement is the same thing as anywhere else:

Code: Select all

if myScriptId.script.myTest() then ...
Problem is that I have to do it on an external script, which is not tied into the game with a script entity, which (correct me if I'm wrong) doesn't have an ID like script entities do.
My asset pack [v1.10]
Features a bit of everything! :D
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

I believe that everything has to have an ID. Scripts are part of an object's script component.
Post Reply