About this mod
Mod provides craft recipes from objects in some surfaced object.
- Permissions and credits
- Donations
There is defined "Recipes" where are tested thru onInsert hook on some alcove/altar.
If this recipe is correct will be realized.
- object needed for recipe will be destroyed
- make special effects
- spawn new created items
Inserted testing room contain some example recipes, GrimTK GUI from JohnWordsword, money script. All is integrated.
Documentation isnt yet. But I am ready for explayning.
Instalation:
1/ copy folder forge to your mod_assets directory.
2/ make script entity in your dung with name Forge and connect it with mod_assets/forge/scripts/forge.lua (only one in dung)
3/ if you want to use dialog - make script entity and connect this to mod_assets/forge/scripts/forge_dialog.lua (only one in dung)
4/ make script entity near to your forge with script like in mod_assets/forge/scripts/forge_common.lua ( any count on dung )
- in this entity may be defined specific recipes, effects
5/ connect your forges to Forge script in dung. ( onInsertItem, Forge, useReceipts ). May be connected onRemoneItem too for better refresh of dialog.
Setting global variables in mod_assets/forge/scripts/forge.lua:
This variables are in table
FORGE_var = {
useDialog = true,
chain = false,
exact = false,
multiply = true,
defStartShake = {0,0},
defStopShake = {0,0},
defExp = 0,
defPOffset = {0,0.85,0},
}
useDialog - true - if you want to use forge_dialog ( must be GrimTK instaled ) - its possible to choose recipe from list of possible.
- false - first possible recipe will be used (1x) after activation onInsertItem hook.
chain - true - after correct recipe application will be tested all target surfaces for new recipe activation ( not for useDialog = true )
- false - after recipe application must be used new onInsertItem hook for new recipe apply
exact- true - for applycation of recipe must be in surface ONLY corect items and ONLY correct count of this.
- false - surfaces are tested for all combinations of recipes.
multiply - true - recipes may be applycated many times in one.
- false - will be possible to create only one times of recipe
defStartShake, defStopShake - definitions for standard shaking during effect in recipe applycation
defExp - standard exp gain to party when is an recipe applicated
defPOffset - standard offset for creating particle effects during recipe application
RECIPE definition:
Recipes are defined in any script entity in RecipesDefinition table. ( this scripts and table will be search automaticaly )
Definition is in table eg.:
{
-- name = "baked_maggot"-- name of recipe (id) - usede for index name of recipe
-- UIname = "Baked maggot", -- for vizualization name
-- txt = "",- text formated like scrool (vizualization recipe) - is generated automaticaly if isnt defined
-- visible = true, - will be recipe showed in recipeBook (some of part chained recipes isnt need to be visible there) - RECIPEBOOK isnt created yet
-- enable = true, - switch for active/deactive recipe
-- effect = {timer = 1, tstop = 1, eff = "CrystalIce"}, - particle definition(time-duration of recipe,tstop - time for FX after recipe, eff= particle def)
-- shake = {start = {1,0.5}, stop = {0.5,1}}- shake camera at start, end recipe
-- exp = 30- exp to be added to champions
-- chain= false- recipe is tested for continue start in all target alcoves
-- target = vis. bellow** MUST BE - definition of created items
-- source = vis. bellow** MUST BE - definition of source items
-- pay- only if you use Money script
-- sell- only if you use Money script
-- kind = ""- parameter for shorting recipelist in recipe book ( not done yet ) eg. general/anvil/alchemy ....
-- useDialog = true,-- if is parameter false will be effect use immediately without dialog sytem
-- onTest = "MyScriptEntity.script.testMyRecipe" -- hook for blocking recipe in testing time ->
function testMyRecipe(alcove,recipe) -> return true/false
-- onStart = "MyScriptEntity.script.startMyRecipe"-- hook managing extra features when is recipe run ->
function startMyRecipe(recipe,count)
-- onEnd = "MyScriptEntity.script.endMyRecipe" -- hook managing extra features when is recipe ended ->
function endMyRecipe(workRec,recipe,alcove)
}
Every dont defined parameters will be created automaticaly from global parameters or will be disabled.
Only target and source variables must be defined.
SOURCE - table defined source surfaced objects and items used for recipe
e.g. { dungeon_alcove_1 = {rock = 5},}, - recipe will be used only in dungeon_alcove_1 and will be consumed 5xrock
e.g. { _ = {rock = 5},}, - recipe will be used in every surfaced object and will be consumed 5xrock
e.g. { _candle = {rock = 5},}, - recipe will be used in every surfaced object (if this id or name contain "candle") and will be consumed 5xrock
e.g. { _ = {rock = 5, red_gem = 1},}, - for recipe is needed 5xrock and 1xred_gem in some forge
e.g. { dungeon_alcove_1 = {rock = 5},
dungeon_alcove_2 = {red_gem = 1},}, - for recipe is needed 5xrock in one and 1xred_gem in another forge
TARGET - table for definition of target surfaced object and created items
e.g. { dungeon_alcove_1 = {skull = {1,100},},}, - in dungeon_alcove_1 create 1x skull with 100% success
e.g. { _ = {skull = {1,100},},}, - if start char is _ items will be created in the same surface where start recipe
e.g. { dungeon_alcove_1 = {skull = {1,100},torch = {2,100},},}, - will be create one skull and two torches in dungeon_alcove_1
e.g. { dungeon_alcove_1 = {skull = {1,100},},
dungeon_alcove_2 = {torch = {2,100},},},create skul to one and torches to another surfaces
e.g. { dungeon_alcove_1 = {skull = {"2-5",100},},},create 2-5 skulls
e.g. { dungeon_alcove_1 = {skull = {"2-5",50},},},if 50% succes will be create 2-5 skulls
EFFECT definition:
Effects are defined in any script entity in EffectsDefinition table. ( this scripts and table will be search automaticaly )
Definition is in table eg.:
EffectsDefinition = {
Effect1 = { start = {part = "", sound = "poison_cloud"},
stop = {part = "", sound = ""},
src = {part = "fire_elemental", sound = "", offset = {0,-0.8,0}},},
Effect2 = { start = {part = "", sound = "poison_cloud"},
stop = {part = "", sound = ""},
src = {part = "fire_elemental", sound = "", offset = {0,-0.8,0}},},
}
Effect1,Effect2 - name used in recipe in effect.eff
start - effect used in target forge on the begining of recipe applycation
stop - effect used in target forge on the end of recipe applycation
src - effect used in source forge on the begining of recipe applycation.
part - particle name
sound - sound name
offset - offset of particle effect is this is needed ( this parameter is not needed )