• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger Request] Neutrals Spawn System and Boss/Miniboss Reward System

Status
Not open for further replies.
Level 3
Joined
Jun 7, 2011
Messages
59
I don't know how frequently you get this kind of thread, but i need a spawn trigger for neutral camps.

Basically, there are 3 types of camps, normal camps, miniboss camps and a boss camp. I'll need triggs for all of them.

All regions have a specific type of neutrals at it, mostly with more units of 2 different types. For instance, a ranged Satyr and a melee one. They should respawn every 30 seconds after the whole creep camp has been killed.

For the miniboss camps, there are 2, with a miniboss that grows in power as he gets killed. He respawns 5 minutes after he dies, but it respawns a different unit(i didn't know any other way for him to grow in power :/ ).

He rewards gold to the whole team of the unit that killed him, as well as experience to all of them. The amount of experience and gold changes with the power of the miniboss.

Boss, basically the same as miniboss, except he'll have some extra rewards which i'll have to think off.
 
Level 6
Joined
May 29, 2012
Messages
295
I thimk this would work (im not sure though)
Event

every 0.001 seconds of game time
condition

if units in region(your region name were the unit camp is) = 0

Action

wait (however long you want)
create (number of units you want) in random point in region(your specified region)


If it works you should be able to use it for all of your respawn requests
as for the gold reward.
dont neutrals have a bounty in their stats?


or you could use this trigger

Event

a unit dies

condition

triggering unit-type = (your units type)

Action

Add 100 gold to player 1 (or whichever player)

But like i said they may not work and im no trigger person.
just trying to help
 
Level 3
Joined
Jun 7, 2011
Messages
59
I don't want a region check cause that can be exploited for camp stacking. I want something that would check if all units are dead not out of region.
 
All regions have a specific type of neutrals at it, mostly with more units of 2 different types. For instance, a ranged Satyr and a melee one. They should respawn every 30 seconds after the whole creep camp has been killed.
it can be done by a system in jass, pick every unit in region then register, if you want it I can do it...
 

JASS:
/*
RespawnAll by Mckill2009

Give credits when used!
*/

library RespawnAll

//! textmacro U takes parent,child
set uID = GetHandleId($child$)
call SaveUnitHandle(ht,uID,0,$parent$)
call SaveReal(ht,uID,1,GetUnitX($child$))
call SaveReal(ht,uID,2,GetUnitY($child$))
call SaveReal(ht,uID,3,GetUnitFacing($child$))     
//! endtextmacro

struct RespawnAll
    unit dum
    integer count
    
    static real dur = 5.0
    static hashtable ht = InitHashtable()
    static unit array ParentDummy
    
    private static method respawnNow takes nothing returns nothing
        local timer t = GetExpiredTimer()
        local thistype this = LoadInteger(ht,GetHandleId(t),0)
        local integer i = .count
        local unit u
        local unit newUnit
        local integer dummyID = GetHandleId(.dum)
        local integer uID
        local integer counter
        local real x
        local real y
        local real facing
        loop
            //loading old unit's value
            set u = LoadUnitHandle(ht,dummyID,i)
            set uID = GetHandleId(u)
            set x = LoadReal(ht,uID,1)
            set y = LoadReal(ht,uID,2)
            set facing = LoadReal(ht,uID,3)
            //setting newUnit's value
            set newUnit = CreateUnit(GetOwningPlayer(u),GetUnitTypeId(u),x,y,facing)
            call SaveUnitHandle(ht,dummyID,i,newUnit)
            call SaveInteger(ht,dummyID,0,.count)
            //! runtextmacro U(".dum","newUnit")
            set u = null
            set newUnit = null
            set i = i - 1
            exitwhen i==0
        endloop     
        call FlushChildHashtable(ht,GetHandleId(t))
        call PauseTimer(t)
        call DestroyTimer(t)
        set t = null
    endmethod    
    
    private static method respawnTrg takes unit u, integer c returns nothing
        local thistype this = allocate()
        local timer t = CreateTimer()
        set .dum = u
        set .count = c
        call SaveInteger(ht,GetHandleId(t),0,this)
        call TimerStart(t,dur,false,function thistype.respawnNow)
        set t = null
    endmethod 
    
    private static method death takes nothing returns boolean
        local unit u = GetTriggerUnit()
        local unit parentU
        local integer uID = GetHandleId(u)
        local integer dummyID
        local integer counter
        local timer t
        if HaveSavedHandle(ht, uID, 0) then
            set parentU = LoadUnitHandle(ht,uID,0)
            set dummyID = GetHandleId(parentU)
            set counter = LoadInteger(ht,dummyID,0)
            call SaveInteger(ht,dummyID,0,counter-1)
            set counter = LoadInteger(ht,dummyID,0)
            if counter==0 then
                call SaveInteger(ht,dummyID,0,LoadInteger(ht,dummyID,1))
                set counter = LoadInteger(ht,dummyID,0)
                call thistype.respawnTrg(parentU,counter)
            endif
        endif
        set u = null
        return false    
    endmethod
    
    static method registerRespawns takes unit u, integer id returns nothing
        local integer dummyID
        local integer uID
        local integer counter
        if ParentDummy[id]==null then
            set ParentDummy[id] = CreateUnit(Player(15),'hpea',0,0,0)
            set dummyID = GetHandleId(ParentDummy[id])
            call SaveInteger(ht,dummyID,0,0) //counter
            call UnitAddAbility(ParentDummy[id],'Aloc')
            call ShowUnit(ParentDummy[id],false)
        else
            set dummyID = GetHandleId(ParentDummy[id])
        endif
        set counter = LoadInteger(ht,dummyID,0) //starts with 0
        call SaveInteger(ht,dummyID,0,counter+1) //counter added by 1, this is the handleID
        set counter = LoadInteger(ht,dummyID,0) //increasing
        call SaveInteger(ht,dummyID,1,counter) //MAXcounter
        call SaveUnitHandle(ht,dummyID,counter,u) //u
        //=====================
        //! runtextmacro U("ParentDummy[id]","u")
    endmethod 
    
    static method onInit takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_UNIT_DEATH)
        call TriggerAddCondition(t,function thistype.death)      
        set t = null
    endmethod
endstruct

endlibrary


How it works?
  • RespawnAll DEMO
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in Region 000 <gen>) and do (Actions)
        • Loop - Actions
          • Custom script: call RespawnAll.registerRespawns(GetEnumUnit(),1)
      • Unit Group - Pick every unit in (Units in Region 001 <gen>) and do (Actions)
        • Loop - Actions
          • Custom script: call RespawnAll.registerRespawns(GetEnumUnit(),2)

- take note that '1' and '2' is UNIQUE number up to 8190
- adjust the static real dur = 5.0 to your needs...

ENJOY!
 
Status
Not open for further replies.
Top