How to use custom assets?

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!
Post Reply
Orace
Posts: 76
Joined: Tue Jul 04, 2017 6:45 pm
Location: Italy

How to use custom assets?

Post by Orace »

Hi there, sorry for the newbye question :), i'm new to lua and i just don't get how to properly use a custom asset pack i downloaded...

I don't want to overwrite the base asset i have, i just want to "add" new items and see them in the editor list.

I tried to copy them inside folders of my dungeon (.model in model folder, .texture in texture folder, .lua in script folder) but nothing changed, they only work if i overwrite the base "mod_asset" folder with the new one.

Please if you have time explain me :D thanks in advance
User avatar
Xardas
Posts: 83
Joined: Fri Jul 28, 2017 12:30 am

Re: How to use custom assets?

Post by Xardas »

Usually there is an instruction on how to install the assets. It´s a textdocument in the same Folder.

In case there isn´t then it´s pretty much always the same Thing you have to do.
1. Copy the assets Folder you want to add to your dungeon into your mod assets Folder of your dungeon
2. Now search for your scripts Folder. There should be an init.lua inside.
3. Upen up the init.lua. Now you have to Import the assets Folder to that file.
This is the line which imports your standart assets

Code: Select all

import "assets/scripts/standard_assets.lua"
What you can do now is importing all of the lua files of the assets Folder to your init.lua just as you Import the standart assets.

But in most cases the guys who made the assets pack kept it simple to Import their assets and did that work for you by importing all lua files in one other lua file,
which is in the Folder.
So you just have to add that one lua file, in which the others are already imported. Just take a look at the files and you will see what i mean.
There should be just a few Import lines in there.
If you can´t find one then just add your own or add the files one by one to your init.lua
Just be sure to Import the correct path and everything should work fine then.

I hope i was helpful. Peace out! ;)
In order to get to the other side of the pit you have to get hit by the fireball and die....
Yep.....moving on!
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: How to use custom assets?

Post by akroma222 »

Welcome Orace!

Xardas has put you on the right track
Your init.lua (well, from a freshly generated dungeon) should look like this:
SpoilerShow

Code: Select all

-- This file has been generated by Dungeon Editor 2.2.4

-- import standard assets
import "assets/scripts/standard_assets.lua"

-- import custom assets
import "mod_assets/scripts/items.lua"
import "mod_assets/scripts/monsters.lua"
import "mod_assets/scripts/objects.lua"
import "mod_assets/scripts/tiles.lua"
import "mod_assets/scripts/recipes.lua"
import "mod_assets/scripts/spells.lua"
import "mod_assets/scripts/materials.lua"
import "mod_assets/scripts/sounds.lua"
If you want to manually import only some of the standard assets (instead of all)...
1. remove this line:

Code: Select all

import "assets/scripts/standard_assets.lua"
2. Then go the Asset Pack >> scripts folder and find: "standard_assets.lua"
It should contain the following:
SpoilerShow

Code: Select all

import "assets/scripts/objects/base.lua"

import "assets/scripts/tiles.lua"
import "assets/scripts/spells.lua"
import "assets/scripts/recipes.lua"
import "assets/scripts/sounds.lua"
import "assets/scripts/ambient_tracks.lua"
import "assets/scripts/races.lua"
import "assets/scripts/char_classes.lua"
import "assets/scripts/skills.lua"
import "assets/scripts/traits.lua"

-- import objects
import "assets/scripts/objects/generic.lua"
import "assets/scripts/objects/dungeon.lua"
import "assets/scripts/objects/tomb.lua"
import "assets/scripts/objects/mine.lua"
import "assets/scripts/objects/forest.lua"
import "assets/scripts/objects/beach.lua"
import "assets/scripts/objects/castle.lua"
import "assets/scripts/objects/swamp.lua"
import "assets/scripts/objects/cemetery.lua"
import "assets/scripts/objects/breakable.lua"
import "assets/scripts/objects/portal.lua"
import "assets/scripts/objects/beacon_tower.lua"
import "assets/scripts/objects/pushable_block.lua"
import "assets/scripts/objects/water.lua"
import "assets/scripts/objects/sky.lua"
import "assets/scripts/objects/magic_bridge.lua"
import "assets/scripts/objects/stone_philosophers.lua"

