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!
minmay
Posts: 2770
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Here's a quick repackaging of the relevant code then. Merge that with your mod_assets folder and add this to your init.lua before importing anything with defineObject() calls:

Code: Select all

-- If DIAGNOSTICS_ON, data will be collected from defineObject, defineTrait, etc. calls, and
-- a ScriptComponent named "diagnostics" will be attached to the party with some useful
-- functions that you can use like party.diagnostics.dungeonReport().
--
-- If DIAGNOSTICS_ON is set to false or nil, none of this will happen, and the mod will act
-- as if the diagnostics folder didn't exist at all, so there is no performance cost.
--
-- This import MUST be first otherwise it won't be able to collect defineObject etc. data.
-- 
DIAGNOSTICS_ON = true
import "mod_assets/ext/diagnostics/diagnostics.lua"
Functions:
party.diagnostics.testDamage(champion,slot,special,protection,evasion,backstab,summarize,iterations) - Makes a champion attack a monster with their current weapon. Only works with melee attacks right now. Read the comment in diagnostics_script.lua for details, and be careful with iteration count.

party.diagnostics.computeDamage(champion,slot,special,protection,evasion,backstab,summarize,critChance,critMult) - Attempts to calculate a champion's minimum, maximum, mean, and per-second damage with a weapon, without actually simulating it like testDamage(). Very limited, read the comment in diagnostics_script.lua.

party.diagnostics.rankWeapons(champion,protection,evasion,backstab,critChance,critMult) - Uses computeDamage() to rank all defined weapons by their predicted damage per second.

party.diagnostics.dungeonReport() - This is best used in conjunction with redirecting the game's output to a file ("grimrock2.exe > out.txt"). It iterates through all objects in the dungeon and gets the total number of GameObjects and Components, sorted by save state. In addition, it prints to standard output (this is why you redirect to a file) a full summary of how many times each object and Component is used - again sorted by save state. This tool is useful for finding objects that you should have given minimalSaveState but didn't.
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
THOM
Posts: 1267
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

Sorry to ask something like that but how to redirect the output to a file?

I would like to use this tool but therefore I do not know how to browse through the terminal's output I can see just a little bit of the informations the tool gives. :?
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
minmay
Posts: 2770
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Run the game from a command prompt (Windows) or terminal (other OS) and append '> [filename]' to the command, like the example I gave:

Code: Select all

grimrock2.exe > out.txt
I suggest using your preferred search engine to learn more, since this isn't a Grimrock-specific question.
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.
minmay
Posts: 2770
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

AndakRainor wrote:How is the damage range in character stats GUI calculated?
I wrote what I believe is an identical computation in the diagnostics script. Check _getDamageRange().
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.
PedroMoniz
Posts: 16
Joined: Wed Jan 11, 2017 9:46 pm

Re: Ask a simple question, get a simple answer

Post by PedroMoniz »

Hello,

I would like to know how to set up a default party for my dungeon.

I found a script for LoG1 and I also found a thread about starting a game and then copy pasting something to the editor.

What is the best way for me to set a default party?
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 »

PedroMoniz wrote:Hello,

I would like to know how to set up a default party for my dungeon.

I found a script for LoG1 and I also found a thread about starting a game and then copy pasting something to the editor.

What is the best way for me to set a default party?
As in override the players party to force them to play a certain party, or override the party yo something else if the player haven't customized their party?
My asset pack [v1.10]
Features a bit of everything! :D
PedroMoniz
Posts: 16
Joined: Wed Jan 11, 2017 9:46 pm

Re: Ask a simple question, get a simple answer

Post by PedroMoniz »

Override the selected party to force my own party
User avatar
Isaac
Posts: 3179
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

I do hope that any future Grimrock sequel (or Grimrock 2 update), includes the mod option to disable party creation. The reason being, that there are surely some players who will click past any warning in the description, and waste their time creating a party ~that gets wiped when the map loads.

The way to generate your own custom party is found in the script reference section(s). The process is to include a script_entity that manually updates everything pertinent to your character design for each PC; including disabling PCs if the player is to start with less than four characters.

http://www.grimrock.net/modding/scripti ... /#Champion
https://github.com/JKos/log2doc/wiki/Ob ... s#champion
PedroMoniz
Posts: 16
Joined: Wed Jan 11, 2017 9:46 pm

Re: Ask a simple question, get a simple answer

Post by PedroMoniz »

thank you,


I have another question regarding a different topic.

I want to use this ItemComponent.onEquipItem(self, champion, slot).

with the party i had to do

defineObject{
name = "party",
baseObject = "party",
components = {
{ set my hooks }
}

With items, does something like this also work and applies to all items or should i create custom objects that are clones of the ones created and assign the hook on them?
Post Reply