Unknown Soldier
Mapping a map
- Joined
- Oct 30, 2010
- Messages
- 308
- Solutions
- 11
- Reaction score
- 688
Hello,
so I was messing with weapon scripts, and made a script as below. However that is not the intention, not the result that I want.
The idea: if players has specific weapon equipped, then there is x% chance to trigger an area effect/spell that will damage also nearby creatures. In other cases it will attack as normally, just without the area damage. It almost works as intended, however it ignores the elements of the weapon, because the weapon has physical and elemental attack (lets say 8 physical, 46 fire), but here the script specifies the damage type, so it is not taken from the weapon. How could I get the desired effect?
Thanks in advance
@Edit
F%@#$%, apparently I was testing on wrong monsters, it seems to be working nicely.
Well, at least maybe someone would make use of this small script... just define it in weapons.xml
so I was messing with weapon scripts, and made a script as below. However that is not the intention, not the result that I want.
The idea: if players has specific weapon equipped, then there is x% chance to trigger an area effect/spell that will damage also nearby creatures. In other cases it will attack as normally, just without the area damage. It almost works as intended, however it ignores the elements of the weapon, because the weapon has physical and elemental attack (lets say 8 physical, 46 fire), but here the script specifies the damage type, so it is not taken from the weapon. How could I get the desired effect?
Thanks in advance
@Edit
F%@#$%, apparently I was testing on wrong monsters, it seems to be working nicely.
Well, at least maybe someone would make use of this small script... just define it in weapons.xml
Lua:
local area = createCombatArea({
{0, 1, 0},
{1, 3, 1},
{0, 1, 0},
})
local area2 = createCombatArea({
{1, 0, 1},
{0, 3, 0},
{1, 0, 1},
})
local area3 = createCombatArea({
{0, 0, 0},
{0, 3, 0},
{0, 0, 0},
})
local combat = Combat()
combat:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat:setFormula(COMBAT_FORMULA_SKILL, 1, 0, 1, 0)
combat:setArea(area)
local combat2 = Combat()
combat2:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat2:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_FIREAREA)
combat2:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat2:setFormula(COMBAT_FORMULA_SKILL, 1, 0, 1, 0)
combat2:setArea(area2)
local combat3 = Combat()
combat3:setParameter(COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
combat3:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_EXPLOSIONHIT)
combat3:setParameter(COMBAT_PARAM_BLOCKARMOR, true)
combat3:setFormula(COMBAT_FORMULA_SKILL, 1, 0, 1, 0)
combat3:setArea(area3)
function onUseWeapon(player, variant)
local random = math.random(1,100)
if random <= 10 then
return combat:execute(player, variant)
elseif random >10 and random <=20 then
return combat2:execute(player, variant)
else
return combat3:execute(player, variant)
end
end
Last edited: