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-18-2010, 08:58 PM   #1
galinth
User
 
galinth's Avatar
 
Join Date: Aug 2010
Posts: 15

galinth has little to show at this moment (0)

Question Capture + Hold region for # sec?

I am trying to make a trigger that... when you have a unit enter a region, and stay within that region for "#" seconds (countdown timer), "A" actions occur when timer expires. If that unit leaves the region, the countdown timer is reset / wiped.

I am making a "neutral building" in the middle of the map that is capturable by 2 players against each other. I am mostly confused about the "timer only ticks when unit STAYS in the region" part. Can someone please show me a simple setup (GUI)? Please help!
galinth is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 08-18-2010, 10:51 PM   #2
DioD
obey
 
DioD's Avatar
 
Join Date: Feb 2006
Posts: 1,532

Submissions (4)

DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)DioD is a jewel in the rough (220)

Send a message via ICQ to DioD
Default

post your own code (did you try it self?)
DioD is offline   Reply With Quote
Old 08-20-2010, 12:21 AM   #3
galinth
User
 
galinth's Avatar
 
Join Date: Aug 2010
Posts: 15

galinth has little to show at this moment (0)

Default

right now i am using 2 triggers to attempt to do it, but i can't find out how to.. stop+reset timer if the unit capturing leaves the region.


* Here is trigger #1 with the timer*

Trigger:
Capture Ground
Collapse Events
Unit - A unit enters Capture Spot <gen>
Collapse Conditions
(Owner of (Triggering unit)) Equal to Player 1 (Red)
Collapse Actions
Collapse Player Group - Pick every player in Player Group - Player 1 (Red) and do (Actions)
Collapse Loop - Actions
Countdown Timer - Start CAPtimer as a One-shot timer that will expire in 10.00 seconds
Countdown Timer - Create a timer window for CAPtimer with title "Capturing"
Trigger - Turn off (This trigger)


* Here is trigger #2 with results*

Trigger:
Capture Spawn
Collapse Events
Time - CAPtimer expires
Conditions
Collapse Actions
Collapse Player Group - Pick every player in Player Group - Player 1 (Red) and do (Actions)
Collapse Loop - Actions
Countdown Timer - Destroy (Last created timer window)
Unit - Create 1 Watch Tower for Player 1 (Red) at (Center of Tower Spawn <gen>) facing Default building facing degrees

Last edited by galinth : 08-20-2010 at 12:34 AM.
galinth is offline   Reply With Quote
Old 08-20-2010, 02:53 PM   #4
0zyx0
Perfectionist noob
 
0zyx0's Avatar
 
Join Date: Mar 2009
Posts: 255

0zyx0 will become famous soon enough (38)0zyx0 will become famous soon enough (38)

Default

There's an event that fires when a unit leaves a region. Make a trigger that is fired by that, and pause CAPtimer when that happens. Don't bother destroying it. It works fine to just start the timer again from a paused state (it will be just as if you've never used the timer before).
__________________
My new signature - Now easier to understand than ever!

Last edited by 0zyx0 : 08-20-2010 at 02:54 PM.
0zyx0 is offline   Reply With Quote
Old 08-20-2010, 10:16 PM   #5
galinth
User
 
galinth's Avatar
 
Join Date: Aug 2010
Posts: 15

galinth has little to show at this moment (0)

Default

Quote:
Originally Posted by 0zyx0
There's an event that fires when a unit leaves a region. Make a trigger that is fired by that, and pause CAPtimer when that happens. Don't bother destroying it. It works fine to just start the timer again from a paused state (it will be just as if you've never used the timer before).


oooooh ok, yeah i saw pause, but i didn't know that it works as a reset also, ill try it out now. ty
galinth is offline   Reply With Quote
Old 08-20-2010, 10:56 PM   #6
galinth
User
 
galinth's Avatar
 
Join Date: Aug 2010
Posts: 15

galinth has little to show at this moment (0)

Default

Cool this basic trigger did the trick, thanks again for the help! (figured id post it just in case for other nubs like myself)

Trigger:
Timer Wipe
Collapse Events
Unit - A unit leaves Capture Spot <gen>
Collapse Conditions
(Owner of (Triggering unit)) Equal to Player 1 (Red)
Collapse Actions
Countdown Timer - Pause CAPtimer
Countdown Timer - Destroy (Last created timer window)
galinth is offline   Reply With Quote
Old 08-21-2010, 01:13 AM   #7
Anitarf
Procrastination Incarnate


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

Submissions (19)

Anitarf has a brilliant future (888)Anitarf has a brilliant future (888)Anitarf has a brilliant future (888)Anitarf has a brilliant future (888)Anitarf has a brilliant future (888)Anitarf has a brilliant future (888)Anitarf has a brilliant future (888)Anitarf has a brilliant future (888)

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

Default

It won't work correctly if a player can control multiple units. In that case, you would need a unit group to keep track of all the units in the region and only pause the timer once the last of them leaves.

You'd probably also want to keep track of capturing units dying and remove them from the group in those cases as well.

Furthermore, a unit from the other team entering the arena should also pause the timer.
__________________
Anitarf is offline   Reply With Quote
Old 08-22-2010, 08:57 PM   #8
galinth
User
 
galinth's Avatar
 
Join Date: Aug 2010
Posts: 15

galinth has little to show at this moment (0)

Default

Quote:
Originally Posted by Anitarf
It won't work correctly if a player can control multiple units. In that case, you would need a unit group to keep track of all the units in the region and only pause the timer once the last of them leaves.

You'd probably also want to keep track of capturing units dying and remove them from the group in those cases as well.

Furthermore, a unit from the other team entering the arena should also pause the timer.


Ah I see what you are saying, actually I made the region smallest possible (literally only 1 unit can fit on it) and the 2 teams vying for it have no air units. I set up a sequence of switches that turn on / off triggers for each side, with their own timers, depending on who occupies the captured area
galinth 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 12:19 AM.


Donate

Affiliates
The Hubb http://bylur.com - Warcraft, StarCraft, Diablo and DotA Blog & Forums The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

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