Spawning System

stavious

New Member
Reaction score
24
I'm going into a bit of a new feild for me and testing the ORPG map styles. Currently I'm trying to make one; just to test my abilities with the Editor and expand my knowledge a bit. I want the creeps in my map to re-spawn, like in any simple map. So basically I want a Spawning System for the creeps in my map. I was just wondering who could give me the most efficant trigger for this or could point out to me which way may work better than the other one. Thanx for helping me understand better :) .
 

emjlr3

Change can be a good thing
Reaction score
395
well...the most efficient is...well...JASS

are your units preplaced, or do you place them?

if they are preplaced, then...

at map init, have this

Code:
local integer i = 1
local unit u
local group g = CreateGroup()

call GroupEnumUnitsInRect(g,bj_mapInitialPlayableArea,null)        
    loop
        set u = FirstOfGroup(g)
        exitwhen u == null
        call GroupRemoveUnit(g,u)      
        if GetOwningPlayer(u)== Player(PLAYER_NEUTRAL_AGGRESSIVE) then 
            set udg_Creep_Types[i] = GetUnitTypeId(u)
            set udg_Creep_Positions[i] = GetUnitLoc(u)
            call SetUnitUserData( u, i)
        endif
        set i = i + 1        
    endloop 

call DestroyGroup(g)
set g = null

u need two global variables
Creep_Types - integer array
Creep_Positions - location array

then to respawn them

Code:
function creep_revive_Actions takes nothing returns nothing
    local integer i = GetUnitUserData(GetTriggerUnit()) 
     
    call PolledWait( 60.00 ) // length of tiem for respawn
    set bj_lastCreatedUnit = CreateUnitAtLoc( Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Creep_Types[i], udg_Creep_Positions[i], GetRandomReal(0, 360) )
    call SetUnitUserData( bj_lastCreatedUnit, i )  
endfunction

function blah takes nothing returns nothing
local trigger creep_revive = CreateTrigger()

call TriggerRegisterPlayerUnitEvent(creep_revive, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH, null)
    call TriggerAddAction( creep_revive, function creep_revive_Actions )

set creep_revive = null
endfunction

whats in function blah can also be at map init, if you want, to save space, but your revive function must be above it in the same trigger
 

stavious

New Member
Reaction score
24
Oh, I should've mentioned: I don't know the first thing about JASS. I use only the triggers in the Editor for all of my map works, nothing above that. So if you could give your answers using those triggers that would be great ;) .
 

Knights

You can change this now in User CP.
Reaction score
71
Heres one:


Code:
Spawn
    Events
        Time - Elapsed game time is 0.00 seconds
    Conditions
    Actions
        Unit Group - Pick every unit in (Units owned by Player 12 (Brown)) and do (Actions)
            Loop - Actions
                Set CreepInt = (CreepInt + 1)
                Set CreepPlace[CreepInt] = (Region centered at (Position of (Picked unit)) with size (25.00, 25.00))
                Set Creep[CreepInt] = (Picked unit)
                Set CreepAngle[CreepInt] = (Facing of (Picked unit))
        Custom script:   call DestroyGroup (bj_lastCreatedGroup)

Code:
NewSpawn
    Events
        Unit - A unit Dies
    Conditions
        (Owner of (Dying unit)) Equal to Player 12 (Brown)
    Actions
        For each (Integer A) from 1 to CreepInt, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Creep[(Integer A)] Equal to (Dying unit)
                    Then - Actions
                        Wait 48.00 seconds
                        Unit - Create 1 (Unit-type of (Dying unit)) for Player 12 (Brown) at (Center of CreepPlace[(Integer A)]) facing CreepAngle[(Integer A)] degrees
                        Set CreepPlace[(Integer A)] = (Region centered at (Position of (Last created unit)) with size (25.00, 25.00))
                        Set Creep[(Integer A)] = (Picked unit)
                    Else - Actions
                        Do nothing
 

stavious

New Member
Reaction score
24
Hmm Knights, I don't understand your first trigger too much. Can you explain a bit what they both do so I can get a better idea; thanx :D .
And does anyone seem to have a better way of making a spawning system? If so please share them with me :) .
 

Chocobo

White-Flower
Reaction score
409
Code:
NewSpawn
    Events
        Unit - A unit Dies
    Conditions
        (Owner of (Dying unit)) Equal to Player 12 (Brown)
    Actions
        For each (Integer A) from 1 to CreepInt, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        Creep[(Integer A)] Equal to (Dying unit)
                    Then - Actions
                        Wait 48.00 seconds
                        Unit - Create 1 (Unit-type of (Dying unit)) for Player 12 (Brown) at (Center of CreepPlace[(Integer A)]) facing CreepAngle[(Integer A)] degrees
                        Set CreepPlace[(Integer A)] = (Region centered at (Position of (Last created unit)) with size (25.00, 25.00))
                        Set Creep[(Integer A)] = (Picked unit)
                    Else - Actions
                        Do nothing

:p I wonder if there will be a lot of creeps after

Here my code :

Code:
Set Levels
Events
Game - Time Elasped 0.00 seconds of game-time

Conditions
None

Actions
//Determines Unit Types.
LevelUnit1[1] = Footman (Level 1)
LevelUnit1[2] = Footman (Level 2)
...
LevelUnit1[10] = Footman (Level 10)
LevelUnit2[1] = Rifleman (Level 1)
LevelUnit2[2] = Rifleman (Level 2)
....
LevelUnit2[10] = Rifleman (Level 10)
//This Triggers up to 10 Levels, like heroes in Melee mode.

Code:
Respawn
Events
Unit - Generic unit dies

Conditions
(Owner of (Triggering unit)) Equal to Player 12 (Brown)
//Player 12 is Creeps, you can change it as you want

Actions
Custom Script : local unit udg_Killer
Custom Script : call PolledWait(60. )
Set RandomInt = (Random Integer between 1 to 2) //Determines a unit-type
If (RandomInt) Equal to 1 //Will Create a UnitType1
      Then Unit - Create 1 UnitType1[(Hero level of (Killer))] for (Player 12) at (<whatever>) facing 0.00 degrees //Footman
      Else Unit - Create 1 UnitType2[(Hero level of (Kiler))] for (Player 12) at (<whatever>) facing 0.00 degrees //Rifleman
 

stavious

New Member
Reaction score
24
Chocobo does that trigger use JASS or something? If not I don't really get the Custom Script part (since I never use those :eek: ).
 

Monovertex

Formerly Smith_S9
Reaction score
1,461
The Custom Script is for useing Jass in GUI so yeah, that trigger uses Jass, but so little that it can't be a problem :p
 

Chocobo

White-Flower
Reaction score
409
stavious said:
Chocobo does that trigger use JASS or something? If not I don't really get the Custom Script part (since I never use those :eek: ).

Custom Script : local unit udg_Killer
Custom Script : call PolledWait(60. )

Code:
Custom Script : local unit udg_Killer

It is to declare a "local" variable, which is only used by a function.

Code:
Custom Script : call PolledWait(60. )

Equal to : Wait 60 seconds of game-time.
 

Chewbalka

New Member
Reaction score
14
Events
Time- Every ?.?? seconds of game time
(periodic event)
Conditions-
Actions- Create # Unit For (player 1?) At (Center of(playable map area) Facing (default building facing)

Revive

Events-
unit- Owned by (player 1?) Dies
Condition
Action
Create 1 (unit-type of(dying unit)) For (player 1?) at (Center of (playable map area)) Facing (default building facing)

Like this? a basic spawn
youll need regions made for top and a allready made unit in the Seconds unless you change the (dying unit) thing lol.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top