help with custom script

Shlomi1515

New Member
Reaction score
2
how do i remove it with script?

Set Building[(Player number of (Triggering player))] = (Last created unit)

i wan to remove only to the player that used the trigger and change is building
i want to remove is old unit that been set to Building(his number)
and set new one....
 

Inflicted

Currently inactive
Reaction score
63
by setting the variable to a building, it removes the old one..

so techniqually it is removing it when you set it, if thats what your trying to ask.

but i think arrays work the same when trying to clear them, just add a [] to the end. im not 100% sure tho, but i think it would be like:

Code:
Custom Script: set udg_Building[(Player number of (Triggering player))] = null

although if you are going to set it again, then i gues there is no need to clear it.
 

Shlomi1515

New Member
Reaction score
2
other ppl saying that is not... they saying it's still in the memory and that causing a memory leak....
 

Laiev

Hey Listen!!
Reaction score
188
by setting the variable to a building, it removes the old one..

so techniqually it is removing it when you set it, if thats what your trying to ask.

but i think arrays work the same when trying to clear them, just add a [] to the end. im not 100% sure tho, but i think it would be like:

Code:
Custom Script: set udg_Building[(Player number of (Triggering player))] = null

although if you are going to set it again, then i gues there is no need to clear it.
no..... it is something like

JASS:
set udg_Building[GetPlayerId(GetTriggerUnit())] = null


other ppl saying that is not... they saying it's still in the memory and that causing a memory leak....

globals variable are always replaceable, so you don't need to null it... also... unit don't leak... the only global variable which you need to destroy is Special Effect, Point, Player Group (be afraid with this) and Unit Group...

no global variable need to be nulled
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
forces and rects leak as well as floating texts do.


what you have to keep in mind is the following, things leak which you create by setting the variable.

for example:
if you set a unit variable you will not create a new unit, you will just tell the computer that some unit on the map is linked to that variable.
but if you set a unit group variable you are creating a new group which hasnt been there before.
when you re-set the unit variable there will still be the same amount of units in the game, if you re-set the unit group variable there will be created another group and the first one will stay forever on.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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