-- import items
import "assets/scripts/items/accessories.lua"
import "assets/scripts/items/armors.lua"
import "assets/scripts/items/clothes.lua"
import "assets/scripts/items/containers.lua"
import "assets/scripts/items/food.lua"
import "assets/scripts/items/herbs.lua"
import "assets/scripts/items/keys.lua"
import "assets/scripts/items/swords.lua"
import "assets/scripts/items/axes.lua"
import "assets/scripts/items/maces.lua"
import "assets/scripts/items/daggers.lua"
import "assets/scripts/items/misc_weapons.lua"
import "assets/scripts/items/throwing_weapons.lua"
import "assets/scripts/items/missile_weapons.lua"
import "assets/scripts/items/firearms.lua"
import "assets/scripts/items/misc.lua"
import "assets/scripts/items/potions.lua"
import "assets/scripts/items/scrolls.lua"
import "assets/scripts/items/shields.lua"
import "assets/scripts/items/staves.lua"
import "assets/scripts/items/tomes.lua"
import "assets/scripts/items/crystal_shards.lua"

-- import monsters
import "assets/scripts/monsters/crowern.lua"
import "assets/scripts/monsters/wyvern.lua"
import "assets/scripts/monsters/herder.lua"
import "assets/scripts/monsters/herder_small.lua"
import "assets/scripts/monsters/herder_big.lua"
import "assets/scripts/monsters/spider.lua"
import "assets/scripts/monsters/skeleton_archer.lua"
import "assets/scripts/monsters/cave_crab.lua"
import "assets/scripts/monsters/shrakk_torr.lua"
import "assets/scripts/monsters/green_slime.lua"
import "assets/scripts/monsters/forest_ogre.lua"
import "assets/scripts/monsters/mummy.lua"
import "assets/scripts/monsters/giant_snake.lua"
import "assets/scripts/monsters/rat_swarm.lua"
import "assets/scripts/monsters/medusa.lua"
import "assets/scripts/monsters/sand_warg.lua"
import "assets/scripts/monsters/fjeld_warg.lua"
import "assets/scripts/monsters/dark_acolyte.lua"
import "assets/scripts/monsters/turtle.lua"
import "assets/scripts/monsters/zarchton.lua"
import "assets/scripts/monsters/eyctopus.lua"
import "assets/scripts/monsters/mosquito_swarm.lua"
import "assets/scripts/monsters/skeleton_knight_trooper.lua"
import "assets/scripts/monsters/skeleton_knight_commander.lua"
import "assets/scripts/monsters/undead.lua"
import "assets/scripts/monsters/twigroot.lua"
import "assets/scripts/monsters/air_elemental.lua"
import "assets/scripts/monsters/fire_elemental.lua"
import "assets/scripts/monsters/magma_golem.lua"
import "assets/scripts/monsters/swamp_toad.lua"
import "assets/scripts/monsters/ice_guardian.lua"
import "assets/scripts/monsters/uggardian.lua"
import "assets/scripts/monsters/trickster.lua"
import "assets/scripts/monsters/wizard.lua"
import "assets/scripts/monsters/summon_stone.lua"
import "assets/scripts/monsters/viper_root.lua"
import "assets/scripts/monsters/turtle_diving.lua"
import "assets/scripts/monsters/zarchton_diving.lua"
import "assets/scripts/monsters/mimic.lua"
import "assets/scripts/monsters/ratling.lua"
import "assets/scripts/monsters/ratling_boss.lua"
import "assets/scripts/monsters/xeloroid.lua"
import "assets/scripts/monsters/lindworm.lua"
import "assets/scripts/monsters/spore_mushroom.lua"

-- import spells
import "assets/scripts/spells/fireburst.lua"
import "assets/scripts/spells/shockburst.lua"
import "assets/scripts/spells/frostburst.lua"
import "assets/scripts/spells/poison_cloud.lua"
import "assets/scripts/spells/ice_shards.lua"
import "assets/scripts/spells/fireball.lua"
import "assets/scripts/spells/frostbolt.lua"
import "assets/scripts/spells/poison_bolt.lua"
import "assets/scripts/spells/lightning_bolt.lua"
import "assets/scripts/spells/dark_bolt.lua"
import "assets/scripts/spells/blob.lua"
import "assets/scripts/spells/thorn_wall.lua"
import "assets/scripts/spells/wasp_swarm.lua"
import "assets/scripts/spells/dispel.lua"
import "assets/scripts/spells/runes.lua"
import "assets/scripts/spells/wall_fire.lua"
import "assets/scripts/spells/open_door.lua"
import "assets/scripts/spells/force_field.lua"

-- import materials
import "assets/scripts/materials/generic.lua"
import "assets/scripts/materials/dungeon.lua"
import "assets/scripts/materials/tomb.lua"
import "assets/scripts/materials/mine.lua"
import "assets/scripts/materials/forest.lua"
import "assets/scripts/materials/castle.lua"
import "assets/scripts/materials/beach.lua"
import "assets/scripts/materials/items.lua"
import "assets/scripts/materials/monsters.lua"
import "assets/scripts/materials/swamp.lua"
import "assets/scripts/materials/cemetery.lua"

-- import particle systems
import "assets/scripts/particles/crystal.lua"
import "assets/scripts/particles/cube.lua"
import "assets/scripts/particles/damage_screen.lua"
import "assets/scripts/particles/death.lua"
import "assets/scripts/particles/death_icy.lua"
import "assets/scripts/particles/earthquake_dust.lua"
import "assets/scripts/particles/frost_arrow.lua"
import "assets/scripts/particles/glitter.lua"
import "assets/scripts/particles/hit_wood.lua"
import "assets/scripts/particles/hit_blood.lua"
import "assets/scripts/particles/hit_blood_black.lua"
import "assets/scripts/particles/hit_dust.lua"
import "assets/scripts/particles/hit_flame.lua"
import "assets/scripts/particles/hit_goo.lua"
import "assets/scripts/particles/hit_slime.lua"
import "assets/scripts/particles/hit_firearm.lua"
import "assets/scripts/particles/hit_ice.lua"
import "assets/scripts/particles/party_crush.lua"
import "assets/scripts/particles/prison_ceiling_lamp.lua"
import "assets/scripts/particles/teleporter.lua"
import "assets/scripts/particles/torch.lua"
import "assets/scripts/particles/dungeon_wall_lantern.lua"
import "assets/scripts/particles/tomb_wall_lantern.lua"
import "assets/scripts/particles/portal_effect.lua"
import "assets/scripts/particles/hit_terracotta_jar.lua"
import "assets/scripts/particles/meteor_hammer.lua"
import "assets/scripts/particles/mine_support_lantern.lua"
import "assets/scripts/particles/mine_ceiling_pit_light.lua"
import "assets/scripts/particles/mine_support_ceiling_lantern.lua"
import "assets/scripts/particles/mine_crystal.lua"
import "assets/scripts/particles/forest_falling_leaves.lua"
import "assets/scripts/particles/forest_pit_fog.lua"
import "assets/scripts/particles/forest_fireflies.lua"
import "assets/scripts/particles/forest_lantern.lua"
import "assets/scripts/particles/castle_window_dust.lua"
import "assets/scripts/particles/castle_pillar_candles.lua"
import "assets/scripts/particles/floor_vent_steam.lua"
import "assets/scripts/particles/damage_fire.lua"
import "assets/scripts/particles/damage_shock.lua"
import "assets/scripts/particles/uggardian_flames.lua"
import "assets/scripts/particles/poisoned_monster.lua"
import "assets/scripts/particles/blinded_monster.lua"
import "assets/scripts/particles/stunned_monster.lua"
import "assets/scripts/particles/power_gem.lua"
import "assets/scripts/particles/power_gem_item.lua"
import "assets/scripts/particles/forest_underwater_bubbles.lua"
import "assets/scripts/particles/forest_underwater_plankton.lua"
import "assets/scripts/particles/witch_lantern.lua"
import "assets/scripts/particles/castle_wall_text.lua"
import "assets/scripts/particles/castle_wall_text_long.lua"
import "assets/scripts/particles/castle_button.lua"
import "assets/scripts/particles/beacon_crystal.lua"
import "assets/scripts/particles/beacon_furnace_text_glow.lua"
import "assets/scripts/particles/essence_water.lua"
import "assets/scripts/particles/essence_fire.lua"
import "assets/scripts/particles/essence_earth.lua"
import "assets/scripts/particles/essence_air.lua"
import "assets/scripts/particles/essence_balance.lua"
import "assets/scripts/particles/swamp_fume.lua"
import "assets/scripts/particles/dungeon_fire_pit.lua"
import "assets/scripts/particles/catacomb_alcove_candles_01.lua"
import "assets/scripts/particles/catacomb_alcove_candles_02.lua"
import "assets/scripts/particles/potion_of_vitality.lua"
import "assets/scripts/particles/potion_of_strength.lua"
import "assets/scripts/particles/potion_of_willpower.lua"
import "assets/scripts/particles/potion_of_dexterity.lua"
import "assets/scripts/particles/dummy_light.lua"
import "assets/scripts/particles/ethereal_blade.lua"
import "assets/scripts/particles/etherweed.lua"
import "assets/scripts/particles/castle_ceiling_light.lua"
3. You can then pick and choose what you would like to import manually

**Note
- remember to add "import .. blah blah.lua" whenever you create a new .lua file you wish to include
- creating new 'stuff' with the same name as existing Asset Pack 'stuff' will overwrite the old 'stuff'
(sorry if you already know all this!)

Akroma
Orace
Posts: 76
Joined: Tue Jul 04, 2017 6:45 pm
Location: Italy

Re: How to use custom assets?

Post by Orace »

Lol!! I didn't know i had to consider the init.lua file like a config file for assets. I imported the assets i need and it works fine!

Thanks a lot Xardas and Akroma222, your answer is very simple and complete at the same time!! :mrgreen:
Post Reply