Ask a simple question, get a simple answer
Re: Ask a simple question, get a simple answer
Thanks, minmay, for the help.
But I'm a little bit confused. Is only the lock-component of your solution important for me? The function in it refers to GameMode.dm_tempLockItem. What is that? Do I have to define it somewhere first??
But I'm a little bit confused. Is only the lock-component of your solution important for me? The function in it refers to GameMode.dm_tempLockItem. What is that? Do I have to define it somewhere first??
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
All you need is for the lock to reactivate itself, and the counter to disable the lock component when it hits 0.
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!
Re: Ask a simple question, get a simple answer
The dm_tempLockItem hack is used to return the item to the player's hands, so that the coinslot only accepts 1 coin at a time from stacks. Without that, it would consume the entire stack.
If you just want a lock that can be used an infinite number of times all you need is:
If you just want a lock that can be used an infinite number of times all you need is:
Code: Select all
{
class = "Lock",
onActivate = function(self)
self:enable()
end,
}
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Ask a simple question, get a simple answer
If one wanted to alter its behavior, it should be possible to have it expect a stack of coins by default, whether a stack of one or more than one.
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
Is there a way to get damage done to a champion before reductions?
'onDamage' happens after reductions, and while I managed to 'un-calculate' damage for magical resistances, I'm having problems with physical because it only gets reduced by melee monster attacks, which is sort of useless considering they also shoot physical projectiles. While I could redefine all monster projectiles to deal pure damage instead of physical for the drawback of having monster protection not taken into account when taking damage from monster projectiles(And I can totally live with that), there's the part where the party could damage themselves with their own physical projectiles, which means they'll be taking more physical damage.
While that's a rather minuscule thing, I'd really like for that to not be a thing. (Because more armor = more 'bugged' damage)
And if there isn't a way and I'll have to resort to keeping that bug, will this physical damage 'un-calculation' formula work properly?
EDIT: Now that I think about it, I could just 'create' a new damage type (damageType = "notPhysical") and do the calculations there, but then there's the problem of the console spamming the "hurr hurr invalid damage type". Can be fixed with "Console.suppressWarnings(suppress)", but how do I use it? I tried multiple ways, which all resulted in an error.
'onDamage' happens after reductions, and while I managed to 'un-calculate' damage for magical resistances, I'm having problems with physical because it only gets reduced by melee monster attacks, which is sort of useless considering they also shoot physical projectiles. While I could redefine all monster projectiles to deal pure damage instead of physical for the drawback of having monster protection not taken into account when taking damage from monster projectiles(And I can totally live with that), there's the part where the party could damage themselves with their own physical projectiles, which means they'll be taking more physical damage.
While that's a rather minuscule thing, I'd really like for that to not be a thing. (Because more armor = more 'bugged' damage)
And if there isn't a way and I'll have to resort to keeping that bug, will this physical damage 'un-calculation' formula work properly?
Code: Select all
local protection = champion:getCurrentStat("protection")
if protection > 0 then
unreducedDamage = math.floor(damage + protection)
end
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!
Re: Ask a simple question, get a simple answer
Not even close, sorry. The effect of protection is replicated by this function:zimberzimber wrote:And if there isn't a way and I'll have to resort to keeping that bug, will this physical damage 'un-calculation' formula work properly?Code: Select all
local protection = champion:getCurrentStat("protection") if protection > 0 then unreducedDamage = math.floor(damage + protection) end
Code: Select all
function applyProtection(damage, protection, pierce)
protection = protection-pierce
if protection <= 0 then
return damage
elseif protection >= 1000 then
return 0
else
return math.max(1,damage-math.floor((math.random()+0.5)*protection))
end
end
Just give all of your monsters' melee attacks pierce=math.huge instead. Changing their damage type wouldn't work anyway; protection doesn't have anything to do with damage type, it just applies to all melee attacks.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
Wait, protection reduces damage from melee attacks REGARDLESS of damage type? When does it happen if magical resistance is also taken into account, before or after?
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!
Re: Ask a simple question, get a simple answer
Yes.zimberzimber wrote:Wait, protection reduces damage from melee attacks REGARDLESS of damage type?
Resistance applies after protection in that case, for both players and monsters.zimberzimber wrote:When does it happen if magical resistance is also taken into account, before or after?
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
- zimberzimber
- Posts: 432
- Joined: Fri Feb 08, 2013 8:06 pm
Re: Ask a simple question, get a simple answer
Please tell me charge attacks ignore protection
My asset pack [v1.10]
Features a bit of everything!
Features a bit of everything!
Re: Ask a simple question, get a simple answer
No, I'm pretty sure the only inherently special thing about secondaryActions is that (where applicable) they have a default critical multiplier of 1.5 instead of 2.5. They certainly do not ignore protection or evasion. The "bash" and "cleave" powerAttackTemplates have 10 pierce, though.
edit: oops I just realized you were probably talking about MonsterChargeComponent. MonsterChargeComponent's damage is reduced by math.floor((math.random()*0.5+0.5)*[base Protection of the champion's chest armor]), to a minimum of 0 (rather than 1). Armor skill bonus and other sources of protection do not apply, it's just the base protection of the chest armor. If they aren't wearing chest armor they take full damage.
edit2: at this point I should probably reassure you that no, I am not making this up.
edit: oops I just realized you were probably talking about MonsterChargeComponent. MonsterChargeComponent's damage is reduced by math.floor((math.random()*0.5+0.5)*[base Protection of the champion's chest armor]), to a minimum of 0 (rather than 1). Armor skill bonus and other sources of protection do not apply, it's just the base protection of the chest armor. If they aren't wearing chest armor they take full damage.
edit2: at this point I should probably reassure you that no, I am not making this up.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.