0.3.9 Changelog
Bugfixes
- Fixed crash related to monsters hitting other monsters with projectiles
- Fixed crash related to firing a projectile then removing the weapon
- Fixed Condition onStart hook having no reference to the condition power or stack count
New trait/skill/equipment hook
- onLevelUp(): triggers after a level up, and is used by the Mutation trait
- onUseItem(): triggers when an item is used, the Farmer's exp gain is now triggered this way
New character class definition parameters
- skillsAvailable: a list of skill names, used if you want certain classes to only learn certain skills (like in LoG1)
- skillPointsPerLevel: number of points gained per level (default: 1)
New UsableItemComponent parameter
- racialFood: for preferred foods bonus
New skill definition parameters
- requirements: a table with levels as keys and text as values. Used to display text between traits in the skill tooltips
- maxLevel: max skill level for the skill, must be greater or equal to 5. For anything over 5, the skill level will be displayed as a number instead of the little squares with pegs in them
- pointsCost: a number which dictate how many skill points are needed to level this skill up. A table can be used to get different values at different levels
- new hook: onCheckRestrictions = function(champion, skill, level)
- - use 'return false' to add a requirement to the skill. The requirement text will appear red if this requirement isn't met by the character
Code: Select all
defineSkill{
name = "alchemy",
uiName = "Alchemy",
priority = 10,
icon = 20,
description = "A higher skill level in Alchemy allows you to brew a wider range of potions. To craft potions you also need herbs and a Mortar and Pestle.",
skillTraits = {
[2] = "You brew stronger healing and energy potions.",
[10] = "When you craft bombs you get three bombs instead of one."
},
requirements = {
[10] = "Requires Earth Magic level 1.", -- doesn't need to match trait level, this '10' could be any number
},
traits = { [2] = "improved_alchemy", [10] = "bomb_expert" },
maxLevel = 10,
pointsCost = {1,1,1,1,2,1,1,1,1,1}, -- skill level 5 will require 2 points
onCheckRestrictions = function(champion, skill, level)
if level == 10 and champion:getSkillLevel("earth_magic") <= 0 then
return false
end
end
}
Added support for custom components from other UMods
Use
Code: Select all
local oldDungeonLoadInitFile = Dungeon.loadInitFile
function Dungeon:loadInitFile()
oldDungeonLoadInitFile(self)
dungeon = self
self:addCustomComponents(YourComponent)
end
And your component will be updated along with this mod's custom components
Added new components
SlideComponent
- Moves object left and right when clicked
Code: Select all
defineObject{
name = "pushable_ladder",
baseObject = "ladder",
components = {
{
class = "Slide",
},
{
class = "Controller",
onIncrement = function(self)
self.go.slide:pushRight()
end,
onDecrement = function(self)
self.go.slide:pushLeft()
end,
},
{
class = "WallObstacle",
name = "obstacle",
},
{
class = "Clickable",
name = "clickRight",
offset = vec(0.6, 1.4, -1.2),
size = vec(0.7, 1.2, 0.1),
maxDistance = 0,
onClick = function(self)
if party.facing == self.go.facing then
self.go.slide:push((party.facing+1)%4)
end
end,
},
{
class = "Clickable",
name = "clickLeft",
offset = vec(-0.6, 1.4, -1.2),
size = vec(0.7, 1.2, 0.1),
maxDistance = 0,
onClick = function(self)
if party.facing == self.go.facing then
self.go.slide:push((party.facing-1)%4)
end
end,
},
},
editorIcon = 248,
automapIcon = 140,
tags = { "level_design" },
}
WallObstacleComponent
- Acts like an invisible wall, blocking movement, projectiles and attacks between two tiles
Code: Select all
defineObject{
name = "wall_blocker",
components = {
{
class = "WallObstacle",
},
{
class = "Controller",
onActivate = function(self)
self.go.obstacle:enable()
end,
onDeactivate = function(self)
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 = "wall",
editorIcon = 96,
}
New component functions
SurfaceComponent and SocketComponent
- getItemByIndex(index): Returns an item component from this surface/socket
- dropItem(item, bool): Causes the surface/socket to drop an item on the floor. Triggers onRemoveItem hook if 'bool' is true
Code: Select all
function drop()
-- Drops all surface items on the floor
local surface = pedestal_1.surface
while surface:getItemByIndex() do
local item = surface:getItemByIndex()
if item then
surface:dropItem(item, surface:count() == 1) -- triggers onRemoveItem when the last item is dropped
end
end
end
ContainerComponent
New properties:
- slots: number of slots that fit in the window (16, 9, 4 or 1)
- gfx: custom texture to be used as a background
- closeButton: where to put the close button {x,y,width,height}. Defaul: {x = 207, y = 15, width = 40, height = 40}
- customSlots: used to place slots in custom positions (slots number is still used to determine where they can go). Uses a table of x and y indexes. Ex: When "slots=9", {0,0} places a slot in the first position. {2,2} places a slot in the last position
- customSlotGfx: causes the Gui to draw slot squares graphics. If "true" it'll use a default slot texture, or you can set to your own texture
New hooks:
onCalculateWeight = function(self, weight, item, champion)
-- Returns the new weight of the item
onAcceptItem = function(self, item, champion)
-- If it returns false, the item can't be placed in the container
onOpen = function(self, champion)
-- If it returns false, the container cannot be opened