Gates and armies

Xonora

New Member
Reaction score
3
lol. Check my trigger again. Its extremely simple. There is no leak. Only a condition. The only action is open/close gate
 

Hot

New Member
Reaction score
9
lol. Check my trigger again. Its extremely simple. There is no leak. Only a condition. The only action is open/close gate

u have to destroy the unit group (dont know the correct script)
 

Xonora

New Member
Reaction score
3
Event
Unit leaves (your region)

Condition


Action

If, then multiple functions, else. (something like that)
Conditions (interger comparison) - Number of units in (your region) = 0 is true

Then - Close gate

Else - Do nothing

Where leak?

Anyway, the command is ' call DestroyGroup (udg_yourgroup) ' (exact spacing)
 

Rainther

I guess I should write something of value here...
Reaction score
61
If it's a global unit group, which seems to be the case you better clear it then destroying it, since destroying it, from what I've heard leaks.

PS: I don't see where is leaks either.
 

Rainther

I guess I should write something of value here...
Reaction score
61
We're just messing with your brain :p

call DestroyGroup is used in order to "kill" a unit group so that it in theory doesn't store memory any longer.
 

Xonora

New Member
Reaction score
3
just go under action - custom script and paste the code in.

I know how u feel. not long ago i had problems with variables too
 

Hacklefellar

New Member
Reaction score
1
it isn't working. i did what you said but now it says : expected 'endif' should i just stick that on the end of the line or do i have to do something else?
 

Xonora

New Member
Reaction score
3
ok try - call DestroyGroup(udg_tempgroup) Where tempgroup is your group name. Must be exact spelling.
 

Hacklefellar

New Member
Reaction score
1
i haven't used unitgroups. i just used the if/then/else command with
if number of units in open door region is equal to 0 (in short)
then close door
else do nothing

what would that make the name of the unit group?
 

Rainther

I guess I should write something of value here...
Reaction score
61
number of units creates a Unit Group, which should be set to a variable before running the if and then handle it with Destroy for instance.
 

Hacklefellar

New Member
Reaction score
1
how does that thing work that u can post a trigger screen in a reply? then i can show you how i did it.

this is how i did it:

Trigger 1 (for opening)
Trigger:
  • Trigger
    • Events
      • Unit - A unit enters open door <gen>
    • Conditions
      • ((Triggering unit) is a flying unit) Equal to False
    • Actions
      • Destructible - Open Gate (Horizontal) 0004 <gen>


Trigger 2 (for closing)
Trigger:
  • Trigger
    • Events
      • Unit - Leaves Open Door <gen>
    • Conditions
    • Actions
      • If ((Number of units in (Units in Open Door <gen>)) Equal to 0) then do (Destructible - Close Gate (Horizontal) 0004 <gen>) Else (Do Nothing)
 

Rainther

I guess I should write something of value here...
Reaction score
61
Make a unit group variable and before calling the "if" set the group variable to "Units in Open Door", refer to the group insetad in the If

and when you're done use a custom script:
call GroupClear(udg_<Unit Group Variable Name>)
 

Xonora

New Member
Reaction score
3
I tot it was DestroyGroup? But i didnt know checking a region has a leak? Its a condition
 

Hacklefellar

New Member
Reaction score
1
this is how it is now:

Trigger 1 (for opening)
Trigger:
  • Trigger
    • Events
      • Unit - A unit enters open door &lt;gen&gt;
    • Conditions
      • ((Triggering unit) is a flying unit) Equal to False
    • Actions
      • Unit Group - Add all units of (Units in Open Door &lt;gen&gt;) to Opendoorgrp
      • Destructible - Open Gate (Horizontal) 0004 &lt;gen&gt;


Trigger 2 (for closing)
Trigger:
  • Trigger
    • Events
      • Unit - Leaves Open Door &lt;gen&gt;
    • Conditions
    • Actions
      • Unit Group - Remove (Triggering unit) from Opendoorgrp
      • If ((Number of units in (Units in Opendoorgrp) Equal to 0) then do (Destructible - Close Gate (Horizontal) 0004 &lt;gen&gt;) Else (Do Nothing)
    • Custom script - call GroupClear(udg_Opendoorgrp)


is it now leak free?:D

also i have 4 doors with each different regions. can i still use only 1 group? or does that cause problems if multiple doors are opened at the same time?
 

Rainther

I guess I should write something of value here...
Reaction score
61
Use 4 seperate groups.

And what it comes to clear or destroying from what I believe it's that destroying does leaks a small amount (from what I've heard), which makes reusing the unit group better. And sorry for messing with you, but on second thoughs you don't need the custom script and you only need to add entering unit to Unit Group in Trigger 1.
 

Samael88

Evil always finds a way
Reaction score
181
I just want to add something here that the others seem to have overlooked:eek:

It's more of a suggestion really.

Use the "if/then/else multiple conditions" instead of the standard one and leave the the else empty.

The "Do nothing" function is a function that really does absolutely nothing good except adding two unnecessary function calls:eek:

Edit: Oh, and I might aswell contribute to the solution while I'm at it:)

I would go for having one region for the open trigger, probably as you have it now.
And then a second region that is two or three times larger for the other trigger, hence you won't be as likely to get the problem of unit's being closed out.
 

Hacklefellar

New Member
Reaction score
1
so u say that if i don't put in anything in the else part, it doesn't leak?
i thought it would just BECAUSE there is a piece of code expected :S but i'm new to this so thats just my logic:D

anyway if this is to be leak-free i thank-thee haha:D
 

bOb666777

Stand against the ugly world domination face!
Reaction score
117
Trigger:
  • Trigger
    • Events
      • Unit - Leaves Open Door &lt;gen&gt;
    • Conditions
    • Actions
      • Set Opendoorgrp = Units in Open Door &lt;gen&gt;
      • If ((Number of units in (Units in Opendoorgrp) Equal to 0) then do (Destructible - Close Gate (Horizontal) 0004 &lt;gen&gt;) Else (Do Nothing)
      • Custom script: call DestroyGroup(udg_Opendoorgrp)


There. And remove the group thing in first trigger ^^.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top