Ah, this works, thanks. So it has to be tga specifically in order to recognize the file, weird.
1) Teleporter/Spin:
The teleporter below is supposed to spawn briefly and turn incoming projectiles and monsters around on the same tile, but it doesn't. If I give it a specific TeleportTarget it works, unless starting location and target are identical, even disregarding different elevation.
Besides is there a way to use the current getPosition as a target location? Getting an error that it has to be a number.
Code: Select all
defineObject{
name = "teleport_spin",
components = {
{
class = "Teleporter",
triggeredByParty = true,
triggeredByMonster = true,
triggeredByItem = true,
spin = "north",
--spin = "turn_around",
--onInit = function(self)
-- self.go.teleporter:setTeleportTarget(1,0,1,0)
--end,
},
{
class = "Controller",
initialState = "activate",
onInitialActivate = function(self)
self.go.teleporter:enable()
self.go.timer:start()
end,
onInitialDeactivate = function(self)
self.go.teleporter:disable()
end,
onActivate = function(self)
self.go.teleporter:enable()
self.go.light:fadeIn(0.5)
end,
onDeactivate = function(self)
self.go.teleporter:disable()
end,
onToggle = function(self)
if self.go.teleporter:isEnabled() then
self:deactivate()
else
self:activate()
end
end,
},
{
class = "Timer",
currentLevelOnly = false,
triggerOnStart = false,
disableSelf = true,
timerInterval = 1,
onActivate = function(self)
self.go:destroyDelayed()
end,
},
},
}
Traits:
2) I am trying to include 3 item slots in a trait. It does work if only two are active at a time, adding all 3 items won't work. Does this even work with more than 2 slots?
The cloak and dagger should only affect the hand with the dagger, but it effects both hands. Is there a way to limit a bonus to one hand/slot only?
Code: Select all
defineTrait{
name = "rogue_accuracy",
uiName = "Rogue Accuracy",
icon = 34,
hidden = true,
description = ".",
onComputeAccuracy = function(champion, weapon, attack, attackType, level)
if level > 0 then
local item1 = champion:getItem(ItemSlot.Weapon)
local item2 = champion:getItem(ItemSlot.OffHand)
local item3 = champion:getItem(ItemSlot.Cloak)
if (item2 and item2:hasTrait("dagger")) and (item1 and item1:hasTrait("dagger")) then return math.floor(champion:getLevel()/2)
end
if (item3 and item3:hasTrait("cloak")) and (item1 and item1:hasTrait("dagger")) then return math.floor(champion:getLevel()*3/4)
end
if (item3 and item3:hasTrait("cloak")) and (item2 and item2:hasTrait("dagger")) then return math.floor(champion:getLevel()*3/4)
end
if (item1 and item1:hasTrait("dagger")) and (item2 and item2:hasTrait("dagger")) and (item3 and item3:hasTrait("cloak")) then return math.floor(champion:getLevel()*3/4)
end
end
end,
}
3) Is there a way to use recomputeCooldown for casting spells? The radiant orb has the line "special: Faster Spell Casting", but unfortunately it does speed up nothing (tested wands vs orb). Using specific item slots with item.go.runepanel only affects the weapon, but not the spellcasting.
Code: Select all
defineTrait{
name = "cooldown_caster",
uiName = "Caster cooldown",
icon = 34,
description = "Reduces Cooldown when casting spells.",
onComputeCooldown = function(champion, weapon, attack, attackType, level)
if level > 0 then
local item1 = champion:getItem(ItemSlot.Weapon)
local item2 = champion:getItem(ItemSlot.OffHand)
if (item2 and item2.go.runepanel) and (item1 and item1:hasTrait("staff")) then return 0.7
end
if (item1 and item1.go.runepanel) and (item2 and item2:hasTrait("staff")) then return 0.7
end
end
end,
}
Magic, people:
4) How can the spell costs be altered, depending on the casters magic school proficiency or willpower stat?
How about casting a stronger version like lightning bolt which becomes a greater one (wasn't that in the base game)? Apparently, using two versions with the same gesture twice is a no-go and only the higher level is cast, the lower one disabled till then.
5) When defining a custom spell and setting a condition or spawning something, the added skilllevel doesn't seem to have any effect on length or damage. What does it actually do?
Code: Select all
onCast = function(champion, x, y, direction, elevation, skillLevel)
playSound("generic_spell")
for i = 1, 4, 1 do
if party.party:getChampion(i):isAlive() then
party.party:getChampion(i):setCondition("feather", skillLevel*2)
end
end
end,