| 12-14-2003, 04:24 AM | #1 |
If anyone could help me, it'd be a big help. I want to know if there is a way to make something happen after someone has gotten so many kills (let's say a thousand). I looked and couldn't find anything, but maybe there is a way that's just buried down deep in some event. Anyways, if anyone could help me, please do. I'd be thankful (not that anyone'd probably care though :( ) |
| 12-14-2003, 01:22 PM | #2 |
First things first, next time I suggest you post in another forum, as this one isn't designed for question and answer, but rather a place to post your finished triggers/ideas/etc to help others. That said, I'll reply because, technically, it will be helping someone (you, I hope) at any rate. There's a number of ways to do what you're asking, but the following is assuming you are using an unknown number of human players and a constantly changing number of Heroes for said players. If you know the number of players (say it's a limited RPG) or heroes (again, your choice) this is going to be overly complex, but you should be able to dilute it down enough fairly easily to match any needs. This uses three main triggers, which I'll try to comment and explain as best I can. The format I put will be how it should look in your trigger editor. Please note: My variable names have what may seem an odd format, so I'll explain so you understand what you're looking at. The beginning is simply 'var_' so I know by quickly looking through my code that it's a Variable. After the underscore, is the type of Variable it is, generally a simple thing like 'int' for integer or 'unit' or 'str.' Then of course the description/name, and finally, in many cases a suffix letter to indicate who this specific variable applies to (P for Player, H for Hero, U for Unit, etc.) 1. Name: trigKill Count Loop --- Comment: This trigger is the brunt of the counting process. It takes notice anytime a unit dies, then determined if the unit that killed that unit is equal to a hero owned by a human player. If so, it determines the total number of human players in the game, and runs a loop for each player (so four times if four human players). The loop has a sub-loop, run once for each hero (var_intHeroCountP represents the total heroes) owned by the chosen player in the first loop. Loop B goes through the list of currently existing heroes (var_unitHeroListH is an array that holds all the unit values of every player controlled hero, and is altered in a later trigger should a hero die or be added.) and finds the Hero who got the kill, and increases that Units kill count by one, as well as the Player who owns that Hero's kill count (in case are asking for a Player kill total rather than unit, wasn't sure.) --- Code:
Events:
Unit - A unit Dies
Conditions:
(((Killing unit) is A Hero) Equal to True) AND (((Owner of (Killing unit)) is in (All players controlled by a User player)) Equal to True)
Actions:
For each (Integer A) from 1 to (Number of players in (All players controlled by a User player)), do (Actions)
Loop - Actions:
For each (Integer B) from 1 to var_intHeroCountP[(Integer A)], do (Actions)
Loop - Actions:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions:
(Killing unit) Equal to var_unitHeroListH[(Integer B)]
Then - Actions:
Set var_intKillCountP[(Integer A)] = (var_intKillCountP[(Integer A)] + 1)
Set var_intKillCountH[(Integer B)] = (var_intKillCountH[(Integer B)] + 1)
Else - Actions:
Do nothing
--- END IF ---
--- END LOOP FOR INTEGER B ---
---END LOOP FOR INTEGER A ---2. Name: trigKill Count Variable Declaration --- COMMENT: The below two variable declarations for var_unitHeroListH[1] and [2] are examples, the names are just for show, but they would NEED to be replaced with all, if any, hero units your map would start players off with. I.E. If your map starts players with 1 hero each, and you plan for up to 6 players, you'll need to declare all 6 of those in that variable) This trigger simply declares all variables as needed, and then sets the correct Hero count (var_intHeroCountP) for every existing human player. NOTE: This trigger is assuming all human players start out with the same number of Heroes; if the number varies between different human players, you will need to manually set the count and remove "set var_intstartingHeroCountAll" NOTE: var_intTotalHeroCountAll, simply keeps track of the total heroes in existence on the map (created, not necessarily if they're dead and unrevived, since that situation they won't get any kills) --- Code:
Events:
Map initialization
Conditions:
--- None ---
Actions:
set var_intStartingHeroCountAll = 1
set var_intTotalHeroCountAll = (var_intStartingHeroCountAll x (Number of players in (All players controlled by a User player)))
set var_unitHeroListH[1] = Galiah D'Well 0001 <gen>
set var_unitHeroListH[2] = Tobiath D'Well 0002 <gen>
For each (Integer A) from 1 to (Number of players in (All players controlled by a User player)), do (Actions)
Loop - Actions:
Set var_intHeroCountP[(Integer A)] = (var_intHeroCountP[(Integer A)] + var_intStartingHeroCountAll)
--- END LOOP FOR INTEGER A ---3. Name: trigKill Count Loop --- Comment: This trigger simply reduces the count of total heroes owned by the given player (the player who's hero died) by one each time a Hero owned by a Human player dies. --- Code:
Events:
Unit - A unit Dies
Conditions:
(((Dying unit) is A Hero) Equal to True) AND (((Owner of (Dying unit)) is in (All players controlled by a User player)) Equal to True)
--- Comment: This determines that the dying unit is a Hero owned by someone played by an actual Human. ---
--- Please note this is an "AND" condition. ---
Actions:
Set var_intHeroCountP[(Player number of (Owner of (Dying unit)))] = (var_intHeroCountP[(Player number of (Owner of (Dying unit)))] - 1)
--- Comment: The var_intHeroCountP is an integer array, with the number of fields set to 10 ---
--- (or whatever number you know is high enough to always accomate the maximum number of human players) ---4. Name: trigNew Hero --- This trigger determines if a new Human owned Hero is created (enters the map) and increases the total Hero count as necessary, and then adds the created hero to the next slot of the HeroList array, in conjunction with getting the kill count variables to work for said hero. --- Code:
Events:
Unit - A unit enters (Entire map)
Conditions:
(((Entering unit) is A Hero) Equal to True) AND (((Owner of (Entering unit)) is in (All players controlled by a User player)) Equal to True)
--- Comment: This determines that the entering unit is a Hero owned by someone played by an actual Human. ---
--- Please note this is an "AND" condition. ---
Actions:
Set var_intHeroCountP[(Player number of (Owner of (Entering unit)))] = (var_intHeroCountP[(Player number of (Owner of (Entering unit)))] + 1)
Set var_unitHeroListH[(var_intTotalHeroCountAll + 1)] = (Entering unit)That's it, that should accomodate most any situation, but if you need any additional help or advice, please feel free to e-mail me and I'll do what I can. -GabeStah- [email protected]- |
| 12-14-2003, 02:42 PM | #3 |
This has been moved out trigger reposatroy since it is an Un wanted post there it was not a Tut on any thing do this again ForsakenSoldier and an the thread my be subject to thread deletion have a good day. |
