• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Zombie Infection Sequence Testing

Status
Not open for further replies.
Level 5
Joined
Oct 7, 2005
Messages
102
Hey guys, I'm currently trying to create a "Realistic" process of zombie infection in preperation for making an RPG.

Basically, you control a guy called "The Plague Man", who represents the infection. You will have to find the best way to bring down humanity by strategically placing a source of the infection amongst human society.

One human dies from infection, they bite/scratch someone else, they slowly die and reanimate ect...

My problem is, I think the game is getting confused with my trigger. If you look closely in the map, zombies are spawning and respawning from the same person/position as different types of zombies, male/female child/adult ect...

I'm trying to make it so that each individual has a clean sequence of infection -> slow deterioration -> death -> reanimation.

Maybe some kind of variable is needed for each unit, but I don't know how to do this.

Please help, thanks.
 

Attachments

  • Zombie Outbreak Testing.w3x
    239.3 KB · Views: 65
Level 16
Joined
May 1, 2008
Messages
1,605
Well let me say you did it in a very confused way .. I can help you with this but this will need a bit.

Edit: Okay you should takes this trigger for the spawn itself. [Tested and works]:

JASS:
library Infection initializer init

    globals
        private constant integer UNIT_ID_MAN = 'n001'
        private constant integer UNIT_ID_WOMAN = 'n005'
        private constant integer UNIT_ID_KID_1 = 'n006'
        private constant integer UNIT_ID_KID_2 = 'n009'
        
        private constant integer ZOMBIE_ID_MAN = 'n002'
        private constant integer ZOMBIE_ID_WOMAN = 'n004'
        private constant integer ZOMBIE_ID_KID_1 = 'n007'
        private constant integer ZOMBIE_ID_KID_2 = 'n008'
        
        private constant string RISE_ZOMBIE_EFFECT = "Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl"
        
        private constant real RISE_ZOMBIE_DURATION_MIN = 10.
        private constant real RISE_ZOMBIE_DURATION_MAX = 15.
        
        // Don't change \\
        
        private constant hashtable HASH = InitHashtable()
    endglobals
    
    private struct Infection
        real    x   =   0.
        real    y   =   0.
        integer i   =   0
        
        static method periodic takes nothing returns nothing
            local timer t = GetExpiredTimer()
            local thistype this = LoadInteger(HASH,GetHandleId(t),0)
            
            call DestroyEffect(AddSpecialEffect(RISE_ZOMBIE_EFFECT,.x,.y))
            if .i == 1 then
                call CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE),ZOMBIE_ID_MAN,.x,.y,0.)
            elseif .i == 2 then
                call CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE),ZOMBIE_ID_WOMAN,.x,.y,0.)
            elseif .i == 3 then
                call CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE),ZOMBIE_ID_KID_1,.x,.y,0.)
            elseif .i == 4 then
                call CreateUnit(Player(PLAYER_NEUTRAL_AGGRESSIVE),ZOMBIE_ID_KID_2,.x,.y,0.)
            endif
            
            set t = null
        endmethod

        static method create takes unit u returns thistype
            local thistype this = .allocate()
            local timer t = CreateTimer()
            local real r = 0
            
            set .x = GetUnitX(u)
            set .y = GetUnitY(u)
            
            if GetUnitTypeId(u) == UNIT_ID_MAN then
                set .i = 1
            elseif GetUnitTypeId(u) == UNIT_ID_WOMAN then
                set .i = 2
            elseif GetUnitTypeId(u) == UNIT_ID_KID_1 then
                set .i = 3
            elseif GetUnitTypeId(u) == UNIT_ID_KID_2 then
                set .i = 4
            endif
            
            set r = GetRandomReal(RISE_ZOMBIE_DURATION_MIN,RISE_ZOMBIE_DURATION_MAX)
            call SaveInteger(HASH,GetHandleId(t),0,this)
            call TimerStart(t,r,false,function thistype.periodic)
            
            set t = null
            return this
        endmethod
    endstruct
            
    private function condition takes nothing returns boolean
        local unit u = GetTriggerUnit()
        if GetUnitTypeId(u) == UNIT_ID_MAN or GetUnitTypeId(u) == UNIT_ID_WOMAN or GetUnitTypeId(u) == UNIT_ID_KID_1 or GetUnitTypeId(u) == UNIT_ID_KID_2 then
            call Infection.create(u)
        endif
        set u = null
        return false
    endfunction
    
    private function init takes nothing returns nothing
        local trigger t = CreateTrigger()
        local integer i = 0
        
        loop
            exitwhen i == 16
            call TriggerRegisterPlayerUnitEvent(t,Player(i),EVENT_PLAYER_UNIT_DEATH,null)
            set i = i + 1
        endloop
        call TriggerAddCondition(t,function condition)
        
        set t = null
    endfunction
endlibrary

YES! I know it's in vJass - but I don't know GUI anymore and GUI is a waste of memory anyway so..

1) I don't understand the sense of the "Infect Ability" nor this "Spider spawn" - please explain^^
 
Last edited:
Level 5
Joined
Oct 7, 2005
Messages
102
Ohhhhh Jass.

I don't like Jass.

I'll use it but I would much rather have the normal trigger type so I can make adjustments, and actually understand what I'm looking at.

The spider is a parasite you spawn which has a 1/3 chance to infect someone on attack. But they also have a significant chance of dying themselves on each attack.

The other ability is just failed rubbish.

Thanks for replying.
 
Level 5
Joined
Oct 7, 2005
Messages
102
Sorry for double posting.

Can someone please produce a GUI trigger? I want to be able to understand and tweak it.
 
Status
Not open for further replies.
Top