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

Re: Ask a simple question, get a simple answer

Post by Isaac »

So is this sword on a pedestal or other surface [a one time check], or do you intend that they be checked every single time they try to lift it; even from the floor, if they set it down? What should happen if the only champion strong enough to hold it, loses some of their strength and is no longer strong enough while it's equipped, or in inventory?

*Is this solvable without script, by simply by increasing the assigned weight of the item? [Make the sword weigh 150kg for example.]
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Ask a simple question, get a simple answer

Post by bongobeat »

Isaac wrote: Sun Aug 30, 2020 2:14 am So is this sword on a pedestal or other surface [a one time check], or do you intend that they be checked every single time they try to lift it; even from the floor, if they set it down? What should happen if the only champion strong enough to hold it, loses some of their strength and is no longer strong enough while it's equipped, or in inventory?

*Is this solvable without script, by simply by increasing the assigned weight of the item? [Make the sword weigh 150kg for example.]

I've changed my mind about the whole thing.

The stats checking coud be too much restrictive, it would be better if the script check if a character has a certain trait.


1°) Sword is placed in a fake altar with worldPosition and rotation or placed on a true altar if necessary.
2°) I put an invisible button before the sword/pedestal, so that the player touch only the button, and cannot touch the sword.
3°) The button trigger the script that check the party if any member has the right trait.
4°) If yes, the button is destroyed, and only the champion who has the trait can use the word.
5°) The trait will be given by drinking a potion, that only warriors can drank, warriors class are fighter, barbarian or knight.


Edit:
So, basicaly I've done everything except one thing: That only the champion who has the special trait can use that sword.
I don't know how to link the item and the trait together.


This is for the special potion that will give a trait to any warrior:
SpoilerShow

Code: Select all

defineObject{
	name = "potion_golden_claymore_bearer",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/flask_large.fbx",
		},
		{
			class = "Item",
			uiName = "Potion of Raw Power",
			gfxIndex = 414,
			weight = 0.5,
			description = "A mysterious potion of raw power, whose ingestion could have side effect if the person who drinks it is not strong enough.",
			gameEffect = "Only a true warrior can drink such potion.",
		},
{
	class = "UsableItem",
	sound = "level_up",
	onUseItem = function(self, champion)
		if champion:hasTrait("barbarian") or champion:hasTrait("fighter") or champion:hasTrait("knight") then
			hudPrint(champion:getName().." drinked the potion.")
			champion:addTrait("golden_claymore_holder")
			champion:upgradeBaseStat("strength", 1)
			hudPrint(champion:getName().." loose 35 Health.")
			champion:modifyBaseStat("max_health", -35)
			champion:modifyBaseStat("health", -35)
			return true
		else 				
			hudPrint(champion:getName().." is not a true warrior and can't drink this.")
			return false
			end
		end,
},
		{
			class = "Particle",
			particleSystem = "potion_of_strength",
		},
	},
}
That's as far I can go, I really need help for the next script, I suppose it would be in the sword definition. :x :roll: :( :?: :D
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
kelly1111
Posts: 349
Joined: Sun Jan 20, 2013 6:28 pm

Re: Ask a simple question, get a simple answer

Post by kelly1111 »

Question for minmay. I saw somewhere that you made a stairs asset that was walkable in more directions then up and down and without the camara fade in/ out. Will this be released in you mod or maybe asset pack in the future?
User avatar
Zo Kath Ra
Posts: 937
Joined: Sat Apr 21, 2012 9:57 am
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Zo Kath Ra »

bongobeat wrote: Sun Aug 30, 2020 11:52 am This is for the special potion that will give a trait to any warrior:
SpoilerShow

Code: Select all

defineObject{
	name = "potion_golden_claymore_bearer",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/flask_large.fbx",
		},
		{
			class = "Item",
			uiName = "Potion of Raw Power",
			gfxIndex = 414,
			weight = 0.5,
			description = "A mysterious potion of raw power, whose ingestion could have side effect if the person who drinks it is not strong enough.",
			gameEffect = "Only a true warrior can drink such potion.",
		},
{
	class = "UsableItem",
	sound = "level_up",
	onUseItem = function(self, champion)
		if champion:hasTrait("barbarian") or champion:hasTrait("fighter") or champion:hasTrait("knight") then
			hudPrint(champion:getName().." drinked the potion.")
			champion:addTrait("golden_claymore_holder")
			champion:upgradeBaseStat("strength", 1)
			hudPrint(champion:getName().." loose 35 Health.")
			champion:modifyBaseStat("max_health", -35)
			champion:modifyBaseStat("health", -35)
			return true
		else 				
			hudPrint(champion:getName().." is not a true warrior and can't drink this.")
			return false
			end
		end,
},
		{
			class = "Particle",
			particleSystem = "potion_of_strength",
		},
	},
}
That's as far I can go, I really need help for the next script, I suppose it would be in the sword definition. :x :roll: :( :?: :D
champion:modifyBaseStat("max_health", -35)
champion:modifyBaseStat("health", -35)

I'd remove the second line, because:
- reducing max_health automatically reduces health, if (health_old > max_health_new)
- the second line always takes away health that the champion should keep

Not to mention the edge case:
max_health <= 35

edit:
drinked the potion => has drunk
loose 35 Health => has lost

Or, if you want to use the present tense:
drinked the potion => drinks
loose 35 Health => loses
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

kelly1111 wrote: Fri Sep 04, 2020 10:21 am Question for minmay. I saw somewhere that you made a stairs asset that was walkable in more directions then up and down and without the camara fade in/ out. Will this be released in you mod or maybe asset pack in the future?
I believe we went over this before!

You don't need the model, it was literally just the dungeon stairs model with the walls taken out and with the top aligned to the 3x3x3 grid.
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: 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've run into a weird issue:

I've defined a new secret door with a new model. As far as I can see I've copied all parts of the definition from a secret door of the original game. My door does work and look like expected - except of that is does not block thrown items.

Is something special required from the model? That's the only thing I can think of (it has a door node of course).

Or can be because of the material, which is transparent?

I'm clueless...
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

Does your model match the nodes for the secret_door model?

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

Re: Ask a simple question, get a simple answer

Post by minmay »

Specifically, every door model should have a node named "gate", which is used to determine collisions. Without a gate node (or with an empty gate node), projectiles won't collide with the door at all.
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.
Scantrahan
Posts: 2
Joined: Fri Sep 18, 2020 6:52 pm

Re: Ask a simple question, get a simple answer

Post by Scantrahan »

Hi, new poster here. I'm wondering if anyone would have any advice on how to take the undying cube model from the in game assets and convert it into a file suitable for 3d printing ( STL, OBJ, X3D, 3MF) and whether or no blender is the tool I need for that.

EDIT - Using the GMT, will report on success
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

Welcome!

The GMT will export the model as an OBJ file, but there is a very good Blender plugin here that will import the .model files directly.

http://www.grimrock.net/forum/viewtopic ... 6&p=122300

*Note!! This plugin requires an older version of Blender to work; you need version Blender 2.72 —or it will mangle the mesh.

https://download.blender.org/release/Blender2.72/

You can have more than one version of Blender installed; just have them in different folders.
Post Reply