• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

Chaos Footmen Triggers [Please Help]

Status
Not open for further replies.
Level 1
Joined
May 23, 2004
Messages
4
If anyone is able to find the time to show what a footmen frenzy spawn trigger looks like? Maybe a screenshot or a script or something and how to change it to fit the tier to change unit and spawntimes and all that.

I know it involes arrays and variables and it confuses the heck out of me.

I also would like to know how to have a random hero system.

If you can tell me how to do this, I will be SO grateful and even feature your name in my map as a hero or an item, whatever you want :p

Thanks,

~Dray~
 
Level 2
Joined
Dec 8, 2005
Messages
8
Ok, iam creating an footman wars map at this moment, and there are TONS of ways you can do this. I chose this way, and even though there might be a much better way it works great:


First i have only 1 trigger for each player in the game to spawn a unit:

Code:
Spawn Player 1
    Events
        Time - player_spawn_timer[1] expires
    Conditions
    Actions
                Unit - Create 1 player_main_spawn[1] for Player 1 (Red) at player_main_location[1] facing Default building facing (270.0) degrees

This trigger is actually quite simple, basicly this is what it does:

1. The trigger is run when a timer has reached his maximum value.
2. Then create a unit, which is saved in the variable player_main_spawn[1] (the one is because it is an array and the trigger is for player 1 (red)).

At the map initialization is have this part to set the player_main_spawn[]

Code:
Set player_main_spawn[1] = Militia (Tier 0)

The militia is the first unit in my maps. The reason i use an variable is because its very easy to create an unit and change what unit to spawn.

Code:
Set player_spawn_times[1] = 4.10
Set player_spawn_times[2] = 4.25
Set player_spawn_times[3] = 4.80
Set player_spawn_times[4] = 5.10
Set player_spawn_times[5] = 5.35

Here i set the variable for when each unit should spawn. As you can see i use 5 different timers for each "tier" of units. Each upgrade takes longer to spawn because they are more powerfull. I use an variable and not "hardcoded" times because this makes it very easy to change the times for balancing.


Code:
initialise trigger
    Events
        Time - Elapsed game time is 5.00 seconds
    Conditions
    Actions
        Set all_playing_players = (All players matching ((((Matching player) slot status)  ==  Is playing) and (((Matching player) controller)  ==  User)))
        Player Group - Pick every player in all_playing_players and do (Actions)
            Loop - Actions
                Countdown Timer - Start player_spawn_timer[(Player number of (Picked player))] as a Repeating timer that will expire in player_spawn_times[1] seconds

This trigger which is run 5 seconds after the map starts runs a countdown timer for every players that is an user and is in the game. The timer starts for each player at the first variable.

But now we need an trigger to update the spawn trigger when we create an new building, and hence my upgrade trigger:
Code:
Upgrade Finished
    Events
        Unit - A unit Finishes an upgrade
    Conditions
    Actions
        Set player_main_building[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
        Game - Display to (All players) the text: (((player_color[(Player number of (Owner of (Triggering unit)))] +  just upgraded to: ) + (Name of (Triggering unit))) + <Empty String>)
        -------- Human Upgrades --------
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of player_main_building[(Player number of (Owner of (Triggering unit)))])  ==  Human Main - Tier 1 (Tier 1 Human)
            Then - Actions
                Set player_main_spawn[(Player number of (Owner of (Triggering unit)))] = Footman (Human Tier 1)
                Countdown Timer - Start player_spawn_timer[(Player number of (Owner of (Triggering unit)))] as a Repeating timer that will expire in player_spawn_times[2] seconds
            Else - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Unit-type of player_main_building[(Player number of (Owner of (Triggering unit)))])  ==  Human Main - Tier 2 (Tier 2 Human)
            Then - Actions
                Set player_main_spawn[(Player number of (Owner of (Triggering unit)))] = Sorceress (Human Tier 2)
                Countdown Timer - Start player_spawn_timer[(Player number of (Owner of (Triggering unit)))] as a Repeating timer that will expire in player_spawn_times[3] seconds
            Else - Actions

I only added the first 2 tiers for the human upgrades because this trigger is quite long.

First the trigger is run when an unit finishes an upgrade. I use the system most footman wars maps use, an townhall which upgrades into his next upgrade. (and that 4 times)

I set an variable which is used for each player (kinda like a local variable, but dont use this too much because it can be overwritten if the trigger is run again) that contains the unit that is upgrading.

If the unit that is upgrading is equal to Human tier 1 townhall i know the player started an upgrade to Human tier 1 and i change the player_unit_spawn variable to a footman. Then i also change the spawn time to the second spawn time.

then i rerun the timer so it has a new time:
Code:
Countdown Timer - Start player_spawn_timer[(Player number of (Owner of (Triggering unit)))] as a Repeating timer that will expire in player_spawn_times[2] seconds

And this is my "basic" footman wars spawn system :)
If you want i can send you my version i have at the moment so you can check out the triggers and all, but since iam still in beta phases (need to finish nightelves) i dont want to post it.

Lemme know if this is helpfull :)
 
Level 1
Joined
May 23, 2004
Messages
4
Wiebbe said:
all variables have to be an array of 12 (or how many players are possible)

Take a peek at my map, i uploaded it here, its called: Footman wars Clone 0.9b so you can see how i did it.

And with that, you have helped me so so so so so much in understanding this... that means players and is limited in value, I understand now! You have just cleared the fog!
 
Status
Not open for further replies.
Top