System Automatic Creep Revival

Furby

Current occupation: News poster
Reaction score
144
JASS:
struct CreepCamp // Struct instances are basicly creep camps

Private? :thup:
Nope, I for some reason cannot make it private because it won't compile. I'm using global variable of this struct.
JASS:
unit    array creep     [MAX_CREEPS] // Actual creep units

Does this work?? :confused:
Why wouldn't it?
I currently do not believe this system works.
It works properly.

And now, that I fixed the bug which was not caused my [MAX_CREEPS] arraying, see no reason to use Linked List, it would be just another required system to use.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
see no reason to use Linked List, it would be just another required system to use.
You can make linked list by yourself, it is easy with 1/2 struct array.
 

Jesus4Lyf

Good Idea™
Reaction score
397
Why wouldn't it?

It works properly.

And now, that I fixed the bug which was not caused my [MAX_CREEPS] arraying, see no reason to use Linked List, it would be just another required system to use.
Don't kid yourself. You had [LJASS]MAX_CREEPS[/LJASS] set to 8190 by default in release, which cannot work for two creep groups of 3 creeps each.

Linked lists will remove that constant completely, and are worth looking into. :thup:
 

Furby

Current occupation: News poster
Reaction score
144
I see what u mean now, though I fixed also another bug which was causing units not to respawn.

In onDeath method, the loop was checking even unit which doesn't exist.

I'll look into that linked list.
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Hints :
this -> this.next -> this.next.next -> this.next.next.next -> ... -> 0(End of linked list)
unit 1__unit 2_______unit 3___________unit 4__________n unit
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Linked list is super duper useful. :)
You can discard any node out without rebuilding whole stack.
 

Furby

Current occupation: News poster
Reaction score
144
Hints :
this -> this.next -> this.next.next -> this.next.next.next -> ... -> 0(End of linked list)
unit 1__unit 2_______unit 3___________unit 4__________n unit

Soo, it will make for example 5 instances of Camp struct for one camp with 5 creeps?
 

kingkingyyk3

Visitor (Welcome to the Jungle, Baby!)
Reaction score
216
Soo, it will make for example 5 instances of Camp struct for one camp with 5 creeps?
It can support up n-creeps.
 

SerraAvenger

Cuz I can
Reaction score
234
A linked list of linked lists...

A linked list works like this: Instead of heaving discrete indicies, you have a couple of elements that each have a next (and/or a last) neighbour.

So you can imagine it like a chain of many small chain links. Each chain link has two attached chains. When you remove a chain link, you have to unattach the two neighbours, and then close the chain again by fixing the next and the last chain together.
If you insert an element, you have to open the chain, then attach the two chain elements to the new element and backwards.

Since in programming, you can usually attach and unattach a chain link by simply setting it's next and last elements, you don't have to explicitely unattach it.

Now, a chain element can of course be any type - including a linked list.

Thus what you _could_ do is have one linked list for the creep camps, and every creep camp has another linked list: the creeps within the creep camp.

Oh, and I would strongly suggest either checking for visibility or at least adding some special effects when the creeps are "resurrected". If I understood your code correctly, you currently just make them visible once the timer has expired - which pops them into sight from the middle of nowhere. They just appear oO


>Just, that you don't need it here.
>It works with no help.
Execution order is still important. It may well be that creeps are not created using the map editor, rather than creating them via code. If you don't put it into a library, you will probably not be able to determine which creeps are revived and which not.
 

SanKakU

Member
Reaction score
21
previously i wondered if it could be used for random creep generation.
at first you said if you want random creeps, don't use this system...
but what if...

what if i make the 'creeps' that this affects be units like goblin sapper. different types of them. and then create my own system that randomly generates the actual creeps that you end up fighting? like i make a trigger, 'after the sapper dies', then remove him from the game(corpse included) and replace with some random generation of creeps, according to the sapper type. like, if it was a skeleton, it'll generate undead monsters.

edit: for the moment, you can probably ignore this message, as it seems you're still fine-tuning your system and don't have the time to worry about compatibility with other systems for more functionality.
 

SerraAvenger

Cuz I can
Reaction score
234
previously i wondered if it could be used for random creep generation.
at first you said if you want random creeps, don't use this system...
but what if...

If you know vJASS, you can just use the execution order of libraries to get what you want. Just create the random creeps with a library's initializer, then make this library require the library in question.

Other than that, there's no way. Units that enter the map after map init will be ignored, no matter how they entered.
 

Chaos_Knight

New Member
Reaction score
39
Could you randomize the time between the respawns? I would like it like beetween 15 - 35
Is that possible?:nuts:
 

Laiev

Hey Listen!!
Reaction score
188
edited.


you'll need to use a local variable to don't get a constant value

EDIT EDIT:

