[Script] Get difficulty settings from script

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
MasterJoe
Posts: 9
Joined: Fri Dec 21, 2012 7:26 pm

[Script] Get difficulty settings from script

Post by MasterJoe »

Hi everyone,

How can I, through a script, check what was selected for a difficulty level (easy, medium or hard)?

In my dungeon I would like the players, for example:

-for the play on "hard" give +50% exp reward.
-for the play on "easy" give -50% exp reward.

Thanks in advance.
I am a REAL 'Master of Disaster' `;.;´
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: [Script] Get difficulty settings from script

Post by Isaac »

MasterJoe wrote:Hi everyone,

How can I, through a script, check what was selected for a difficulty level (easy, medium or hard)?

In my dungeon I would like the players, for example:

-for the play on "hard" give +50% exp reward.
-for the play on "easy" give -50% exp reward.

Thanks in advance.
Wish I knew... I don't think that you can. Something to hope for in LoG2.

** I suppose that you could start the game in a custom settings ~room; and allow the player to flip a lever to choose the difficulty of your mod... or script a GUI menu for it.
User avatar
MasterJoe
Posts: 9
Joined: Fri Dec 21, 2012 7:26 pm

Re: [Script] Get difficulty settings from script

Post by MasterJoe »

Thanks for the quick reply.

In addition, I have been thinking BUT:
How do I make the opponent, as in the regular game: Stronger, more aggressive, more HP, etc.? That would be indeed a huge script. :?
I am a REAL 'Master of Disaster' `;.;´
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: [Script] Get difficulty settings from script

Post by Isaac »

MasterJoe wrote: How do I make the opponent, as in the regular game: Stronger, more aggressive, more HP, etc.? That would be indeed a huge script. :?
Well I have not tried it, but the function setLevel() sets the monster's level... so I would assume that a script could iterate through all of them and boost the level; [as per the monster's definition] or... A script could bump the monsters up a notch when entering the floor for the first time.

In either case, I don't think it would need an overly long script to manage it.
Monster:setLevel(level)
Advances the monster in levels by giving it more health as specified by its level health adjustment property.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: [Script] Get difficulty settings from script

Post by Komag »

Master Quest measures the party's average level and adjust all the monsters accordingly
Finished Dungeons - complete mods to play
User avatar
MasterJoe
Posts: 9
Joined: Fri Dec 21, 2012 7:26 pm

Re: [Script] Get difficulty settings from script

Post by MasterJoe »

Ok thanks! :mrgreen:

:?: 2 questions I have thus yet:
1) How "find" I ALL monsters in the dungeon?
2) How do I change, with this script, certain values ​​of the Monster (HP, level, etc.)?
I am a REAL 'Master of Disaster' `;.;´
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: [Script] Get difficulty settings from script

Post by Isaac »

MasterJoe wrote:Ok thanks! :mrgreen:

:?: 2 questions I have thus yet:
1) How "find" I ALL monsters in the dungeon?
2) How do I change, with this script, certain values ​​of the Monster (HP, level, etc.)?
_________

AH put a list of supported script functions in their 'Modding >> Script Reference' section.

The ones that you want are:
  • allEntities(level)
    Returns an iterator for all entities in a given level.
and
  • Monster:setLevel(level)
    Advances the monster in levels by giving it more health as specified by its level health adjustment property.
User avatar
MasterJoe
Posts: 9
Joined: Fri Dec 21, 2012 7:26 pm

Re: [Script] Get difficulty settings from script

Post by MasterJoe »

thanks,

is there a way to set the "attack power" for a monster via script?
I am a REAL 'Master of Disaster' `;.;´
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: [Script] Get difficulty settings from script

Post by JohnWordsworth »

Hey MasterJoe, there are 2 ways I can suggest to scale monsters during the game.

1. In your monster definition, you can set the base 'attackPower' and then 'attackPowerIncrement'. Then, using 'setLevel(...)' on the monster, you can select the current level of the monster, which will increment the attackPower. For instance, if you give a monster attackPower 100 and attackPowerIncrement 50. Then using setLevel(3) would theoretically set it to 200 (100 Base at Level 1 and then 50 more for each extra level). I'm not 100% sure of the maths, as I don't know if the baseLevel is 0 or 1, but this is the idea. I also don't know if there is a max level. It might be 5 or there might not be a max level at all (worth experimenting - just try to set a monster's level to 100 and see if it murders you really fast).

2. If you want to have vastly different types of monsters (throwing bigger spells around at higher levels or changing textures on models to represent 'hard-ass ogre'), then you can use cloneObject({...}) to have slightly different definitions for your monsters and then destroy/recreate monsters in upcoming areas before you get there. You can use this to say "oh, the party are level 1 - we'll give them snails" or "agh, now they're level 30, lets throw a bunch of uggardians at them".
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: [Script] Get difficulty settings from script

Post by JohnWordsworth »

P.S. I've been thinking for a while now if there is a way to get the official game difficulty at all. I wonder if Monster health changes on hard? If yes, then you *might* be able to do spawn a snail say, set it to level 1 and then see if it has X or Y health. Of course, this might not scale (it might affect damage or other properties instead) but might be worth a try?
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Post Reply