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
Isaac
Posts: 3005
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac » Wed May 09, 2018 12:09 pm

Curunir wrote:One more thing - there is no real way to collect user keyboard input and make the user type in strings that a script can process, right?
Not for the faint of heart. ;)
It is possible with the GraphicsContext object, via :keyDown(key).

https://github.com/JKos/log2doc/wiki/Ob ... icscontext

User avatar
Xardas
Posts: 83
Joined: Fri Jul 28, 2017 12:30 am

Re: Ask a simple question, get a simple answer

Post by Xardas » Wed May 09, 2018 12:27 pm

What's with the grimtk input boxes?
In order to get to the other side of the pit you have to get hit by the fireball and die....
Yep.....moving on!

User avatar
Curunir
Posts: 332
Joined: Fri Mar 30, 2012 11:19 pm

Re: Ask a simple question, get a simple answer

Post by Curunir » Wed May 09, 2018 1:19 pm

Naaaaah, sound like I'll stick to alcove puzzles and scrolls, user-typed answers sound like one big mess to implement and I'm far from competent when it comes to scripting. :D

[Edit] Is there a way to check for a specific item on a floor trigger, or is that limited only to entities with the surface component? [/Edit]

User avatar
Mysterious
Posts: 226
Joined: Wed Nov 06, 2013 8:31 am

Re: Ask a simple question, get a simple answer

Post by Mysterious » Thu May 10, 2018 5:45 am

Hi all.

Ok I know that Champion:trainSkill(name, times) adds a Skill and Points to the Skill but, how do I remove a Skill from a champ EG: air_magic or any other Skill they have..?

I am using this script to change my Champs:

Code: Select all

local c = party.party:getChampion(1)

--- Champ 1 ---
c:setName('Tifa Lockhart')
c:setClass('fighter')
c:setRace('ratling')
c:setSex('female') 
---Items---
c:insertItem(3,spawn("peasant_cap").item)
c:insertItem(4,spawn("peasant_tunic").item)
c:insertItem(5,spawn("peasant_breeches").item)
c:insertItem(6,spawn("sandals").item)
c:insertItem(14,spawn("party_start_note_1").item)
c:setPortrait('assets/textures/portraits/ratling_female_03.tga')
c:addTrait('orges_mule')
c:removeTrait('agile')
c:setBaseStat('strength',16) 

-- Champ 2 ---
local c = party.party:getChampion(2)
c:setName('Fiddler Flint')
c:setClass('rogue')
c:setRace('ratling')
c:setSex('male')
--- Items ---
c:insertItem(3,spawn("peasant_cap").item)
c:insertItem(4,spawn("peasant_tunic").item)
c:insertItem(5,spawn("peasant_breeches").item)
c:insertItem(6,spawn("sandals").item)
c:setPortrait('assets/textures/portraits/ratling_male_04.tga')
c:trainSkill('missile_weapons',1)
c:trainSkill('throwing',1)
c:trainSkill('firearms',1)
c:setBaseStat('strength',12)
c:removeTrait('head_hunter')
c:addTrait('agile')

--- Champ 3 ---
local c = party.party:getChampion(3)
c:setName('Thourun Wisthoff')
c:setClass('wizard')
c:setRace('ratling')
c:setSex('male')
---Items---
c:insertItem(14,spawn("scroll_fireburst").item)
c:insertItem(3,spawn("peasant_cap").item)
c:insertItem(4,spawn("peasant_tunic").item)
c:insertItem(5,spawn("peasant_breeches").item)
c:insertItem(6,spawn("sandals").item)
c:setPortrait('assets/textures/portraits/ratling_male_06.tga')
c:trainSkill('fire_magic',1)
c:trainSkill('earth_magic',1)
c:trainSkill('firearms',-1)
c:trainSkill('concentration',1)
c:setSkillPoints(0) 
c:setBaseStat('strength',8)
c:removeTrait('tough')
c:addTrait('strong_mind')

--Champ 4--
local c = party.party:getChampion(4)
c:setName('Zala Lockhart')
c:setClass('alchemist')
c:setRace('ratling')
c:setSex('female')
c:insertItem(3,spawn("peasant_cap").item)
c:insertItem(4,spawn("peasant_tunic").item)
c:insertItem(5,spawn("peasant_breeches").item)
c:insertItem(6,spawn("sandals").item)
c:setPortrait('assets/textures/portraits/ratling_female_04.tga')
c:trainSkill('alchemy',2)

