This is a script for a spell.Holybolt will damage the target if it is an enemy or heal the target if it is an ally.I'm having some problems with floating text.It says that I can't convert a real to integer.
At this line...
...is the syntax error.
JASS:
scope HolyBolt initializer Init
globals
private constant integer HolyBolt = 'A007'
private constant string HEAL_EFFECT = "Abilities\\Spells\\Human\\ManaFlare\\ManaFlareBase.mdl"
private constant string DAMAGE_EFFECT ="Abilities\\Weapons\\DemolisherFireMissile\\DemolisherFireMissile.mdl"
endglobals
private function HolyBolt_Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'A007'
endfunction
private function Actions takes nothing returns nothing
local unit hero
local unit target
local integer lvl
local real int
local real str
local real damage
local real heal
local integer pid
local player owner
set hero = GetTriggerUnit()
set owner = GetOwningPlayer(hero)
set pid = GetPlayerId(owner) + 1
set target = GetSpellTargetUnit()
set lvl = GetUnitAbilityLevel(hero,HolyBolt)
set int = GetHeroInt(hero,true)
set str = GetHeroStr(hero,true)
set damage = (udg_StatsMentalPower[pid]*0.75)
set heal = (udg_StatsMentalPower[pid]*0.75)
if IsUnitAlly(target,GetOwningPlayer(hero)) then
if GetRandomInt(1,100) <= udg_StatsMentalCriticalChance[pid] then
call SetWidgetLife(target,GetWidgetLife(target)+heal+(udg_StatsMentalCriticalPower[pid]*0.75))
else
call SetWidgetLife(target,GetWidgetLife(target)+heal)
call DestroyEffect(AddSpecialEffectTarget(HEAL_EFFECT,target,"chest") )
endif
endif
if IsUnitEnemy(target,GetOwningPlayer(hero)) then
if GetRandomInt(1,100) <= udg_StatsMentalCriticalChance[pid] then
call UnitDamageTarget(hero,target,damage+(udg_StatsMentalCriticalPower[pid]*0.75),true,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
set udg_TempPoint = GetUnitLoc(udg_DamageEventTarget)
call CreateTextTagLocBJ( R2S(damage) + I2S(udg_StatsMentalCriticalPower[pid]*0.75) , udg_TempPoint, 60.00, 10.00, 100, 100, 100, 0)
call RemoveLocation(udg_TempPoint)
call ShowTextTagForceBJ( false, GetLastCreatedTextTag(), GetPlayersAll() )
call SetTextTagPermanentBJ( GetLastCreatedTextTag(), false )
call SetTextTagVelocityBJ( GetLastCreatedTextTag(), 95.00, 90 )
call SetTextTagLifespanBJ( GetLastCreatedTextTag(), 2.00 )
call ShowTextTagForceBJ( true, GetLastCreatedTextTag(), GetForceOfPlayer(GetOwningPlayer(hero)) )
else
call UnitDamageTarget(hero,target,damage,true,false,ATTACK_TYPE_MAGIC,DAMAGE_TYPE_MAGIC,WEAPON_TYPE_WHOKNOWS)
call DestroyEffect(AddSpecialEffectTarget(DAMAGE_EFFECT,target,"origin") )
endif
endif
endfunction
//===========================================================================
private function Init takes nothing returns nothing
local trigger HolyBoltTrg = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( HolyBoltTrg, EVENT_PLAYER_UNIT_SPELL_EFFECT )
call TriggerAddCondition( HolyBoltTrg, Condition( function HolyBolt_Conditions ) )
call TriggerAddAction( HolyBoltTrg, function Actions )
endfunction
endscope
At this line...
JASS:
call CreateTextTagLocBJ( R2S(damage) + I2S(udg_StatsMentalCriticalPower[pid]*0.75) , udg_TempPoint, 60.00, 10.00, 100, 100, 100, 0)
...is the syntax error.