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
Eleven Warrior
Posts: 746
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Ask a simple question, get a simple answer

Post by Eleven Warrior »

THOM wrote: Sat Sep 21, 2019 9:18 am

Code: Select all

function champXP()
for i=1,4 do
	local ch = party.party:getChampion(i)
	if ch:isAlive() then
		ch:gainExp(50)
		hudPrint(" "..ch:getName().." gained 50 XP.")
	end
end
playSound("level_up")
end
Ty Thom
User avatar
Eleven Warrior
Posts: 746
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Ask a simple question, get a simple answer

Post by Eleven Warrior »

Ty Thom :)
User avatar
Eleven Warrior
Posts: 746
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Ask a simple question, get a simple answer

Post by Eleven Warrior »

How do I add the champs name to the hudPrint (below) ty.

Code: Select all

defineObject{
	name = "itm_food_cheese_big",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "mod_assets/models/items/food/cheese_big.fbx",
		},
		{
			class = "Item",
			uiName = "Big Cheese",
			gfxAtlas = "mod_assets/textures/gui/gui_icons_food.tga",
			gfxIndex = 2,
			weight = 0.5,
			description = "Big extra tasty cheese.",
			traits = { "consumable" },
		},
		{
			class = "UsableItem",
			onUseItem = function(self, champion) --- Champ 1 or 2 to 4 names show when the eat the cheese ---
				hudPrint("eats the cheese")
			end,
			nutritionValue = 250,
		},
	},
	tags = { "item_food" },
}
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 »

Code: Select all

hudPrint(champion:getName() .. " won't eat that.")
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

I've come to the point where I want to start removing default assets to lighten the load in anticipation of more custom stuff to add.

When I look at other dungeon files they simply remove the line standard_assets and then start adding a bunch of default stuff they still want to use line by line. I don't want this. (Well, not unless this is the only way)

I want to do the exact opposite if that's possible. Simply copy the entire asset pack v2 in my mod file
and then change

import "assets/scripts/standard_assets.lua"
into
import "mod_assets/assets/scripts/standard_assets.lua" (the location of the asset pack v2)

And then simply start removing the crap I don't need in that folder.

So my first question: Is this even remotely possible what I'm trying to achieve?

For example the first thing I want to exclude is the default music while keeping everything else intact.

Any advice on how to proceed?

So my 2nd question: how should my init file look like if my stupid idea is impossible to execute and for example I want everything "default assets" intact with only the default ogg sound tracks removed.
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 »

Any file in the folder "assets" can't be touched by you directly.

What you indeed can do ist copy the definition files from the assets pack in your mod_assets folder, set an init link to it and delete the line import "assets/scripts/standard_assets.lua" in the file mod_assets\scripts\init.lua

Then remove or modify everything you want.

I would suggest not to re-import everything you need anyway. It's done by deafult. Just use an own file for assets you want to delet or modify.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

Is there a list somewhere with every init line of all default assets chopped up in their respective init lines?

Because I need to see this visually to understand it.

All I want for now is all default assets still active with the only exception that removes: import "assets/scripts/ambient_tracks.lua"

Edit: I just found the standard_assets notepad file. I'm beginning to understand.
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 »

Just make edits [and omissions] to a copy of the standard_assets.lua file from the asset pack, and replace the call to include it in your init file, with calling your edited copy instead.

For example, if you don't use the Tomb tile-set, then you can remove it from the edited standard_assets.lua.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

Isaac wrote: Tue Sep 24, 2019 4:15 pm Just make edits [and omissions] to a copy of the standard_assets.lua file from the asset pack, and replace the call to include it in your init file, with calling your edited copy instead.

For example, if you don't use the Tomb tile-set, then you can remove it from the edited standard_assets.lua.
Yes, that's what I finally understood. Currently I'm preparing my mod for this change. Changing all music in my maps to my custom ones before I remove the ambient line.
Pompidom
Posts: 497
Joined: Sun May 06, 2018 9:42 pm

Re: Ask a simple question, get a simple answer

Post by Pompidom »

Code: Select all

-- import standard assets
import "mod_assets/scripts/standard_assets.lua"
import "assets/scripts/objects/base.lua"
import "assets/scripts/objects/generic.lua"
import "assets/scripts/spells/blob.lua"
import "assets/scripts/monsters/skeleton_knight_trooper.lua"
import "assets/scripts/monsters/uggardian.lua"
I removed import "assets/scripts/standard_assets.lua"
I copied the standard assets notepad file into my script folder.
I removed the ambient track line in the copied "standard_assets.lua" notepad file
And I called the modded standard_assets.lua instead of the default one.

I start up the dungeon editor. I load up my mod and I'm still able to select the default ambient tracks like forest and lindworm /undead etc... default ambient tracks and they play just fine.

What am I doing wrong?
Post Reply