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
THOM
Posts: 1181
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM » Sun Feb 21, 2021 6:39 pm

Not sure if I exactly understand, what you mean.

You want to have the definition and/or the list of available shop items in a seperate file?

It will probably be easier if you tell us what your intention is.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download

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

Re: Ask a simple question, get a simple answer

Post by Isaac » Mon Feb 22, 2021 12:33 am

Cerv wrote:
Sun Feb 21, 2021 4:07 pm
...can put table with shop items outside of dat file...
Everything has to be in the dat file afaik; U-Mods aside—as I don't know but assume they could. I have no experience with them yet.

User avatar
Cerv
Posts: 2
Joined: Tue Feb 16, 2021 6:38 pm

Re: Ask a simple question, get a simple answer

Post by Cerv » Mon Feb 22, 2021 9:50 am

THOM wrote:
Sun Feb 21, 2021 6:39 pm
Not sure if I exactly understand, what you mean.

You want to have the definition and/or the list of available shop items in a seperate file?

It will probably be easier if you tell us what your intention is.
Well, my intension is this: If I can put shop table outside of main dat file, then I can probably manage it for more then one player.
for example if more players will buy or sell one thing frequentaly then price will come up or down, and more plain example if some one sell item then it can appear in all others shop, till someone else buy it again...
well very simple economics...

User avatar
Lorial
Posts: 79
Joined: Sat Dec 29, 2018 12:27 pm

Re: Ask a simple question, get a simple answer

Post by Lorial » Mon Feb 22, 2021 6:57 pm

1) Is there a way to find and list all secrets on a specific level and hudPrint them or the count/amount? The secret item also has the secret component parameter. Might be useful for all kinds of searches for amount X for balancing/item placement purposes or to keep track of ammo/food scattered.

2) When disabling the "door" feature of a wall after it has been opened/lowered, could this cause any issues? Can this be added to a specific object's definition to turn walls/doors into single use items? Perhaps an onActivate function added to the definition?!

3) Speaking of single use items: Usually I used a script for a lever to change its component to become unclickable in order to lock it in place. Is there a way to use a single script which operates as "disable clickable on self" for all connected levers/buttons?

4) How exactly do I stop a looping sound that started playing via script without defining the sound as "loop=false"? So is there a command that counters the self.go:playSound("X")? Destroying the script entity itself does nothing once the sound has started.
After a bit of testing I realized that simply destroying sound items works, this also removes the annoying bug of recurring sounds when re-entering a level (e.g. constant trickster laughing).

User avatar
THOM
Posts: 1181
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM » Tue Feb 23, 2021 1:34 pm

Cerv wrote:
Mon Feb 22, 2021 9:50 am
Well, my intension is this: If I can put shop table outside of main dat file, then I can probably manage it for more then one player.
for example if more players will buy or sell one thing frequentaly then price will come up or down, and more plain example if some one sell item then it can appear in all others shop, till someone else buy it again...
well very simple economics...
I'm not sure, if there is a way to include an external file into a running game. And your idea would mean in addition, that the game makes an online connection to look into a file somewhere in a cloud or so. I doubt, that this is possible.

@Lorial:

1) you want to seach through gameobjects in the game? Why? In the editor you can list objects/items by using Ctrl F
2) I don't understand why you want to disable a door component. What is your intention in doing this? What do you mean by "single use item"? (Mind that an item in the game is somehing that the champion can pick up and carry away. Do you mean an object (a door), that can be used just once?)
3) Levers can be disabled by disabeling certain components of it. I don't understand, what you mean by "a way to use a single script". Do you mean one single command to do this? There is none.
4) A sound component can be stopped by using sound:stop() or sound:fadeOut(9) [while 9 is the fadeout time in seconds]. I'm not sure if this helps on your purposes. I'm not aware of a way to stop the looped sound itself (making it not looped anymore). Your way may work. But I don't know, why this would be needed.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download

User avatar
Lorial
Posts: 79
Joined: Sat Dec 29, 2018 12:27 pm

Re: Ask a simple question, get a simple answer

Post by Lorial » Tue Feb 23, 2021 8:25 pm

@Thom

1) Damnit, forgot about the search function entirely, been a while since I used the editor, but that will do the trick, thanks.
2) The problem is a bug that closes ruins_secret_doors despite it not being defined as minimalSaveState after loading and reentering a level. Disabling the door component could potentially be a solution if it kept its opened state and function as a gate only from then one.
3) So I can use a script making a lever unclickable, but I cannot add a function to the object definition itself that, upon activation, renders itself unclickable? This would also tie in to 2) which removed the door component.
4) This is needed when you use sound items in your mod and re-enter a level which makes the sounds placed on that level replay every time, despite the sound component being unchecked. Destroying them is one option which I just discovered after posting the question.
When looping sounds are used/activated, a command to stop them is necessary, otherwise they will play indefinitely within range.

