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: 2697
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay » Sat Nov 14, 2020 9:29 pm

Isaac wrote:
Sat Nov 14, 2020 5:07 am
Example; start a new project/map, and place a dungeon_floor_01 object on elevation level 1 so that you can look upwards at it. Type the following into the console.

Code: Select all

dungeon_floor_01_1.model:setRotationAngles(0,0,180)
If you are only using a few of these, then it makes sense to just script the change in a script _entity.
This will break as soon as the player saves and reloads the game, since dungeon_floor_01 has minimalSaveState.
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.

ratman
Posts: 137
Joined: Fri Jan 10, 2020 1:13 am

Re: Ask a simple question, get a simple answer

Post by ratman » Sun Nov 15, 2020 12:45 am

How would I make it so the skills have more than 5 levels? (Or is this even possible?)

minmay
Posts: 2697
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay » Sun Nov 15, 2020 1:51 am

Only possible with EquipmentItemComponent, and only in a very limited way; see http://www.grimrock.net/forum/viewtopic ... 22&t=14529
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
Isaac
Posts: 2994
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac » Sun Nov 15, 2020 3:11 am

minmay wrote:
Sat Nov 14, 2020 9:29 pm
This will break as soon as the player saves and reloads the game, since dungeon_floor_01 has minimalSaveState.
Yeah, and it would have to be done again.

It needs to be put in a script function and called with each load... or use the defined asset.

ratman
Posts: 137
Joined: Fri Jan 10, 2020 1:13 am

Re: Ask a simple question, get a simple answer

Post by ratman » Sun Nov 15, 2020 3:57 am

minmay wrote:
Sun Nov 15, 2020 1:51 am
Only possible with EquipmentItemComponent, and only in a very limited way; see http://www.grimrock.net/forum/viewtopic ... 22&t=14529
The only reasons this could ever be useful are the builtin light_weapons, heavy_weapons, missile_weapons, throwing, firearms, and magic skills since you can't cleanly recreate their effects using the scripting interface. Other than that it would be better to use your own skill system.
How would I create my own skill system?

User avatar
7Soul
Posts: 166
Joined: Sun Oct 19, 2014 1:56 am
Location: Brazil

Re: Ask a simple question, get a simple answer

Post by 7Soul » Sun Nov 15, 2020 4:17 am

ratman wrote:
Sun Nov 15, 2020 3:57 am
minmay wrote:
Sun Nov 15, 2020 1:51 am
Only possible with EquipmentItemComponent, and only in a very limited way; see http://www.grimrock.net/forum/viewtopic ... 22&t=14529
The only reasons this could ever be useful are the builtin light_weapons, heavy_weapons, missile_weapons, throwing, firearms, and magic skills since you can't cleanly recreate their effects using the scripting interface. Other than that it would be better to use your own skill system.
How would I create my own skill system?
You could use my mod as reference, unless someone has a cleaner example
Join the LoG discord server: https://discord.gg/ArgAgNN :D

My Mod The Old Nexus (wip)

ratman
Posts: 137
Joined: Fri Jan 10, 2020 1:13 am

Re: Ask a simple question, get a simple answer

Post by ratman » Sun Nov 15, 2020 4:34 pm

How would I make it so it costs 1 skill point for the first level, 2 for the second, and so on? (I don't want to completely steal your script :lol:

edit: Also how do I make my own skills? I can define them and make it so at a certain level they get a trait, but how do I make it so they get something every level?

Code: Select all

defineSkill{
	name = "water_magic",
	uiName = "Water Magic",
	priority = 160,
	icon = 32,
	description = "Increases damage of water spells by 20% for each skill point. At 5th skill level you gain Resist Cold +50.",
	traits = { [5] = "water_mastery" },
}
In water magic, in the description it says they get water spell damage increase by 20% but where does it actually do this in the code?

User avatar
7Soul
Posts: 166
Joined: Sun Oct 19, 2014 1:56 am
Location: Brazil

Re: Ask a simple question, get a simple answer

Post by 7Soul » Sun Nov 15, 2020 5:49 pm

ratman wrote:
Sun Nov 15, 2020 4:34 pm
How would I make it so it costs 1 skill point for the first level, 2 for the second, and so on? (I don't want to completely steal your script :lol:

edit: Also how do I make my own skills? I can define them and make it so at a certain level they get a trait, but how do I make it so they get something every level?

Code: Select all

defineSkill{
	name = "water_magic",
	uiName = "Water Magic",
	priority = 160,
	icon = 32,
	description = "Increases damage of water spells by 20% for each skill point. At 5th skill level you gain Resist Cold +50.",
	traits = { [5] = "water_mastery" },
}
In water magic, in the description it says they get water spell damage increase by 20% but where does it actually do this in the code?
A lot of the skill effects are hard-coded, like the % damage bonuses and % armor bonus. The Magic of Grimrock script recreates the spells so you could change how the bonus works on them
Join the LoG discord server: https://discord.gg/ArgAgNN :D

My Mod The Old Nexus (wip)

ratman
Posts: 137
Joined: Fri Jan 10, 2020 1:13 am

Re: Ask a simple question, get a simple answer

Post by ratman » Sun Nov 15, 2020 5:52 pm

Thanks, I guess I'll just make it so it gives a trait every time.
*what about how to make it so the skills cost more points the higher the level?

User avatar
7Soul
Posts: 166
Joined: Sun Oct 19, 2014 1:56 am
Location: Brazil

Re: Ask a simple question, get a simple answer

Post by 7Soul » Sun Nov 15, 2020 7:21 pm

ratman wrote:
Sun Nov 15, 2020 5:52 pm
Thanks, I guess I'll just make it so it gives a trait every time.
*what about how to make it so the skills cost more points the higher the level?
In the functions.lua of my mod, look for addSkillTemp, removeSkillTemp and clearSkillTemp. The line champion:setSkillPoints(champion:getSkillPoints() - 1) takes away one point. You can add a check for how many skill points the champion has and compare with the skill level, then make it subtract the skill level from it instead of 1
Join the LoG discord server: https://discord.gg/ArgAgNN :D

My Mod The Old Nexus (wip)

Post Reply