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
Zo Kath Ra
Posts: 931
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra »

ratman wrote: Thu Dec 24, 2020 1:01 am Two more questions: first, if the player creates a party, changes the position of champion 1 and champion 2, then imports that party into a different mod, would the game remember the original Ordinal or make a new one based on the party's formation when it was imported?
You can test this yourself:

1) Start a new game with the default party

2) Run this code in the console:

Code: Select all

for i = 1, 4 do 
	local champion = party.party:getChampionByOrdinal(i) 
	print(i, champion:getName()) 
end 
3) Change the party order

4) Create a quicksave

5) Go back to the main menu and start a different mod, importing the party from the quicksave

6) Run the code from step 2 again
User avatar
THOM
Posts: 1266
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

Is there a way to make a socket accepting all kinds of an item but triggers an event only when one specific item is inserted? Means: you can put in e.g. gems of all colors but only red gems opens the door.

All solutions I can find are
- socket accepts all gems and triggers event with all of them
- socket accepts only red gems and refuses all others completely
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
minmay
Posts: 2768
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

Returning false from the socket's onInsertItem hook (not the onAcceptItem hook) should prevent its onInsertItem connectors from triggering, so you could use that.

Alternatively, if you'd rather do this without changing the item definition, just connect the socket to a script entity instead of directly to the door, and do this:

Code: Select all

function connectTheSocketToThisFunction(socket, item)
	if item and item.go.name == "red_gem" then
		your_door.controller:open()
	end
end
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: 1266
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 choosed the "return false in onInsertItem" solution. Works perfect.
Never expected that this could do the trick.
Thank you.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Ask a simple question, get a simple answer

Post by kelly1111 »

Phitt made an elevator in his the mine of Malan Veal mod. The elevator is essentialy a door (MineElevator.model) A very large slab of rock that moves down .. giving the impression that you are in an elevator. I don't really know how to formulate my question correctly. But I'll try. When I import that model into blender and export it again. It goes from 6.484 kb to 3.875kb ... and I havent modified a thing...

Then it stops working ingame. that is, it only moves the lenght of that a normal door would move up and down. When I copy phitt's model directly from his source files (not load it into blender) ..it is working just fine.

What does blender change when I export it ?

I am asking because I am trying to make my own similar elevator...
User avatar
maneus
Posts: 246
Joined: Mon Jun 17, 2013 10:42 pm
Location: Switzerland

Re: Ask a simple question, get a simple answer

Post by maneus »

Why not make your own animation in Blender for your elevator?

Is the shading of the faces smooth or flat after exporting? (because of the new filesize)

I for myself had often problems with importing animations in blender because of the new nodes the Importer creates (game_matrix, RootNode etc.). The animation dont have these nodes in the animation, so it often was a mess (for me). :lol:
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Ask a simple question, get a simple answer

Post by kelly1111 »

I think I will finally have to take a look at how to animate things and import them.... :)
User avatar
ratman
Posts: 158
Joined: Fri Jan 10, 2020 1:13 am

Re: Ask a simple question, get a simple answer

Post by ratman »

I don't know anything about modeling or animation, but on Nexus there is the Stairs and Elevator Demo that has some scripts that simulate the 'elevator' effect, and you could probably use it on your own model.
User avatar
Isaac
Posts: 3172
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

kelly1111 wrote: Sat Jan 09, 2021 2:26 pm I think I will finally have to take a look at how to animate things and import them.... :)
Here are links to three beginner Blender tutorials, and how to install the Blender plugin for importing Grimrock models.
SpoilerShow
*Note: Links are intentionally for an older version of Blender. The LoG exporter requires [at most] Blender version 2.72.

Absolute basics of Blender [2.78c]: https://www.youtube.com/watch?v=d5luANNKuEc

Basic modeling with Blender [2.78c]: https://www.youtube.com/watch?v=ICBP-7x7Chc

Basic animation with Blender [2.78c]: https://www.youtube.com/watch?v=GM1Fc-NTDsg
____________________________
Installing Bitcopy's Grimrock 1&2 model/animation import/export plugin for Blender 2.72.
[Updated by minmay!]


Forum post with the file link: http://www.grimrock.net/forum/viewtopic ... 62#p119735

Save the linked zip file (to your desktop), and from within Blender, open the user preferences, and select 'Install from file'.
SpoilerShow
Image
Select the zip file that was saved to your desktop.

New import/export options for Grimrock model and animation files should now exist in the Blender Import and Export menus.
SpoilerShow
Image
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Ask a simple question, get a simple answer

Post by kelly1111 »

thanks Isaac. I have it set up now. I will take a look at the tutorials
Post Reply