User avatar
akroma222
Posts: 1025
Joined: Thu Oct 04, 2012 10:08 am

Re: Ask a simple question, get a simple answer

Post by akroma222 » Thu May 10, 2018 6:03 am

Mysterious wrote:how do I remove a Skill from a champ EG: air_magic or any other Skill they have..?
Any skills that you have defined in a lua script and imported from your init.lua, ie:

Code: Select all

import "mod_assets/scripts/party/skills.lua"
will be displayed in the champion Skills menu tab
If you want to remove a skill from your mod entirely, do not include it in your skills.lua
(and dont import the asset pack's skills.lua either - you will need to re-add the skills you want from the asset pack in your own skills.lua)

To reduce the level of a skill, use:

Code: Select all

champion:trainSkill('throwing', -1)
Of interest here - minmay has pointed out that the game actually records skill levels beyond level 5 :idea:

Also, here is a script I put together - originally adapted from minmays work with managing Traits - that will manage skill bonuses being added and removed from champions cleanly (without messing up the skill levels)
viewtopic.php?f=22&t=9024&p=88389&hilit ... ger#p88389

User avatar
Curunir
Posts: 332
Joined: Fri Mar 30, 2012 11:19 pm

Re: Ask a simple question, get a simple answer

Post by Curunir » Thu May 10, 2018 9:55 am

Is there any reason why the dungeon_wall_lantern model is floating in the air? The metal casing is not attached to the wall and you can see it floating in space if you stand 1 tile away and look at it.

I dug up the asset pack and the Model class of the asset definition for the lantern has offset = vec(0, 1.5 + 0.2, 0 - 0.2),

To compare, the regular torch_holder's socket has a model offset of offset = vec(0.05, 1.53, -0.25),

I won't even pretend I understand how those values are reflected in the worldspace, but I sort of want to fix the floating lantern definition, if possible. Again, I have no idea if this is not something that cannot be fixed because I haven't seen anyone else make a fuss about it.

User avatar
Xardas
Posts: 83
Joined: Fri Jul 28, 2017 12:30 am

Re: Ask a simple question, get a simple answer

Post by Xardas » Thu May 10, 2018 1:56 pm

The world has 3 axes (x,y,z). With the offset vector, it is possible to give the object an offset. That means you can move it along the axes, starting at the location you actually placed it. It is also possible to rotate an object in 3 directions.

Just change some of the values and you will see the result.
In order to get to the other side of the pit you have to get hit by the fireball and die....
Yep.....moving on!

User avatar
Khollik
Posts: 164
Joined: Tue Aug 29, 2017 6:44 pm
Location: France

Re: Ask a simple question, get a simple answer

Post by Khollik » Thu May 10, 2018 3:35 pm

Hi Curunir

I had the same issue. Thanks to Isaac I managed to find a way to reposition the lanterns with the functions GetWorldPosition() and SetWorldPosition(). I put a floortrigger at the starting location of the party with a script to move the lanterns. It's quite tedious for I had to do it for every lantern in the game :roll: but at least it works. Surely there is a easier solution.

Cheers
Khollik

User avatar
Curunir
Posts: 332
Joined: Fri Mar 30, 2012 11:19 pm

Re: Ask a simple question, get a simple answer

Post by Curunir » Thu May 10, 2018 4:15 pm

Khollik wrote:Hi Curunir

I had the same issue. Thanks to Isaac I managed to find a way to reposition the lanterns with the functions GetWorldPosition() and SetWorldPosition(). I put a floortrigger at the starting location of the party with a script to move the lanterns. It's quite tedious for I had to do it for every lantern in the game :roll: but at least it works. Surely there is a easier solution.

Cheers
Khollik
Can't you just redefine the object if you're using it in a mod? If you have the proper coordinates, I'd be super grateful!

User avatar
Isaac
Posts: 3005
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac » Fri May 11, 2018 7:53 am

Question: Is it possible to define an object with a custom editor icon?

(Is it possible to assign a custom editor Icon atlas?)

Post Reply