WE help--disease cloud based spreading ability

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"

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, 'B00H'), UnitHasBuffBJ(UNIT, 'B00F')),UnitHasBuffBJ(UNIT, 'B00G')) == 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, 'B00F')==true)then
        call UnitAddAbilityBJ( 'A028', Target )
    endif
    if (UnitHasBuffBJ(Target, 'B00G')==true)then
        call UnitAddAbilityBJ( 'A02B', Target )
    endif
    if (UnitHasBuffBJ(Target, 'B00H')==true)then
        call UnitAddAbilityBJ( 'A02C', 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, 'B00F')==false, GetUnitAbilityLevelSwapped('A028',UNIT) == 1))then
         set UNIT=null
         return true
    endif
    if (GetBooleanAnd(UnitHasBuffBJ(UNIT, 'B00G')==false, GetUnitAbilityLevelSwapped('A02B',UNIT) == 1))then
         set UNIT=null
         return true
    endif
    if (GetBooleanAnd(UnitHasBuffBJ(UNIT, 'B00H')==false, GetUnitAbilityLevelSwapped('A02C',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, 'B00F')==false)then
        call UnitRemoveAbilityBJ( 'A028', Target )
    endif
    if (UnitHasBuffBJ(Target, 'B00G')==false)then
        call UnitRemoveAbilityBJ( 'A02B', Target )
    endif
    if (UnitHasBuffBJ(Target, 'B00H')==false)then
        call UnitRemoveAbilityBJ( 'A02C', 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
 

Flying Hipo

New Member
Reaction score
4
maybe ur problem is that disease cloud wont infect allies. the unit is given disease cloud, but its allies cant be infected by it because they wont be targeted. try changing the targeting of disease cloud.
 

ThePlague

New Member
Reaction score
14
I definitely know th disease cloud spell is working, but for some reason the trigger to give units with the buff the ally-infecting diesase cloud ability isnt working.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Maybe you can make it where when they get the buff, "Disease Cloud", you can add the ability, while making it not able to be seen, to the unit. The added ability will only target allies, so it will "spread" like you said.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Try doing it in Gui to get how it's done, convert it to custom text, clean it up, convert it to VJass if you wish.
 

Cheesy

some fucker
Reaction score
95
Why can't you add actions in GUI?

PS: Don't double post. I won't -rep you but make sure you edit your first post next time.
 

ThePlague

New Member
Reaction score
14
Well theres no Gui command for it
cuz I'm adding it to the trigger this one is creating

THeres no gui equivalent to this is there?
call TriggerAddAction( udg_Infect, function Infect )

Sorry won't double post.
 

ThePlague

New Member
Reaction score
14
ok forget the whole gui thing can anyone see whats wrong with My jass trigger?
Code:
function Infect_Conditions takes nothing returns boolean
    local unit UNIT=GetFilterUnit()
    if (GetBooleanOr(GetBooleanOr( UnitHasBuffBJ(UNIT, 'B00H'), UnitHasBuffBJ(UNIT, 'B00F')),UnitHasBuffBJ(UNIT, 'B00G')) == true )then
         set UNIT=null
         return true
    endif
    set UNIT=null
    return false
endfunction

function Infect_Actions takes nothing returns nothing
    local unit Target=GetEnumUnit()
    if (UnitHasBuffBJ(Target, 'B00F')==true)then
        call UnitAddAbilityBJ( 'A028', Target )
    endif
    if (UnitHasBuffBJ(Target, 'B00G')==true)then
        call UnitAddAbilityBJ( 'A02B', Target )
    endif
    if (UnitHasBuffBJ(Target, 'B00H')==true)then
        call UnitAddAbilityBJ( 'A02C', Target )
    endif
    set Target=null
endfunction

function Uninfect_Conditions takes nothing returns boolean
    local unit UNIT=GetFilterUnit()
    if (GetBooleanAnd(UnitHasBuffBJ(UNIT, 'B00F')==false, GetUnitAbilityLevelSwapped('A028',UNIT) == 1))then
         set UNIT=null
         return true
    endif
    if (GetBooleanAnd(UnitHasBuffBJ(UNIT, 'B00G')==false, GetUnitAbilityLevelSwapped('A02B',UNIT) == 1))then
         set UNIT=null
         return true
    endif
    if (GetBooleanAnd(UnitHasBuffBJ(UNIT, 'B00H')==false, GetUnitAbilityLevelSwapped('A02C',UNIT) == 1))then
         set UNIT=null
         return true
    endif
    set UNIT=null
    return false
endfunction

function Uninfect_Actions takes nothing returns nothing
    local unit Target=GetEnumUnit()
    if (UnitHasBuffBJ(Target, 'B00F')==false)then
        call UnitRemoveAbilityBJ( 'A028', Target )
    endif
    if (UnitHasBuffBJ(Target, 'B00G')==false)then
        call UnitRemoveAbilityBJ( 'A02B', Target )
    endif
    if (UnitHasBuffBJ(Target, 'B00H')==false)then
        call UnitRemoveAbilityBJ( 'A02C', Target )
    endif
    set Target=null
endfunction

function Infect takes nothing returns nothing
    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 ( CountUnitsInGroup(udg_InfectedUnits) == 0 )then
    call DestroyTrigger (udg_Infect)
    call EnableTrigger(gg_trg_Plague)
    return
endif
    call ForGroupBJ(udg_InfectedUnits, function Infect_Actions)
endfunction

function Plague takes nothing returns nothing
    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
 

PureOwnage

Minecraft Server OP, Inactive.
Reaction score
72
ok forget the whole gui thing can anyone see whats wrong with My jass trigger?
Code:
function Infect_Conditions takes nothing returns boolean
    local unit UNIT=GetFilterUnit()
    if (GetBooleanOr(GetBooleanOr( UnitHasBuffBJ(UNIT, 'B00H'), UnitHasBuffBJ(UNIT, 'B00F')),UnitHasBuffBJ(UNIT, 'B00G')) == true )then
         set UNIT=null
         return true
    endif
    set UNIT=null
    return false
endfunction

function Infect_Actions takes nothing returns nothing
    local unit Target=GetEnumUnit()
    if (UnitHasBuffBJ(Target, 'B00F')==true)then
        call UnitAddAbilityBJ( 'A028', Target )
    endif
    if (UnitHasBuffBJ(Target, 'B00G')==true)then
        call UnitAddAbilityBJ( 'A02B', Target )
    endif
    if (UnitHasBuffBJ(Target, 'B00H')==true)then
        call UnitAddAbilityBJ( 'A02C', Target )
    endif
    set Target=null
endfunction

function Uninfect_Conditions takes nothing returns boolean
    local unit UNIT=GetFilterUnit()
    if (GetBooleanAnd(UnitHasBuffBJ(UNIT, 'B00F')==false, GetUnitAbilityLevelSwapped('A028',UNIT) == 1))then
         set UNIT=null
         return true
    endif
    if (GetBooleanAnd(UnitHasBuffBJ(UNIT, 'B00G')==false, GetUnitAbilityLevelSwapped('A02B',UNIT) == 1))then
         set UNIT=null
         return true
    endif
    if (GetBooleanAnd(UnitHasBuffBJ(UNIT, 'B00H')==false, GetUnitAbilityLevelSwapped('A02C',UNIT) == 1))then
         set UNIT=null
         return true
    endif
    set UNIT=null
    return false
endfunction

function Uninfect_Actions takes nothing returns nothing
    local unit Target=GetEnumUnit()
    if (UnitHasBuffBJ(Target, 'B00F')==false)then
        call UnitRemoveAbilityBJ( 'A028', Target )
    endif
    if (UnitHasBuffBJ(Target, 'B00G')==false)then
        call UnitRemoveAbilityBJ( 'A02B', Target )
    endif
    if (UnitHasBuffBJ(Target, 'B00H')==false)then
        call UnitRemoveAbilityBJ( 'A02C', Target )
    endif
    set Target=null
endfunction

function Infect takes nothing returns nothing
    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 ( CountUnitsInGroup(udg_InfectedUnits) == 0 )then
    call DestroyTrigger (udg_Infect)
    call EnableTrigger(gg_trg_Plague)
    return
endif
    call ForGroupBJ(udg_InfectedUnits, function Infect_Actions)
endfunction

function Plague takes nothing returns nothing
    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
I know this has no relevance to the topic but....
Use Jass tags next time. It's the J near the code tag and the php tag.
For example:
JASS:

// Yay Jass!
call DestroyGroup (udg_Hi)
 

ThePlague

New Member
Reaction score
14
oh cool thank you, I'll edit that into my post so maybe it will make my thing clearer to ppl
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top