HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

A very big Trigger problem.

07-11-2002, 01:22 PM#1
Guest
First of all, hi, I'm the Seer, I pwnz0rz j00.

Now for my l33t problem. 8D

My goal in these few triggers is to make it so that for every barracks a player owns, the faster and shorter amount of time Footmen will spawn in a certain region. I have already made it so the variable, (Which starts out as 300, which will later be converted into seconds) times itself by .90 for every barracks created, and it divides itself by .90 for every barracks destroyed. I may tweak later, but that doesn't really matter.

Now I need a trigger that converts that variable into seconds, and when all the seconds elapse, a footman spawns. I want it so it changes when a barracks is created or destroyed, preferably after the current footman spawning thing has already occured, but that doesn't matter too much.

I have already tried to use the Event < "Periodic Event", and you can't change the number into a variable. I'm stuck.
07-11-2002, 01:32 PM#2
Guest
Just in case you want to see what I have so far, here they are. (These are currently untested because I need the other trigger to work first.)
  • Triggers - Triggers
  • Reinforcements - Category
  • Human Barracks Built - Trigger 1
    Events
    Unit - A unit owned by Player 4 (Purple) Finishes construction
    Conditions
    (Unit-type of (Constructing structure)) Equal to Barracks
    (Number of units in (Units owned by Player 4 (Purple) of type Barracks)) Less than 15
    Actions
    Set Human_Barracks = (Human_Barracks x 0.90)
  • Human Barracks Destroyed - Trigger 2
    Events
    Unit - A unit owned by Player 4 (Purple) Dies
    Conditions
    (Unit-type of (Dying unit)) Equal to Barracks
    Actions
    Set Human_Barracks = (Human_Barracks / 0.90)

Since the player starts with 3 barracks, the inital value of "Human_Barracks" equals 243.

EDIT - Added a condition to the "Human Barracks Built" trigger so there's a limit to the amount of barracks you can have to affect the trigger.
07-11-2002, 02:20 PM#3
Guest
Alright, I found a hard way of doing it, by making a bunch of triggers for every possible variable outcome, almost making the whole variable math system obsolete, but this is just a temporary fix, and this by no means should tell you all to stop trying to help me. 8D
07-12-2002, 01:10 AM#4
Guest
Not to be a pest, but I think I'll just swarm every little trigger problem I have in this thread until someone decides to solve it all! 8D

I have about three problems, I'll start with the longest, which isn't really a problem as much as it is a very long detour of a way to do something. At least I think so. I hope so. I'll just show you what I got, and you guys tell me if there's a shorter way.

---- Problem 1 ----
  • Triggers - Triggers
  • Squads - Category
  • Follow 1 - Trigger 1
    Events
    Player - Player 1 (Red) Selects a unit
    Conditions
    (Owner of (Triggering unit)) Equal to Player 4 (Purple)
    (Unit-type of (Triggering unit)) Equal to Footman
    Actions
    Set Human_Player1_Squad_Real1 = 1.00
  • Follow 2 - Trigger 2
    Events
    Player - Player 1 (Red) types a chat message containing FOLLOW as An exact match
    Conditions
    Actions
    Set Human_Player1_Squad_Real2 = 1.00
    Wait 2.00 seconds
    Set Human_Player1_Squad_Real2 = 0.00
  • Follow 3 - Trigger 3
    Events
    Time - Every 1.00 seconds of game time
    Conditions
    Human_Player1_Squad_Real1 = 1.00
    Human_Player1_Squad_Real2 = 1.00
    Actions
    Unit Group - Add (Triggering unit) to Human_Player1_Squad_Follow
  • Follow 4 - Trigger 4
    Events
    Time - Every 4.00 seconds of game time
    Conditions
    Actions
    Unit Group - Pick every unit in Human_Player1_Squad_Follow and do (Unit - Order (Picked unit) to Attack-Move To (Position of (Random unit from Human_Player1_SquadLeader)))

    ---- Problem 2 ----

    In the above trigger, it works fine, except that after the unit attacks-moves to the unit you control, he tries to go back to where he was originally going, even though he just attacks-moves to the character again. Mostly just an annoying thing, but sometimes it does generate problems.

    ---- Problem 3 ----

    Unit Group arrays refuse to work... I mean, I can't tell if they work, but if I add the above trigger unit to a Unit Group with an array, they... they just don't listen to it. Why the bloody hell not?

    Now help me with my stupid problems.
07-12-2002, 03:15 AM#5
Guest
Quote:
I have already tried to use the Event < "Periodic Event", and you can't change the number into a variable. I'm stuck.

Timers use variables of type REAL. Make your time value using convert integer to real.

For some reason this doesn't work with a periodic event (perhaps because it's supposed to be constant), so start a timer and use a timer expires event.

Problem 1
Not sure why you're using Reals for off and on when you could be using Boolean.

Probably better to put Set Human_Player1_Squad_Real2 = 0.00 as an action in the "Follow 3" trigger to do away with the wait and any timing issues that could ocure.

Why not just use Unit Group - Order [Group] to attack-move to [position] instead of picking them first?

Problem 2 - Don't know
Problem 3 - http://forums.battle.net/war3-maps/posts/sd/1448.shtml
07-12-2002, 03:22 AM#6
Guest
You made some very good points with the timer, I should have thought of that, duh... thanks.

And for Problem 1, I use Reals just in case I want to have the variable to have more than just one possible use. It's really just in case, y'know... just in case. Does the same thing. Also, setting it to equal 0.00 wouldn't work because that's the inital value, and if I changed the inital value to 1 and reversed the other trigger, then it would have the same exact effect anyway?

And I never knew Unit Group - Order Group existed. Weird.
07-12-2002, 04:21 AM#7
Guest
Quote:
Also, setting it to equal 0.00 wouldn't work because that's the inital value, and if I changed the inital value to 1 and reversed the other trigger, then it would have the same exact effect anyway?

So it looks like this....

Follow 2 - Trigger 2
Events
Player - Player 1 (Red) types a chat message containing FOLLOW as An exact match
Conditions
Actions
Set Human_Player1_Squad_Real2 = 1.00

Follow 3 - Trigger 3
Events
Time - Every 1.00 seconds of game time
Conditions
Human_Player1_Squad_Real1 = 1.00
Human_Player1_Squad_Real2 = 1.00
Actions
Unit Group - Add (Triggering unit) to Human_Player1_Squad_Follow
Set Human_Player1_Squad_Real2 = 0.00

It does the exact same thing, but in your previous example you are setting Human_Player1_Squad_Real2 = 1.00 then waiting 2 seconds so that Trigger 3 will pick up the change,do it's action, and then Trigger 2 changes it back to 0.00. This way you eliminate the wait and any timing peculiarities that could possibly occur (and if you've ever done an action that you needed to add in a wait of .01 seconds to get it to work, you know they happen).
07-12-2002, 04:43 AM#8
Guest
Oh yeah, you're right, thanks. I knew something was peculiar when I made that, but I'm all for perfecting. Of course it's still just one of a lot of small problems part of a larger problem. *cry*
07-13-2002, 05:10 AM#9
dataangel
Also, although this doesn't have to do with your original post you should keep it in mind: Diminishing returns. You need to set a cap on when barracks stop giving a time bonus, cuz if they make 300 barracks, a footman is going to spawn more than every 0.1 seconds :p

That will lead you straight into lag hell.
07-13-2002, 01:49 PM#10
littlecramp
Is the Golden Urg the same person who make the Chess map in starcraft?