User avatar
THOM
Posts: 1181
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM » Tue Feb 23, 2021 8:44 pm

Wa? The not present minimalSaveState should keep a door from being not in the state you have left it. Every door stays open or close as it was when reloaded.

Concerning the lever: I'm a bit lazy at the moment to write a script, but if you use the onActivate hook in its definition, you should be able to deactivate it entirely after the first use.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download

bongobeat
Posts: 966
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: Ask a simple question, get a simple answer

Post by bongobeat » Wed Feb 24, 2021 4:32 pm

I've got a bug with firearms, and I can't find a possible way to resolve it:

When shooting on the west direction, the shots are blocked like if there was an obstacle in front of the party, but there are none.
It is on this level, but I've noticed it on some other level too. And it is on a specific place of the level

Like here:
Party is on a dungeon floor, with no wall/ceiling/pillars but beach rocks on the side, there is a beach porticullis behind, and in front of the party is a swamp heightmap floor, and the next obstacle, even if it block shots, is 3 tiles far, so, shots should at least go on the 2 next tiles.
The obstacle is a plant with a special blockage that let pass monsters but not the party, nor spells or throwing items.

Image

the editor map:
Image

when firing:
Image

If i do the same thing, but behind the party, or on the side, the item works perfectly, of course with the door opened. It seems the bug come from the west direction. So I've got the feeling that this doesn't come from the level design but something else.

I've removed the door behind, but that doesn't resolve anything.

In case of need, here is the definition of the firearms. The bug occurs with other firearms, like repeater or basic rifle.
SpoilerShow

Code: Select all

defineObject{
	name = "machinegun",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/repeater.fbx",
			material = "machinegun",
		},
		{
			class = "Item",
			uiName = "Machine Gun MK1",
			description = "A crude but effective Dwarvish firearm. Also known as the \"Dwarvish Nightmare\" for its ability to fire bullets in very quick bursts.",
			gfxAtlas = "mod_assets/textures/oliveitem.tga",
			gfxIndex = 25,
			gfxIndexPowerAttack = 97,
			impactSound = "impact_blunt",
			weight = 4.0,
			secondaryAction = "reload_weapon",
			traits = { "firearm", "rifle", "modern" },
             onUnequipItem = function(self,champion,slot)
	party.riflemanScript.weaponUnequip(self,champion,slot)
             end,
		},
		{
			class = "FirearmAttack",
			attackPower = 40,
			pierce = 30,
			cooldown = 6,
--			attackSound = "gun_shot_small",
			attackSound = "machinegun2",
			clipSize = 80,
			ammo = "bullet",
			repeatCount = 10,
			repeatDelay = 0.08,
			jamChance = 15,
			requirements = { "firearms", 3 , "modernweapon", 1},
			range = 20,
		},
		{
			class = "ReloadFirearm",
			uiName = "Reload",
			name = "reload_weapon",
			requirements = { "modernweapon", 1 },
			gameEffect = "Reloads the weapon with 80 bullets."
		},
	},
}
the blocker:
it is used to blcok party, spells and items, but monsters can pas trough it
SpoilerShow

Code: Select all

defineObject{
	name = "ghost_blocker_party",
	components = {
		{
			class = "Obstacle",
			hitSound = "impact_punch",
			hitEffect = "hit_wood",
			blockParty = true,
			blockItems = true,
			blockMonsters = false,
		},
		{
			class = "ProjectileCollider",
			size = vec(3, 3, 3),
		},
--		{
--			class = "Controller",
--			onActivate = function(self)
--				self.go.obstacle:enable()
--				self.go.projectilecollider:enable()
--			end,
--			onDeactivate = function(self)
--				self.go.projectilecollider:disable()
--				self.go.obstacle:disable()
--			end,
--			onToggle = function(self)
--				if self.go.obstacle:isEnabled() then
--					self.go.obstacle:disable()
--				else
--					self.go.obstacle:enable()
--				end
--			end,
--		},
	},
	tags = { "scripting" },
	placement = "floor",
	editorIcon = 96,
	minimalSaveState = true,
}
Last edited by bongobeat on Wed Feb 24, 2021 8:02 pm, edited 1 time in total.
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505

User avatar
maneus
Posts: 235
Joined: Mon Jun 17, 2013 10:42 pm
Location: Switzerland

Re: Ask a simple question, get a simple answer

Post by maneus » Wed Feb 24, 2021 4:38 pm

Does it also didnt work if you delete the beach rocks?
What is, if you turn the door behind the party at 180 degree?

User avatar
THOM
Posts: 1181
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM » Wed Feb 24, 2021 5:14 pm

Good point, maneus.
I've in addition thought if anything with other custom objects may cause the problem. Maybe one has a door component or a ProjectileCollider. Maybe with an offset.

A good way would be to delete all objects one by one and see, if anything changes when doing it.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download

Post Reply