- Joined
- Jul 19, 2007
- Messages
- 973
I noticed that game often crashes when playing a specific hero but I'm not sure which one of his spells that causes the game to crash but I think it's one of these 2 spells. But which one could it be? I can't see anything wrong in the triggers :-/
-
Shadow in the Eye
-

Events
-


Unit - A unit Is attacked
-
-

Conditions
-


(Level of Shadow in the Eye for (Attacked unit)) Greater than 0
-
-

Actions
-


If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-



If - Conditions
-




(Random integer number between 1 and 13) Less than or equal to (Level of Shadow in the Eye for (Attacked unit))
-
-



Then - Actions
-




Set VariableSet Local_Loc = (Position of (Attacking unit))
-




Unit - Create 1 Dummy (Shadow in the Eye) for (Owner of (Attacked unit)) at Local_Loc facing Default building facing degrees
-




Unit - Add Shadow in the Eye (Dummy) to (Last created unit)
-




Unit - Set level of Shadow in the Eye (Dummy) for (Last created unit) to (Level of Shadow in the Eye for (Attacked unit))
-




Unit - Order (Last created unit) to Undead Banshee - Curse (Attacking unit)
-




Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
-




Custom script: call RemoveLocation(udg_Local_Loc)
-
-



Else - Actions
-
-
-
JASS:
// Optional : Soul Rip Icon //
/////////////////->You need to modify the rawcode below here to fit your maps<-//////////////
constant function Soul_Rip_Caster takes nothing returns unit
return GetTriggerUnit()//The casting unit
endfunction
constant function Soul_Rip_Id takes nothing returns integer
return 'A0T0'//Soul Rip Ability Id->Modify to your Soul Rip Ability Id
//If u dun know, press Ctrl+D in Object Edtior, then check it out.
endfunction
constant function Soul_Rip_Light takes nothing returns string
return "MFPB"//Soul Rip Lightning Rawcode
endfunction
constant function Soul_Rip_Radius takes nothing returns real
return 1000.00//Soul Rip Effective AoE
endfunction
constant function Soul_Rip_Units takes nothing returns integer
return 5//Maximum unit per level increase(Remember dont set too many, it will lag)
//I recommended this value can maximum set to 100 only.
endfunction
constant function Soul_Rip_Hit_Points takes nothing returns integer
return 25//Heals or damage hit points per unit
endfunction
////////////////->Don't edit anything unless you know what you are doing<-///////////////////
function Soul_Rip_Pick_Unit takes nothing returns boolean
return IsUnitType(GetFilterUnit(),UNIT_TYPE_STRUCTURE)==false and GetUnitState(GetFilterUnit(),UNIT_STATE_LIFE)>0
//Is matching unit a strucrure equal to false,matching unit's greater than 0
endfunction
function Soul_Rip_Cond takes nothing returns boolean
if(not(GetSpellAbilityId()==Soul_Rip_Id()))then//when a unit cast soul rip, triggers these scripts
return false
endif
return true
endfunction
function Soul_Rip_Actions takes nothing returns nothing
local unit Soul_Rip_Target=GetSpellTargetUnit()//The target
local group Soul_Rip_Pick=CreateGroup()
local integer Soul_Rip_Max_Unit_Picked=Soul_Rip_Units()*GetUnitAbilityLevel(Soul_Rip_Caster(),Soul_Rip_Id())
//Max Unit allowed
local real Soul_Rip_HP
local integer Soul_Rip_Loop
local unit Soul_Rip_temp
local lightning array Soul_Rip_lightning
call GroupEnumUnitsInRangeOfLoc(Soul_Rip_Pick,GetUnitLoc(Soul_Rip_Target),Soul_Rip_Radius(),Condition(function Soul_Rip_Pick_Unit))
//Pick units nearby the target
if CountUnitsInGroup(Soul_Rip_Pick)>Soul_Rip_Max_Unit_Picked then
//If picked units more than the maximum unit allowed
set Soul_Rip_Pick=GetRandomSubGroup(Soul_Rip_Max_Unit_Picked,Soul_Rip_Pick)
//then pick maximum allowed number of units in the the unit group that we picked just now
endif
set Soul_Rip_Max_Unit_Picked=CountUnitsInGroup(Soul_Rip_Pick)
//set the variable(will use later)
set Soul_Rip_HP=I2R(Soul_Rip_Max_Unit_Picked*Soul_Rip_Hit_Points())
//set the damage(will use later)
set Soul_Rip_Loop=Soul_Rip_Max_Unit_Picked
//loop
loop
set Soul_Rip_temp=FirstOfGroup(Soul_Rip_Pick)
//set the variable to the first unit in the picked units
exitwhen Soul_Rip_temp==null
//loop ends when no more unit in the group
set Soul_Rip_lightning[Soul_Rip_Loop]=AddLightning(Soul_Rip_Light(),true,GetLocationX(GetUnitLoc(Soul_Rip_Target)),GetLocationY(GetUnitLoc(Soul_Rip_Target)),GetLocationX(GetUnitLoc(Soul_Rip_temp)),GetLocationY(GetUnitLoc(Soul_Rip_temp)))
//create lightning
set Soul_Rip_Loop=Soul_Rip_Loop-1
//a lightning is created, so decrease the integer to avoid crash when next lightning created
call GroupRemoveUnit(Soul_Rip_Pick,Soul_Rip_temp)
//remove the unit to prevent it being selected in next loop.
set Soul_Rip_temp=null
//remove leaks
endloop
if IsUnitAlly(Soul_Rip_Target,GetOwningPlayer(Soul_Rip_Caster()))==false then
call UnitDamageTarget(Soul_Rip_Caster(),Soul_Rip_Target,Soul_Rip_HP,false,true,ATTACK_TYPE_NORMAL,DAMAGE_TYPE_UNKNOWN,WEAPON_TYPE_WHOKNOWS)
endif
//If target is enemy, damage it!
if IsUnitAlly(Soul_Rip_Target,GetOwningPlayer(Soul_Rip_Caster()))==true then
call SetUnitState(Soul_Rip_Target,UNIT_STATE_LIFE,GetUnitState(Soul_Rip_Target,UNIT_STATE_LIFE)+Soul_Rip_HP)
endif
//If target is friend, increase it's hp
//Memory leaks cleaning starts//
call GroupClear(Soul_Rip_Pick)
call DestroyGroup(Soul_Rip_Pick)
set Soul_Rip_Target=null
set Soul_Rip_Pick=null
call TriggerSleepAction(0.3)
//Destory lightning starts//
set Soul_Rip_Loop=Soul_Rip_Max_Unit_Picked
loop
exitwhen Soul_Rip_Loop==0
call DestroyLightning(Soul_Rip_lightning[Soul_Rip_Loop])
set Soul_Rip_lightning[Soul_Rip_Loop]=null
set Soul_Rip_Loop=Soul_Rip_Loop-1
endloop
//Destory lightning ends//
//Memory leaks cleaning ends//
endfunction
//===========================================================================
function InitTrig_Soul_Rip takes nothing returns nothing
local trigger Soul_Rip = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(Soul_Rip,EVENT_PLAYER_UNIT_SPELL_CAST)
call TriggerAddCondition(Soul_Rip,Condition(function Soul_Rip_Cond))
call TriggerAddAction(Soul_Rip, function Soul_Rip_Actions)
set Soul_Rip=null
endfunction


