Spawning Lag

Venge22

New Member
Reaction score
10
Ok, so i made 1 footman spawn every 2 seconds. Every thing was running good until it started to lag when a unit spawned. It was eventually lagging for like a split second every 3 seconds or so. If there a way to stop this lag?
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Remove the leaks from creating the units.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
Ok, assign each last created units, your footman, into variables with a name of your choice. Then call a custom script with...
Code:
call DestroyUnit(udg_yourunitvariable)
 

Exide

I am amazingly focused right now!
Reaction score
448
There's an action called Custom script, it's pretty near the top of the list. -Only in The Frozen Throne, though.

Also, units don't leak. Well they do, but they eventually die and clean up after themselves, so there's no worry there.

However, you should remove the point leak. -Where you create the unit. (Usually Center of *region, or Random point in *region.)
-This is done by creating a Point Variable, using set variable to set it.
set TempPoint = Center of (Playable Map)
Create 1 Footman for Player 1 (Red) at TempPoint facing 270.00
Custom Script call RemoveLocation(udg_TempPoint)

There are tons of leak tutorials around here, if you want more information.
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
The new EGUI thing is helpful. It has all the leak clean up scripts in GUI triggers.
 

Venge22

New Member
Reaction score
10
Ack, this is confusing for me. Idk wat Gui and other stuff like that is.:D O, wait Gui is regular triggers. I just found that out. :p
 

Exide

I am amazingly focused right now!
Reaction score
448
Man, i only have RoC. :(

Then you can do it in JASS, just the same.

GUI is the opposite of JASS. GUI is what you know as triggers.
JASS is the programming language that WC3 uses.
GUI - Graphical User Interface, a simplified and more beginner-friendly way of creating triggers in JASS.

You should buy TFT, if you want to create maps in WC3.
RoC is horrible to work with. :p
 

Venge22

New Member
Reaction score
10
Yes, im planning on buying TFT soon. Isn't it only like 15 dollars? So, i cant really fix the lag i guess :p
 

Exide

I am amazingly focused right now!
Reaction score
448
I don't know, I don't use dollars. :rolleyes:
-It's not very expensive, though.

Yes, you can fix your lag using JASS.
Click 'Edit -> Convert to Custom Text', and your trigger will converted into JASS. -Then you can use local variables to make it even more simple for yourself. :p
 

Venge22

New Member
Reaction score
10
Um, im being dumb today. Where in the actions or whereever it is is teh Edit convert to custom text?
 

Renendaru

(Evol)ution is nothing without love.
Reaction score
309
It is no action... Select your trigger go to the Edit drop down menu at top of the window of the trigger editor then select it.
 

Venge22

New Member
Reaction score
10
Is it in actions or wat? Im asking where to find it, i already know wat to look for
 

Exide

I am amazingly focused right now!
Reaction score
448
I'm pretty sure RoC should have it..

Open the Trigger Editor (F4), Create a new trigger.
Add one event and one Action:
Code:
Untitled Trigger 001
    Events
        Map initialization
    Conditions
    Actions
        Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
Then, at the very top of the screen, click 'Edit' and scroll down to 'Convert to Custom Text'.

You will get a warning message, telling you that you can't convert the trigger back to GUI, if you convert it to JASS - click yes to continue.
Your trigger should now look like this:
JASS:

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction

Here you can add tons of actions that RoC-GUI won't allow you to use. :p
 

Venge22

New Member
Reaction score
10
Ahhh XD Thx, im being retarted today o_O It looks confusing. Also if this changes anything i made the units go to the middle of the map for my game.
 

Exide

I am amazingly focused right now!
Reaction score
448
>Also if this changes anything i made the units go to the middle of the map for my game.
-Yes, it changes things. :p

Now, to clean up the leaks:
JASS:

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
     local location temppoint = GetRectCenter(GetPlayableMapRect()  // This sets the point.
    call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), temppoint), bj_UNIT_FACING )
    call RemoveLocation(temppoint)    //This cleans up the leaks.
    set temppoint = null       //This cleans up the leaks.
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction


Simple enough. :p

// - Comments. Not needed for the trigger to work.
 

Venge22

New Member
Reaction score
10
lol, ok. I don't feel like working on it now though :p mapmaking gets nerve wrecking sumtimes.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top