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!
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

I have placed some tents around my mod. I believe they're from zim's assets. when you click on them your party starts resting.

Is there a way to disable resting everywhere else?

I found that
return false from PartyComponent.onRest hook
will do the trick, but I have no idea in which file i have to change this line.
and will this also disable resting from the tents?
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Ask a simple question, get a simple answer

Post by akroma222 »

Pompidom wrote: Thu Jul 26, 2018 1:43 pm but I have no idea in which file i have to change this line.
It depends on which file you keep your party definition and hooks in....
Have you written any code for any of the hooks yet?
Party Hooks :
SpoilerShow

Code: Select all

PartyComponent.onCastSpell(self, champion, spell) 	
PartyComponent.onDamage(self, champion, damage, damageType) 	
PartyComponent.onDie(self, champion) 	
PartyComponent.onAttack(self, champion, action, slot) 	
PartyComponent.onLevelUp(self, champion) 	
PartyComponent.onReceiveCondition(self, champion, condition) 	
PartyComponent.onDrawGui(self, context) 	
PartyComponent.onDrawInventory(self, context, champion) 	
PartyComponent.onDrawStats(self, context, champion) 	
PartyComponent.onDrawSkills(self, context, champion) 	
PartyComponent.onDrawTraits(self, context, champion) 	
PartyComponent.onPickUpItem(self, item) 	
PartyComponent.onProjectileHit(self, champion, item, damage, damageType) 	
PartyComponent.onRest(self) 	
PartyComponent.onWakeUp(self) 	
PartyComponent.onTurn(self, direction) 	
PartyComponent.onMove(self, direction)
For example, Ive written my party hooks in the init.lua file
(Zimber's mod files, for example, have the party def + hooks kept in a lua file called zim_party.lua - and he just imports zim_party.lua from his init.lua file)
Would you like to look over such a def / hook file??

To manipulate the outcome when the onRest hook fires.... check to see if the tent is in front of the party, if it is then return false
This example includes the hook as part of a (very brief) party definition
Party hooks are just listed one after the other like this :
SpoilerShow

Code: Select all

defineObject{
	name = "party",
	baseObject = "party",
	components = {
		class = "Party",
		
		onRest = function(self)
			local dx,dy = getForward(self.go.facing)
			if party.x + dx == tent_1.x 
			and party.y + dy == tent_1.y 
			and party.level == tent_1.level 
			and party.elevation == tent_1.elevation then
				print("stop tent sleep")
				return false
			end
		end,
		
		onReceiveCondition(self, champion, condition) 	
			-- do condition stuff here
		end,
		
		onProjectileHit(self, champion, item, damage, damageType) 	
			-- do projectile stuff here
		end,
	},
}
Alternatively, you can make the same check as a condition for the party being able to rest (ie you can only sleep in tents)
Here is 2 ways of doing that through the onRest hook :
SpoilerShow

Code: Select all

onRest = function(self)
	local dx,dy = getForward(self.go.facing)
	if not party.x + dx == tent_1.x 
	or not party.y + dy == tent_1.y 
	or not party.level == tent_1.level 
	or not party.elevation == tent_1.elevation then
		print("only tent sleep")
		return false
	end
end,

onRest = function(self)
	local dx,dy = getForward(self.go.facing)
	if party.x + dx == tent_1.x 
	and party.y + dy == tent_1.y 
	and party.level == tent_1.level 
	and party.elevation == tent_1.elevation then
		print("only tent sleep")
		--do party resting stuff here
	else
		return false
	end
end,
Enjoy!
Akroma
EDIT: elevation & level checks added
Last edited by akroma222 on Sun Jul 29, 2018 4:19 am, edited 1 time in total.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

So basically something I should just ignore until the very end. :lol:
Which is basically I do with everything I don't understand :) or unable to accomplish without holding hands help.

On the bright side :) I have started to make a boat, which allows me to create an "inside the boat" map :)
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Akroma, those hooks need to check whether the party is on the same level as the tent as well. You probably want to check elevation too.
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
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Ask a simple question, get a simple answer

Post by akroma222 »

minmay wrote: Sat Jul 28, 2018 9:00 pm Akroma, those hooks need to check whether the party is on the same level as the tent as well. You probably want to check elevation too.
You're right, I do! Haha :lol: :oops: Thankyou!
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

I started making a new map where I want the player to walk through a waterfall into a cave exit that leads to an underground cave map.
The map is brand new and thus still empty and only a very rough sketch/try at it.
Also the screenshots are taken in lowest settings in low res.

https://ibb.co/c2n65p
https://ibb.co/n0fJkp

What are my options to make sure the cave stairs don't light up like a christmas tree because of the daylight that goes through everything?
Are there any day_sky blocker tiles/walls/ceilings or something like that?
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Ask a simple question, get a simple answer

Post by kelly1111 »

Question:
Does anyone know how to make a texture / surface look wet ingame?
I remember that someone made something like this a while back (ground surface) , but can't find the post anymore
Any tips are welcome

Looking for a wet stone surface
User avatar
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

I made it and you can find it in my Journey To Justice - Resource Pack.

Have a look here:

https://www.nexusmods.com/legendofgrimr ... ?tab=files

It's just a question of glossiness. You can set this value in the material definition for example to glossiness = 100,
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Ask a simple question, get a simple answer

Post by akroma222 »

Pompidom wrote: Sun Aug 12, 2018 1:05 pm I started making a new map where I want the player to walk through a waterfall into a cave exit that leads to an underground cave map.
Sorry I cant help with any of your specific questions, but here is a video of Skuggs' waterfall
https://www.youtube.com/watch?v=96v6ZV2R14I
Im not sure if Skuggs is still around, further; whether the waterfall is a shared asset.....

Also - Zimber created waterfall assets - I would download and take a look at his work too (your answers may lay there?)

Hope this helps
Akroma
User avatar
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

The waterfall of Skuggs will come with ORRR3. 8-)
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
Post Reply