ThePlague
New Member
- Reaction score
- 14
Spreading Disease Cloud Jass Trigger
First time posting here hope i did this right.
Anyways I made an ability based off Serpent Ward which summons a disease cloud and infects units, from there the units should be able to infect other units, but its not working.
I know initially infecting the unit is working, but it does not seem to be adding the ability to spread the disease
it adds an ability based off spellbook (3 levels) so that the ability cant be seen with a disease cloud based ability in each
the spellbook ability is a disease cloud (1 for each level) with seperate buffs to determine which one it is that infects "air,friend,ground,neutral,not self,organic"
btw the buff lasts 10 seconds
Also just wondering is there anywaays i can give a spellbook a different level of an ability and change that level? cuz that would let me simplify this alot
First time posting here hope i did this right.
Anyways I made an ability based off Serpent Ward which summons a disease cloud and infects units, from there the units should be able to infect other units, but its not working.
I know initially infecting the unit is working, but it does not seem to be adding the ability to spread the disease
it adds an ability based off spellbook (3 levels) so that the ability cant be seen with a disease cloud based ability in each
the spellbook ability is a disease cloud (1 for each level) with seperate buffs to determine which one it is that infects "air,friend,ground,neutral,not self,organic"
JASS:
function Infect_Conditions takes nothing returns boolean
//checks if the unit has any of the 3 disease cloud-based buffs also localizes and nulls the unit to reduce leaks
local unit UNIT=GetFilterUnit()
if (GetBooleanOr(GetBooleanOr( UnitHasBuffBJ(UNIT, 039;B00H039;), UnitHasBuffBJ(UNIT, 039;B00F039;)),UnitHasBuffBJ(UNIT, 039;B00G039;)) == true )then
set UNIT=null
return true
endif
set UNIT=null
return false
endfunction
function Infect_Actions takes nothing returns nothing
//checks which type of disease the unit was infected with and adds corresponding ability
local unit Target=GetEnumUnit()
if (UnitHasBuffBJ(Target, 039;B00F039;)==true)then
call UnitAddAbilityBJ( 039;A028039;, Target )
endif
if (UnitHasBuffBJ(Target, 039;B00G039;)==true)then
call UnitAddAbilityBJ( 039;A02B039;, Target )
endif
if (UnitHasBuffBJ(Target, 039;B00H039;)==true)then
call UnitAddAbilityBJ( 039;A02C039;, Target )
endif
set Target=null
endfunction
function Uninfect_Conditions takes nothing returns boolean
//checks which buff the unit does not have then removes its ability to spread that disease
//(done in case multiple players have the ability at different levels)
//returns true with which buff the unit does NOT have so the game can then remove it for that unit
local unit UNIT=GetFilterUnit()
if (GetBooleanAnd(UnitHasBuffBJ(UNIT, 039;B00F039;)==false, GetUnitAbilityLevelSwapped(039;A028039;,UNIT) == 1))then
set UNIT=null
return true
endif
if (GetBooleanAnd(UnitHasBuffBJ(UNIT, 039;B00G039;)==false, GetUnitAbilityLevelSwapped(039;A02B039;,UNIT) == 1))then
set UNIT=null
return true
endif
if (GetBooleanAnd(UnitHasBuffBJ(UNIT, 039;B00H039;)==false, GetUnitAbilityLevelSwapped(039;A02C039;,UNIT) == 1))then
set UNIT=null
return true
endif
set UNIT=null
return false
endfunction
function Uninfect_Actions takes nothing returns nothing
//removes the ability to spread the disease from the unit
local unit Target=GetEnumUnit()
if (UnitHasBuffBJ(Target, 039;B00F039;)==false)then
call UnitRemoveAbilityBJ( 039;A028039;, Target )
endif
if (UnitHasBuffBJ(Target, 039;B00G039;)==false)then
call UnitRemoveAbilityBJ( 039;A02B039;, Target )
endif
if (UnitHasBuffBJ(Target, 039;B00H039;)==false)then
call UnitRemoveAbilityBJ( 039;A02C039;, Target )
endif
set Target=null
endfunction
function Infect takes nothing returns nothing
//sets unit groups, removes ability to spread disease from units whom the buff has ran out on
set udg_UninfectedUnits=GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Uninfect_Conditions))
call ForGroupBJ(udg_UninfectedUnits, function Uninfect_Actions)
set udg_InfectedUnits=GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Infect_Conditions))
]//if no units are infected this trigger is destroyed and the original one is enabled
if ( CountUnitsInGroup(udg_InfectedUnits) == 0 )then
call DestroyTrigger (udg_Infect)
call EnableTrigger(gg_trg_Plague)
return
endif
//runs the main action of the trigger
call ForGroupBJ(udg_InfectedUnits, function Infect_Actions)
endfunction
function Plague takes nothing returns nothing
//This is the beginning of the trigger all the above functions do nothing until this trigger enables them
//all it does is check every 3 seconds if any units are infected ,if any are it enables the other trigger
set udg_InfectedUnits=GetUnitsInRectMatching(GetPlayableMapRect(), Condition(function Infect_Conditions))
if ( CountUnitsInGroup(udg_InfectedUnits) == 0 )then
return
endif
set udg_Infect=CreateTrigger()
call TriggerRegisterTimerEventPeriodic( udg_Infect, 1.50 )
call TriggerAddAction( udg_Infect, function Infect )
call DisableTrigger(gg_trg_Plague)
endfunction
//===========================================================================
function InitTrig_Plague takes nothing returns nothing
set gg_trg_Plague = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Plague, 3.00 )
call TriggerAddAction( gg_trg_Plague, function Plague )
endfunction
btw the buff lasts 10 seconds
Also just wondering is there anywaays i can give a spellbook a different level of an ability and change that level? cuz that would let me simplify this alot