• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Trigers for RPG map without buildings

Status
Not open for further replies.
Level 6
Joined
May 21, 2013
Messages
149
How to make on my map when i start only with units without buildings ,don`t show me message "you are defeated" ???

simple i like trigers for :
if all units of player 1 died - player 1 loss
if all units of player 2 died - player 1 win :ogre_haosis:
 
Level 14
Joined
Dec 12, 2009
Messages
1,027
First, make sure you don't have "Melee Game - Enforce Victory/Defeat conditions" inside a map trigger - players without structures will be auto-defeated.

For the victory/defeat, you can run a cycling trigger that checks periodically for total number of units owned by a player and defeat them if they have zero units (problems with this method are slow cycle times = players can't do anything or see anything & fast cycle times can cause lag).

Another method would be to check for number of units owned by a player whenever a unit dies. This method is the preferred method currently (from what I hear).

In either case, use two variables: UnitGroupPlayer01 & UnitGroupPlayer02.

Event: A unit dies
Actions:
Set UnitGroupPlayer01 = Units Owned by Player 1 (Red)
Set UnitGroupPlayer02 = Units Owned by Player 2 (Blue)
If: (Integer Comparison)
Number of units in UnitGroup01 = 0
Then:
Defeat Player 1 (Red)
Victory Player 2 (Blue)
Else:
If: (Integer Comparison)
Number of units in UnitGroup01 = 0
Then:
Defeat Player 2 (Blue)
Victory Player 1 (Red)
Else:

Since the game ends in this trigger, I wouldn't worry about cleaning up the leaks (unit groups leak). If you use these unit groups in other triggers you'll need to clean up the leak by:
Custom script: call DestroyGroup (udg_Temp_Group)

//\\oo//\\
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
In Terrain Editor, upside where you find Scenario = Players Properties , click it.
A window pops up, check every Fixed Start Location thing
Change the tap of the window to 'Forces', and check 'Fixed Players settings'.

If no one of the above works, create an invisible invulnerable building for each player and put it in an unused place on the map.

Good luck
 
In Terrain Editor, upside where you find Scenario = Players Properties , click it.
A window pops up, check every Fixed Start Location thing
Change the tap of the window to 'Forces', and check 'Fixed Players settings'.

If no one of the above works, create an invisible invulnerable building for each player and put it in an unused place on the map.

Good luck

How does that even relate to the topic?

By the way should always clean leaks no matter what if you can because you fatal at like 1.85GB of ram when wc3 uses that much and since the RAM isn't reset until you restart wc3...
 
Level 6
Joined
May 21, 2013
Messages
149
Set UnitGroupPlayer01 = Units Owned by Player 1 (Red)
Set UnitGroupPlayer02 = Units Owned by Player 2 (Blue)
Where i make this variabiles = to player 1 and player 2 ???
 
Level 15
Joined
Oct 29, 2012
Messages
1,474
How does that even relate to the topic?

By the way should always clean leaks no matter what if you can because you fatal at like 1.85GB of ram when wc3 uses that much and since the RAM isn't reset until you restart wc3...


Well he doesn't want 'You are defeated' message to be shown directly after the game starts , that's what I understood from his first question :/ then he changed the whole question in his last 3 lines ._.
 
Level 14
Joined
Dec 12, 2009
Messages
1,027
Set UnitGroupPlayer01 = Units Owned by Player 1 (Red)
Set UnitGroupPlayer02 = Units Owned by Player 2 (Blue)
Where i make this variabiles = to player 1 and player 2 ???

Attached is the test map. Run through it (kill blues units, then reload and let yours die - all die fast) and let me know if this is what you had in mind. If it is, copy the triggers into your map. Note that they will only work for Red & Blue players as written.

//\\oo//\\
 

Attachments

  • TriggerTest.w3x
    17.1 KB · Views: 81
Level 6
Joined
May 21, 2013
Messages
149
Attached is the test map. Run through it (kill blues units, then reload and let yours die - all die fast) and let me know if this is what you had in mind. If it is, copy the triggers into your map. Note that they will only work for Red & Blue players as written.

//\\oo//\\

Yes work ,thanks ;)
Btw +reputation :goblin_good_job:
 
Level 14
Joined
Dec 12, 2009
Messages
1,027
It will run everytime a unit dies so the leak removal is still needed in that viewpoint.

This is true, I was thinking of something else for a different map - sorry about that...

I also double-checked the sample map and discovered that I forgot to destroy the unit groups... attached is the fixed map. BABA, add in the custom script for the triggers you copied (in the new testmap).

//\\==//\\
 

Attachments

  • TriggerTest.w3x
    17.2 KB · Views: 40
Status
Not open for further replies.
Top