wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Developer's Corner > Triggers & Scripts
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Reply
 
Thread Tools Search this Thread
Old 08-26-2006, 08:29 PM   #1
GosuSheep
User
 
Join Date: Jan 2004
Posts: 265

GosuSheep has little to show at this moment (4)

Default ESC triggers while not selecting building unit

In my map, hitting the ESC key toggles the leaderboard on/off.

i cant figure out how to have the trigger check if a unit in the selection of the player is under construction.

Basically, I'm trying to let the players cancel their buildings if they want to, and NOT toggle the leaderboard.

something like no units in selection of player is under construction. i dont know.
but



replies are greatly appreciated
GosuSheep is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 08-26-2006, 08:30 PM   #2
Blade.dk
.
 
Blade.dk's Avatar


Respected User
 
Join Date: May 2005
Posts: 1,990

Submissions (15)

Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)Blade.dk is a glorious beacon of light (418)

Approved Map: Azeroth's Arcane ArenaSpell session 01 winner

Send a message via MSN to Blade.dk
Default

Pick every building owned by the player, and check if they are selected.. If one is, then do nothing, else hide the board.

EDIT: Use a condition like this:

Trigger:
Trigger
Collapse Conditions
(Number of units in (Units owned by (Triggering player) matching ((((Matching unit) is A structure) Equal to True) and (((Matching unit) is selected by (Triggering player)) Equal to True)))) Equal to 0

Notice that it has a group leak.
__________________
Spell Making Course: Part 1: Making a simple stomp spell.
I wonder if I'll ever finish part 2.
Blade.dk is offline   Reply With Quote
Old 08-26-2006, 08:41 PM   #3
GosuSheep
User
 
Join Date: Jan 2004
Posts: 265

GosuSheep has little to show at this moment (4)

Default

now how can i check if the building is under construction?

and what is a loop memory leak and how can i prevent them from ever happening?
GosuSheep is offline   Reply With Quote
Old 08-26-2006, 08:47 PM   #4
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

It's not a loop memory leak, there is no such thing, it's a group memory leak. You can fix it by setting the group to a variable before using it for the loop and then destroying it after you use it.
__________________
Anitarf is offline   Reply With Quote
Old 08-26-2006, 08:49 PM   #5
GosuSheep
User
 
Join Date: Jan 2004
Posts: 265

GosuSheep has little to show at this moment (4)

Default

now what do these group leaks do? slow down the game?
GosuSheep is offline   Reply With Quote
Old 08-26-2006, 09:10 PM   #6
aquilla
User
 
aquilla's Avatar
 
Join Date: Mar 2003
Posts: 217

Submissions (1)

aquilla will become famous soon enough (71)aquilla will become famous soon enough (71)aquilla will become famous soon enough (71)

Send a message via MSN to aquilla
Default

Yes, pretty much, can cause lag in bad chases. What it means is that the reference to an object, in this case a group, in memory is never deleted although it won't ever be used again - so it's still taking up RAM. (= leaking) So obviously it's much worse for older comps

Trigger:
set tempgroup = Units owned by (Triggering player) matching ((((Matching unit) is A structure) Equal to True) and (((Matching unit) is selected by (Triggering player)) Equal to True)))
If (Number of units in (tempgroup) Equal to 0 then
...
end of if statement
Custom script: call DestroyGroup(udg_tempgroup)
__________________
You don't care what I've listened to lately
but I'll tell you anyway,
because that's the only thing I'm good at.

Last edited by aquilla : 08-26-2006 at 11:22 PM.
aquilla is offline   Reply With Quote
Old 08-26-2006, 11:45 PM   #7
GosuSheep
User
 
Join Date: Jan 2004
Posts: 265

GosuSheep has little to show at this moment (4)

Default

now can u please tell me where to get all the information about custom scripts?

will destroygroup work for all varaibles? or only unit groups?
and what is udg?

if i can put destroy variables like that all the time and prevent leaks, that would be a HUGE breakthrough in my map.

replies are greatly appreciated.

Last edited by GosuSheep : 08-26-2006 at 11:47 PM.
GosuSheep is offline   Reply With Quote
Old 08-27-2006, 12:01 AM   #8
aquilla
User
 
aquilla's Avatar
 
Join Date: Mar 2003
Posts: 217

Submissions (1)

aquilla will become famous soon enough (71)aquilla will become famous soon enough (71)aquilla will become famous soon enough (71)

Send a message via MSN to aquilla
Default

When I learned JASS I used JassCraft, you can download it in the tools section, and the "convert trigger to custom text" you can find in the editor.

DestroyGroup() only works for groups, there are several others but that one nad RemoveLocation() are the most important ones. udg_ is something WE automaticly writes in front of "globals" (those in variables list), so the udg_tempgroup would just be a variable of type group called tempgroup.

And for the record, it's not the actual variable that leaks, it's the object it points to. When you store a group like above the editor makes sure a group is automaticly created, but then never destroyed :/ So no need to worry about variables leaking (for now, "local" variables which can only be used in JASS have some issues)
__________________
You don't care what I've listened to lately
but I'll tell you anyway,
because that's the only thing I'm good at.
aquilla is offline   Reply With Quote
Old 08-27-2006, 09:04 AM   #9
The)TideHunter(
SpeakerGames.com
 
The)TideHunter('s Avatar
 
Join Date: Mar 2006
Posts: 1,328

Submissions (1)

The)TideHunter( is a jewel in the rough (160)The)TideHunter( is a jewel in the rough (160)

Send a message via MSN to The)TideHunter(
Default

Yea.
When you set something to something, it just creates a pointer, when you destroy the variable, it destroys the thing the pointer is pointing to, if you null the variable it destroys the pointers.
Destroy before null!
__________________
Big plans...
The)TideHunter( is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 04:24 PM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services