JASS:
//  |==========================================|
//  |******************************************|
//  |*****    AUTOMATIC CREEP REVIVAL     *****|
//  |***     ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯     ****|
//  |**              by Furby               ***|
//  |*****             v1.5               *****|
//  |******************************************|
//  |            - Requirements -              |
//  |               TimerUtils                 |
//  |                 Table                    |
//  |******************************************|
//  |        more info at thehelper.net        |
//  |==========================================|
library AutomaticCreepRevival requires TimerUtils, Table
    
    globals 
        private constant integer MAX_CREEPS     = 25 // Maximum number of creeps per camp
        private constant real    RESPAWN_TIME_MIN   = 15. // Time between death of last creep of camp and reviving
        private constant real    RESPAWN_TIME_MAX   = 35. // Time between death of last creep of camp and reviving
        private constant real    BASE_MAXRADIUS = 700. // Maximum radius of camp
    endglobals
    
    // If this function will return true, unit will be stored as creep if not, unit will be ignored
    private function ValidCreep takes unit whatCreep returns boolean
        return /*
        */GetOwningPlayer(whatCreep)                 == Player(PLAYER_NEUTRAL_AGGRESSIVE) and /*
        */IsUnitType(whatCreep, UNIT_TYPE_STRUCTURE) == false                             and /*
        */IsUnitType(whatCreep, UNIT_TYPE_ANCIENT)   == false                           //and
    endfunction
    
    // = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
    //  DO NOT TOUCH BELOW UNLESS YOU KNOW WHAT'RE YOU DOING!
    // = = = = = = = = = = = = = = = = = = = = = = = = = = = =
    
    globals
        private group ALL = CreateGroup()
        private group G = CreateGroup()
        private CreepCamp CAMP = 0
    endglobals
    
    struct CreepCamp // Struct instances are basicly creep camps
        unit    array creep     [MAX_CREEPS] // Actual creep units
        integer array creepOwner[MAX_CREEPS] // Id of the creep's owner
        integer array creepType [MAX_CREEPS] // Type of the creep (raw code)
        real    array creepX    [MAX_CREEPS] // X position of the creep
        real    array creepY    [MAX_CREEPS] // Y position of the creep
        real    array creepAng  [MAX_CREEPS] // Angle of the creep
        integer       creepNumber = 0        // Number of creeps in the camp
        static HandleTable table
        
        private static method onRevive takes nothing returns nothing
            local timer t = GetExpiredTimer()
            local thistype this = thistype(GetTimerData(t))
            local integer i = 0
            loop
                exitwhen(i > creepNumber)
                call ShowUnit(creep<i>, true)
                set i = i + 1
            endloop
            call ReleaseTimer(t)
            set t = null
        endmethod
        
        private static method onDeath takes nothing returns boolean
            local unit dead = GetTriggerUnit()
            local thistype this = thistype(table[dead])
            local integer i = 0
            local boolean startTimer = true
            local timer t
            local integer ir = GetRandomInt (RESPAWN_TIME_MIN, RESPAWN_TIME_MAX)
            if this != 0 then
                call table.flush(dead)
                loop
                    exitwhen(i &gt;= creepNumber)
                    if creep<i> == dead then
                        set creep<i> = CreateUnit(Player(creepOwner<i>), creepType<i>, creepX<i>, creepY<i>, creepAng<i>)
                        set table[creep<i>] = this
                        call ShowUnit(creep<i>, false)
                    endif
                    if IsUnitHidden(creep<i>) == false then
                        set startTimer = false
                    endif
                    set i = i + 1
                endloop
                if startTimer then
                    set t = NewTimer()
                    call TimerStart(t, ir, false, function thistype.onRevive)
                    call SetTimerData(t, this)
                endif
            endif
            set dead = null
            set t = null
            return false
        endmethod
        
        private static method saveCreeps takes nothing returns boolean
            local unit filter = GetFilterUnit()
            local integer i = CAMP.creepNumber
            if ValidCreep(filter) and table.exists(filter) == false and i &lt; MAX_CREEPS then
                set CAMP.table[filter] = CAMP
                set CAMP.creep<i> = filter
                set CAMP.creepOwner<i> = GetPlayerId(GetOwningPlayer(filter))
                set CAMP.creepType<i> = GetUnitTypeId(filter)
                set CAMP.creepX<i> = GetUnitX(filter)
                set CAMP.creepY<i> = GetUnitY(filter)
                set CAMP.creepAng<i> = GetUnitFacing(filter)
                set CAMP.creepNumber = CAMP.creepNumber + 1
            endif
            return false
        endmethod
        
        private static method saveCamps takes nothing returns boolean
            local unit filter = GetFilterUnit()
            local real x = GetUnitX(filter)
            local real y = GetUnitY(filter)
            local integer i
            if ValidCreep(filter) and table.exists(filter) == false then
                set CAMP = thistype.create()
                call GroupEnumUnitsInRange(G, x, y, BASE_MAXRADIUS, Condition(function thistype.saveCreeps))
            endif
            set filter = null
            return false
        endmethod
        
        private static method onInit takes nothing returns nothing 
            local trigger t = CreateTrigger()
            set table = HandleTable.create()
            call GroupEnumUnitsInRect(ALL, bj_mapInitialPlayableArea, Condition(function thistype.saveCamps))
            call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_DEATH)
            call TriggerAddCondition(t, Condition(function thistype.onDeath))
            call DestroyGroup(ALL)
            call DestroyGroup(G)
            set ALL = null
            set G = null
            set t = null
        endmethod
    endstruct
endlibrary</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>
 

Furby

Current occupation: News poster
Reaction score
144
I finally managed to make linked list for this system.
Released version 2.0.

Thank you all! :thup:
 

Furby

Current occupation: News poster
Reaction score
144
Bump :)

What else to change before approve? :rolleyes:

EDIT: version 2.1
 

Laiev

Hey Listen!!
Reaction score
188
Hmm...

maybe you can just add a little condition to check if want or don't the SE

or put [ljass]""[/ljass] just to don't show the SE :confused:
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      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