- Joined
- May 4, 2007
- Messages
- 2,260
Hi guys, i am making triggers about items (armors in this case) but they don't work and i make no idea why... Apparently everything is fine and JassCraft points no errors ... Could anyone please tell what is wrong with this scrips ?? because i don't know ...
1st script:
This is a simple script... When a unit gets attacked and if the attacker is melle, the attacked unit is a hero and if the hero has the item, the hero will have 7% chances to stun the attacker .... However this don't seem to be working at all and it really annoys me because i don't find this script difficult, not can i find any mistakes ...
2nd script:
This armor is similar to the other. If a hero with this item is attacked, he has 7% chance of gaining 150 hp for 10 seconds ... However it does NOT work .. so i don't know what i am doing wrong ..
3rd script:
Now this last one is the Multi Orb, it gives the hero a chance to do multiple effects depending on the unit type when attacking. if the unit is a structure, the hero freezes it, if it it mechanical, it slows it and finally if it is organic it deals 100 bonus damage and heal 5 to 10% of his life.
It works in GUI but here when i place this script in the program it says i have 32 errors ... and i don't know why ...
Can anyone please tell what is wrong with these 3 scripts ?
1st script:
JASS:
function SpikedArmor_Conds takes nothing returns boolean
local integer stunchance = 7
return GetRandomInt(1, 100) <= stunchance and IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) and GetInventoryIndexOfItemTypeBJ(GetTriggerUnit(), 'I019') > 0 and IsUnitType(GetAttacker(), UNIT_TYPE_MELEE_ATTACKER)
endfunction
//======================================================================================================================================================================================================================
function SpikedArmor_Acts takes nothing returns nothing
local unit victim = GetTriggerUnit()
local unit attacker = GetAttacker()
local unit dummy = CreateUnit( GetOwningPlayer(victim), 'h01H', GetUnitX(attacker), GetUnitY(attacker), 0)
call UnitAddAbility(dummy, 'A04L')
call IssueTargetOrder(dummy, "thunderblot", attacker)
call UnitApplyTimedLife(dummy, 'BTLF', 2.5)
set victim = null
set attacker = null
set dummy = null
endfunction
//===========================================================================
function InitTrig_Spiked_Armor takes nothing returns nothing
local trigger SpikedArmor = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( SpikedArmor, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( SpikedArmor, Condition( function SpikedArmor_Conds ) )
call TriggerAddAction( SpikedArmor, function SpikedArmor_Acts )
set SpikedArmor = null
endfunction
This is a simple script... When a unit gets attacked and if the attacker is melle, the attacked unit is a hero and if the hero has the item, the hero will have 7% chances to stun the attacker .... However this don't seem to be working at all and it really annoys me because i don't find this script difficult, not can i find any mistakes ...
2nd script:
JASS:
function StrenghtArmor_Conds takes nothing returns boolean
local integer STchance = 7
return GetRandomInt(1, 100) <= STchance and IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) and GetInventoryIndexOfItemTypeBJ(GetTriggerUnit(), 'I01A') > 0
endfunction
//======================================================================================================================================================================================================================
function StrenghtArmor_Acts takes nothing returns nothing
local unit victim = GetTriggerUnit()
local effect ef = AddSpecialEffectTarget("Abilities\\Spells\\Human\\DivineShield\\DivineShieldTarget.mdl", victim, "origin")
call SetUnitState(victim, UNIT_STATE_MAX_LIFE, (GetWidgetLife(victim) + 150))
call DestroyEffect(ef)
call TriggerSleepAction(10.0)
call SetUnitState(victim, UNIT_STATE_MAX_LIFE, (GetWidgetLife(victim) - 150))
set ef = null
set victim = null
endfunction
//===========================================================================
function InitTrig_Strenght_Armor takes nothing returns nothing
local trigger StrenghtArmor = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( StrenghtArmor, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( StrenghtArmor, Condition( function StrenghtArmor_Conds ) )
call TriggerAddAction( StrenghtArmor, function StrenghtArmor_Acts )
set StrenghtArmor = null
endfunction
This armor is similar to the other. If a hero with this item is attacked, he has 7% chance of gaining 150 hp for 10 seconds ... However it does NOT work .. so i don't know what i am doing wrong ..
3rd script:
JASS:
function MultiOrb_Conds takes nothing return boolean
local integer MOchance = 10
return GetRandomInt(1, 100) <= MOchance and IsUnitType(GetAttacker()), UNIT_TYPE_HERO == true and GetInventoryIndexOfItemTypeBJ(GetAttacker(), 'I00C') > 0
endfunction
//===========================================================================
function MultiOrb_Acts takes nothing returns nothing
local unit vic = GetTriggerUnit()
local unit att = GetAttacker()
local unit dum
local effect ef
if IsUnitType(vic, ConvertUnitType(2)) == true then
set dum = CreateUnit( GetOwningPlayer(att), 'h01H', GetUnitX(vic), GetUnitY(vic), 0)
call UnitApplyTimedLife(dum, 'BTLF', 3.00)
call UnitAddAbility(dum, 'A03U')
call IssueTargetOrder(dum, "thunderbolt", vic)
elseif IsUnitType(vic, ConvertUnitType(2)) == false and IsUnitType(vic, ConvertUnitType(15)) == true then
set dum = CreateUnit( GetOwningPlayer(att), 'h01H', GetUnitX(vic), GetUnitY(vic), 0)
call UnitApplyTimedLife(dum, 'BTLF', 3.00)
call UnitAddAbility(dum, 'A03T')
call IssueTargetOrder(dum, "slow", vic)
elseif IsUnitType(vic, ConvertUnitType(2)) == false and IsUnitType(vic, ConvertUnitType(15)) == false then
set ef = AddSpecialEffectTarget("Abilities\\Spells\\Human\\Heal\\HealTarget.mdl", att, "chest")
call UnitDamageTarget(att, vic, 100, true, false, ConvertAttackType(5), ConvertDamageType(26), null)
call SetUnitState(att, UNIT_STATE_LIFE, GetUnitState(att, UNIT_STATE_MAX_LIFE)*RMaxBJ(0, GetRandomReal(5.00, 10.00))*0.01)
call DestroyEffect(ef)
endif
set vic = null
set att = null
set dum = null
set ef = null
endfunction
//===========================================================================
function InitTrig_Multi_Orb takes nothing returns nothing
local trigger MultiOrb = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( MultiOrb, EVENT_PLAYER_UNIT_ATTACKED )
call TriggerAddCondition( MultiOrb, Condition( function MultiOrb_Conds ) )
call TriggerAddAction( MultiOrb, function MultiOrb_Acts )
set MultiOrb = null
endfunction
Now this last one is the Multi Orb, it gives the hero a chance to do multiple effects depending on the unit type when attacking. if the unit is a structure, the hero freezes it, if it it mechanical, it slows it and finally if it is organic it deals 100 bonus damage and heal 5 to 10% of his life.
It works in GUI but here when i place this script in the program it says i have 32 errors ... and i don't know why ...
Can anyone please tell what is wrong with these 3 scripts ?
Last edited: