Official Fulqrum Publishing forum

Official Fulqrum Publishing forum (http://forum.fulqrumpublishing.com/index.php)
-   Mods (http://forum.fulqrumpublishing.com/forumdisplay.php?f=165)
-   -   Please help with vampire bats attack script (http://forum.fulqrumpublishing.com/showthread.php?t=14629)

zubovsergei 05-04-2010 03:01 PM

Please help with vampire bats attack script
 
Hi, I am trying to edit the vampire attack script in addon_special_attacks.lua.

I am trying to make it so that only half (or 1/4) of the damage done by vampire bats is used to resurrect the vampires. I am not good at reading the script or figuring out which part to edit. Please help.

Thanks in advance

zini4_tha_grunt 05-04-2010 04:17 PM

Quote:

Originally Posted by zubovsergei (Post 157684)
Hi, I am trying to edit the vampire attack script in addon_special_attacks.lua.

I am trying to make it so that only half (or 1/4) of the damage done by vampire bats is used to resurrect the vampires. I am not good at reading the script or figuring out which part to edit. Please help.

Thanks in advance

you must find where the amount of damage is being calcullated into health and multiply it on 0,25.

zubovsergei 05-04-2010 04:23 PM

I tried looking at the script but there are many places listing damage, etc. Here is the script maybe you can notice. Thanks


function special_vamp()

local cycle = Attack.get_cycle()


--local count=Attack.act_size(0)
local dmg_min,dmg_max = text_range_dec(Attack.get_custom_param("damage"))
local power=tonumber(Attack.get_custom_param("power"))

--local damage=Game.Random(dmg_min)
local typedmg=Attack.get_custom_param("typedmg")
Attack.atk_set_damage(typedmg,dmg_min)

local source, target

Attack.log_label('null')

if (cycle == 0) then
local source = Attack.get_target()
Attack.val_store("vamp_source", source)
--Attack.val_store("vamp_hp", math.min(Attack.act_totalhp(source))) --*power/100
Attack.next(0)
elseif (cycle == 1) then
source = Attack.val_restore("vamp_source")
target = Attack.get_target()

if ((source ~= nil) and (target ~= nil)) then
Attack.aseq_rotate(0, source)
Attack.act_aseq( 0, "cast" )
local dmgt = Attack.aseq_time(0, "x")

local a = Attack.atom_spawn(source, dmgt, "effect_life_minus", Attack.angleto(source))
local dmgts = Attack.aseq_time(a, "x")
Attack.atom_spawn(target, Attack.aseq_time(0, "y"), "effect_life_plus", Attack.angleto(target))

local max_hp=Attack.act_totalhp(source)
common_cell_apply_damage(source, dmgts+dmgt)
local max_dmg = Attack.act_damage_results(source)

local rephits = math.floor(math.min(min_dmg,max_hp)*power/100)

local count, hp = Attack.act_size(target),Attack.act_hp(target)
-- if Attack.get_caa(target) == nil then count = 0 end

local before = Attack.act_totalhp(target)
Attack.cell_resurrect(target, rephits, dmgts+dmgt)
local after = Attack.act_totalhp(target)

Attack.act_cure(target, -(Attack.act_size(target)-count), dmgts+dmgt) -- îòðèöàòåëüíîå ÷èñëî - òîëüêî îòëåò öèôð

count = Attack.act_size(target) - count
local heal = "resr"
if count == 0 then count = Attack.act_hp(target)-hp; heal = "heal" end
Attack.log_special(count, blog_side_unit(target,-1))
Attack.log_label('add_blog_vamp_'..heal)
end
end

return true
end

zini4_tha_grunt 05-04-2010 05:26 PM

multiply rephits

zubovsergei 05-04-2010 06:40 PM

I tried mulitplying (by 0.5 or 0.25) just about everything in that script but it has no effect.

zini4_tha_grunt 05-04-2010 09:39 PM

there your script.
and it's taken from unit_features.lua, not addon_special_attacks.lua

Quote:

function features_vampirism( damage,addrage,attacker,receiver,minmax ) -- minmax, равный 1 или 2 означает, что функция вызывается только для определения мин/макс урона во всп.подсказке

if (minmax==0) and damage>0 then

-- сколько хитов у вампов
if --[[Attack.act_need_cure(attacker) or ]]Attack.cell_need_resurrect(attacker) then
if Attack.act_enemy(receiver) and not (Attack.act_feature(receiver,"undead,boss")) and not (Attack.act_feature(receiver,"plant")) and not (Attack.act_feature(receiver,"golem")) and not (Attack.act_feature(receiver,"pawn")) and not (Attack.act_name(receiver)=="griffin_spirit") then
local count_1 = Attack.act_size(attacker)

local vamp = math.min(Attack.act_totalhp(receiver), damage)
local hp1 = Attack.act_totalhp(attacker)
Attack.act_resurrect(attacker, math.floor(vamp+.5))

local count_2 = Attack.act_size(attacker)

Attack.atom_spawn(attacker, 0, "effect_total_cure")
local log_msg="add_blog_vamp_"

local special=count_2-count_1

if count_2==count_1 then
log_msg=log_msg.."0"
special = Attack.act_totalhp(attacker) - hp1
end

Attack.act_damage_addlog(receiver,log_msg,true)
Attack.log_special(special) -- работает

end
end

end

return damage,addrage
end
you must multiply "vamp"

this function being called from bat2 and bat.atom in line posthitmaster=features_vampirism

zubovsergei 05-05-2010 12:46 AM

Thnks, would have never found/done it. Didn't know about that file.


All times are GMT. The time now is 04:20 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.