Page 182 of 395

Re: Ask a simple question, get a simple answer

Posted: Mon Jan 23, 2017 9:27 am
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.

Re: Ask a simple question, get a simple answer

Posted: Mon Jan 23, 2017 11:45 am
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. :?

Re: Ask a simple question, get a simple answer

Posted: Mon Jan 23, 2017 9:39 pm
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.

Re: Ask a simple question, get a simple answer

Posted: Tue Jan 24, 2017 9:42 pm
by AndakRainor
How is the damage range in character stats GUI calculated?

Re: Ask a simple question, get a simple answer

Posted: Tue Jan 24, 2017 10:32 pm
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().

Re: Ask a simple question, get a simple answer

Posted: Thu Jan 26, 2017 3:37 pm
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?

Re: Ask a simple question, get a simple answer

Posted: Thu Jan 26, 2017 4:17 pm
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?

Re: Ask a simple question, get a simple answer

Posted: Thu Jan 26, 2017 4:38 pm
by PedroMoniz
Override the selected party to force my own party

Re: Ask a simple question, get a simple answer

Posted: Thu Jan 26, 2017 4:50 pm
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

Re: Ask a simple question, get a simple answer

Posted: Thu Jan 26, 2017 5:57 pm
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?