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 04-24-2006, 07:54 PM   #1
Taco
User
 
Taco's Avatar
 
Join Date: Apr 2006
Posts: 4

Taco has a little shameless behaviour in the past (-4)

Question King of the Hill

I am trying to make a "King of the Hill" type map where there are eight players that are trying to control and hold the center of the map. I am having trouble implementing the trigger(s) to control the center:

I am trying to make it so that if there are no units in the "Center" region of the map and a unit or units enters the region for 5 secnds then control of the center goes to the owner of the entering unit/units.

I currently have these two triggers but I cannot find a condition where it counts the number of units in a certain region owned by the enemy of the entering unit. I also cannot figure out a way to count down 5 seconds before the user gains control of the center.

Can someone help me out with this?


Thank you for taking the time to read my post
__________________
Taco is offline   Reply With Quote
Sponsored Links - Login to hide this ad!
Old 04-25-2006, 05:49 PM   #2
MasterofSickness
User
 
MasterofSickness's Avatar
 
Join Date: Feb 2006
Posts: 218

MasterofSickness is on a distinguished road (23)

Default

Hi!
It finally took a few hours, but I figured out a nice system that should work.
I know that it isn't perfect (-> minor mistakes, not written in JASS and tiny Memory Leaks not excluded), but if you need further help, then just ask.
For this trigger you need one variable, which I called "Integer_PlayerNumber".
Its value should be a normal integer (no array) and for starting value I propose 16.
For the Region I have chosen "RegionAtMapCentre".
And for whatever buildings you want to use, you have to add them where "BuildingsAtCentre" is written.

Attention!
The following Code was written with a german WE, so a few parts may look different, but you should still be able to understand and rewrite it:

GUI:
Trigger:
UnitEntersRegion
Collapse Ereignisse
Einheit - A unit enters RegionAtMapCentre <gen>
Bedingungen
Collapse Aktionen
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse 'IF'-Bedingungen
(Owner of (Entering unit)) Gleich (Player(Integer_PlayerNumber))
'THEN'-Aktionen
Collapse 'ELSE'-Aktionen
Set Integer_PlayerNumber = (Player number of (Owner of (Entering unit)))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse 'IF'-Bedingungen
(Number of units in (Units in RegionAtMapCentre <gen> matching (((Matching unit) Ungleich (Entering unit)) and (((Unit-type of (Matching unit)) Ungleich BuildingsAtCentre) and ((Owner of (Matching unit)) Ungleich (Player(Integer_PlayerNumber))))))) Gleich 0
Collapse 'THEN'-Aktionen
Spiel - Display to (All players) the text: ((Name of (Player(Integer_PlayerNumber))) + tries to get control of centre!)
Wait 5.00 game-time seconds
Spiel - Display to (All players) the text: 5 sec until change!
Wait 3.00 game-time seconds
Spiel - Display to (All players) the text: Now 2 sec!
Wait 2.00 game-time seconds
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse 'IF'-Bedingungen
(Number of units in (Units in RegionAtMapCentre <gen> matching (((Unit-type of (Matching unit)) Ungleich BuildingsAtCentre) and ((Owner of (Matching unit)) Ungleich (Player(Integer_PlayerNumber)))))) Gleich 0
Collapse 'THEN'-Aktionen
Spiel - Display to (All players) the text: (Centre controlled by + (Name of (Player(Integer_PlayerNumber))))
Collapse Einheitengruppe - Pick every unit in (Units in RegionAtMapCentre <gen> matching ((Unit-type of (Matching unit)) Gleich BuildingsAtCentre)) and do (Actions)
Collapse Schleifen - Aktionen
Einheit - Change ownership of (Picked unit) to (Player(Integer_PlayerNumber)) and Farbe wechseln
Collapse 'ELSE'-Aktionen
Spiel - Display to (All players) the text: RegionAtMapCentre's...
Collapse 'ELSE'-Aktionen
Spiel - Display to (All players) the text: ((Name of (Player(Integer_PlayerNumber))) + joined fighting for the centre!)
__________________
my nicknames:
20002006200720102012
Master of SicknessDesignatusKakarotEdwardElricSourceSeeker

Last edited by MasterofSickness : 04-25-2006 at 05:52 PM.
MasterofSickness is offline   Reply With Quote
Old 04-26-2006, 01:36 AM   #3
Exilus
User
 
Exilus's Avatar
 
Join Date: Feb 2006
Posts: 236

Exilus has little to show at this moment (6)

Default

traduction:

Trigger:
UnitEntersRegion
Collapse events:
Unit- A unit enters RegionAtMapCentre <gen>
conditions:
Collapse actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Owner of (Entering unit)) equal to (Player(Integer_PlayerNumber))
Then - Actions
Collapse Else - Action
Set Integer_PlayerNumber = (Player number of (Owner of (Entering unit)))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Number of units in (Units in RegionAtMapCentre <gen> matching (((Matching unit) not equal to (Entering unit)) and (((Unit-type of (Matching unit)) not equal to BuildingsAtCentre) and ((Owner of (Matching unit)) not equal to (Player(Integer_PlayerNumber))))))) equal to 0
Collapse Then - Actions
Game - Display to (All players) the text: ((Name of (Player(Integer_PlayerNumber))) + tries to get control of centre!)
Wait 5.00 game-time seconds
Game - Display to (All players) the text: 5 sec until change!
Wait 3.00 game-time seconds
Game - Display to (All players) the text: Now 2 sec!
Wait 2.00 game-time seconds
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Number of units in (Units in RegionAtMapCentre <gen> matching (((Unit-type of (Matching unit)) Not equal to BuildingsAtCentre) and ((Owner of (Matching unit)) Not equal to (Player(Integer_PlayerNumber)))))) equal 0
Collapse Then - Actions
Game - Display to (All players) the text: (Centre controlled by + (Name of (Player(Integer_PlayerNumber))))
Collapse Unit Group - Pick every unit in (Units in RegionAtMapCentre <gen> matching ((Unit-type of (Matching unit)) Equal BuildingsAtCentre)) and do (Actions)
Collapse Loop - actions
Unit - Change ownership of (Picked unit) to (Player(Integer_PlayerNumber)) and Change Color
Collapse Else - Actions
Game - Display to (All players) the text: RegionAtMapCentre's...
Collapse Else - Actions
Game - Display to (All players) the text: ((Name of (Player(Integer_PlayerNumber))) + joined fighting for the centre!)

Last edited by Exilus : 04-26-2006 at 01:44 AM.
Exilus 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:14 AM.


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