• 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.

Should I unit Recycle?

Status
Not open for further replies.
Level 15
Joined
Nov 30, 2007
Messages
1,202
I'm gonna make this system myself:
Farms train or Spawn Pack Horses that walks to a targeted Town Hall. (The farm uses an ability to change destination.) Also, it can only have 2-3 living Pack Horses from each farm at a time. Greater then that and it should stop producing and start red-pinging the map at the farm. Perhaps even add a ability to "Find Pack Horse" which would cycle through the living pack horses from the farm, alternativly the pack horse could be a worker and would show up as idle and thus making the spell unnecessary.

When the Pack Horse reach the Town the supply is converted into Mana regeneration. Which is used to give mana to nearby units. The town should have the spell Spirit Touche. And when casted it should give mana to all nearby units until its emty. The mana given should be proportional to the mana it has - meaning, when its emty no more units will recieve mana.

If you want to continue...
The mana of every unit decreases over time and when it reaches 0 the unit is given a debuff that makes it move/attack slower and have negative life regeneration until it recieves mana again.

I hope you like my request and find the time to do it. I would be greatful!

Additional Detail:
- If the town has full mana it can't unload, if it doesn't unload all mana the supply unit remains alive until empty.
- The Town can't be given more mana then its capacity.
- The mana each supply unit spawns with should be customizeable from one building to another.



*Each farm has a index value.
*Each farm has its own Mana. You can disable/enable production (stop draining mana)
* When mana reaches 0 a unit is summoned. You can have max 3 from each farm.
* The unit summoned will move to the harvested resources to a drop off point.
* Since, a certain person here (Dr Super Good) would probably argue creating so many units is a bad idea, I figured i Should use a Unit Recyle System. Because this is gonna run all game long and who knows how many units will be created by then.

So how does such a sytem (unit recycle) work?

Does anyone use a unit recyling system for anything? Is it worth it? Why, why not?

There is also another trigger in my map that creates hidden units for tech-options that are created/killed, since hiding them wont work - Am I fucked? ^^

Could someone show me how to keep a 20 hp unit alive from a > 20 damage using some gui damage detection. Do I check before dealing any damage if the damage is > then hp?) and if that is the case set hp to 1? And for playing the death animation and removing selection temporarily I give it locust, and to remove locust I have to use the crow form ability or something like that?

Should I ever decrease the amount of hidden units inside the system. Say at some point the used units are 50-70% below its peak (unlikely, but as a expample scenario) should i then remove some units?

JASS:
library Walkers initializer init

globals
    group liveWalkers = CreateGroup()
    group deadWalkers = CreateGroup()
endglobals


function SpawnWalker takes real f, real x, real y, player p returns nothing
    local unit u = FirstOfGroup(deadWalkers)
    if (u != null) then
        call SetUnitX(x)
        call SetUnitY(y)
        call SetUnitFacing(u,f)
        call GroupRemoveUnit(deadWalkers,u)
        call GroupAddUnit(liveWalkers,u)
        call SetUnitOwner(u,p,true)
        call SetUnitAnimation(u,"stand")
        call SetUnitState(u, UNIT_STATE_LIFE, 200) // Not sure how to set to max life...
        call ShowUnit(u,true)
        call UnitRemoveAbility(u,'Aloc') // Not sure how to remove Locust Properly... 
    else
        set u = CreateUnit(p,'hpea',x,y,f)
        call GroupAddUnit(liveWalkers)
    endif
endfunction

private function WalkerDeath takes nothing returns nothing
    local unit u = udg_DamageEventTarget
    if (IsUnitInGroup(u, liveWalkers) == true) and GetUnitState(u,UNIT_STATE_LIFE) <= udg_DamageEventAmount) then
        set udg_DamageEventAmount = 0.00
        call SetUnitAnimation(u, "death")
        call SetUnitOwner(u,Player(PLAYER_NEUTRAL_PASSIVE),false)
        call UnitAddAbility(u,'Aloc')
        call TriggerSleepAction(5.00)
        call ShowUnit(u,false)
        call GroupAddUnit(deadWalkers,u)
    endif
endfunction

private function init takes nothing returns nothing
    local trigger t1 = CreateTrigger()
    call TriggerRegisterVariableEvent(t1,"udg_DamageModifierEvent", EQUAL, 1.00)
    call TriggerAddAction(t1, function WalkerDeath)
endfunction

endlibrary

I forgot how the Storm Crow trick worked... So you cant target the respawned builder.

What you think?
 
Last edited:
Level 15
Joined
Nov 30, 2007
Messages
1,202
I don't think you should recycle. There would be barely a difference, and it would be barely noticeable at thousands of units created and killed.

Okey, I have no idea as of the actual number of units that could probably be created throughout a game. But lets say 10 000 'hpea':s. As a estimated high amount. But okey, for now I leave it be.
 
I have a map where two heroes have the Factory ability and leave fire in their wake. The game lasts about 35 minutes, and they spawn fire every 0.5 seconds (lasting for 3 seconds). There is no FPS drop.

That's a total of around 8000 units from the ability only, excluding dummies used for all sorts of 40+ triggered spells used frequently, and the units that spawn every 15s for each base (16 total per 15s, 2240 total).
 
Status
Not open for further replies.
Top