HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Help with trigger for generating gold per unit

01-11-2004, 11:22 PM#1
Huh
Ok I am pretty much a noob to anything map related ( i just started yesterday ) but I am still trying to teach myself triggering. I have checked lots of unprotected maps for help designing this type of trigger but so far no luck.

BASICALLY, I am making a mod similar to tag maps, or hunters vs farmers if you've played it. What I need is a trigger to automatically generate a unit every so often (30 seconds or so) from another unit (or in this case structure). THEN I want to have it allocate set amount of gold to the owner of the unit over a set amount of time, based on the amount of the unit thats been produced from the initial unit.

OK sorry that sounds confusing. Lets say a worker builds a farm. The farm produces a penguin (sorry i love penguins) every 30 seconds. Every 30 seconds, the owner of the farm gains 30 gold for every penguin on the map. Got it? Ok any help will be greatly appreciated.

-Huh

PS- will it tell me when i log in here if i have gotten replies? I am new to this site and i can tell the posts here flow faster than booze at a wedding.
01-12-2004, 12:19 AM#2
AllPainful
Trigger:

Code:
Event
  Every 30 seconds
Conditions
Actions
  Pick every unit in playable map area
    Loop Actions
      If
        Picked unit equal to farm
      Then
        Create a penguin for owner of (picked unit) at location of picked unit
      Else
         Do nothing
  Pick every unit in playable map area
     Loop Actions
       If
         Picked unit equal to Penguin
       Then
         Add 30 gold to player (owner of (picked unit))
       Else
         Do Nothing

As for the other Question. No, the site will not let you know when you log in, but if you chose "E-mail Notification" in your user options then you will recieve an e-mail telling you someone replied.


PS. I knew what you were talking about because I have played "Hunters Vs Farmers", fun map.
01-12-2004, 12:23 AM#3
zotax
EDIT: Posted just after
01-12-2004, 12:35 AM#4
Huh
Awesome thanks. Ya hunters vs farmers is really cool but there were several things that I really thought should be changed, added in, redone, etc. Only problem is I had never even laid eyes on the map editor. Sooo im taking some time to try and teach myself how to do these things. Anyhow thank for the help. ALSO, maybe you can help me with a couple other trigger related things.

I'm trying to make a simple trigger that basically says "if specific unit owned by a certain player (in this came the "farmer") is killed, than 1) all his structures/units die and 2) he respawns in a "random" location.

This would be so much easier if HvF wasnt protected, than i could just scope out his triggers and learn how they work :(. Thanks in advance.

-Huh

PS- do you recommend any third party map editing programs for what im trying to do? At the moment im really just using the TFT world editor.

Also i noticed certain maps have triggers that appear as pure script, how were these made and is it advantageous to do so?
01-12-2004, 12:39 AM#5
AllPainful
Make a "Region" array, and make all the different "Start" posisions as regions, then store them in the array, if you need more help with that, just let me know.

Trigger:

Code:
Event
  A unit dies
Condition
  Killed unit is of type "Farmer"
Action
  Pick all units owened by player (owner of(killed unit))
     Loop Action
        Kill picked unit
  Create 1 "Farmer" for owner of(killed unit) at random point in region start[random number from 1 to 5]

As for your other question: I use WEUlimited (by PitzerMike) but I think you should stick to the regular TFT editor, as WEU is not updated for the new patch yet and as you are new to the editor I suggest sticking with it as WEU has Advanced fuctions.

As for the "Custom Scripts" that is JASS programming language, yes it does have some advantages, but you can't really USE it unless you know how to program in JASS. to make a trigger custom text you just choose "Convert to custom text" in the Edit menu.

1 advantage of custom text is that if you convert your triggers to custom text only a person who KNOWS JASS can read them, so its a way to protect your triggers from being stolen.
01-12-2004, 12:52 AM#6
Huh
Wow timely response, thanks again! Honestly, I'm still so new at this that all the help in the world would be appreciated lol. I had little math background and almost no programming knowledge so this "triggering" is driving me crazy.
To answer your question, yes i could use help making an array of region spawn points because I have no clue where to begin doing so =/.

-Huh

Oh ya one more key question. How do you loop actions in the TFT WE?
I made a trigger almost exactly like the first one you gave me but i cant find the loop trigger. Thanks.
01-12-2004, 12:53 AM#7
AllPainful
Ok.
  1. Goto the Variables window
  2. New variable
  3. Name it Start
  4. In the dropdown menu choose "Regions"
  5. Check the box that says "Array"
  6. hit ok
Ok, now you got your variable.

Make how ever many regions on your map on where you want the player to posibly start (the smaller the better, and make sure these regions dont have any cliffs or anything Unwalkable in them, that could cause a problem if the unit tries to be spawned inside something unwalkable.). And name them Start1, Start2, Start3... ect, ect...

In your map init trigger put the following in the actions:

Code:
Set Variable Start[1] = Start1<gen>
Set Variable Start[2] = Start2<gen>
Set Variable Start[3] = Start3<gen>
...... ect, ect

There you go, you just created a region array and filled it with regions. :D
01-12-2004, 12:58 AM#8
Huh
Awesome you're such a big help! Oh ya, about the looping. How do I loop actions? According to the code you gave me I need to loop the actions, im guessing so they go on and on until the game ends. I looked but didnt see looping in the WE. Thanks

-Huh
01-12-2004, 01:01 AM#9
AllPainful
They are not on until the game ends, In a "Pick all units" loop the loop is finished after it picked each and every unit in the map one time.

To make a loop you just find something that loops.

To make the loop in the trigger above choose the "Unit Group - Pick all units and do multiple actions" thing in the trigger editor.

Another loop would be a "Pick All Players" loop.
01-12-2004, 01:09 AM#10
Huh
Ahhh ok gotcha. I was wondering about that hehe. Ok well thats it for now. Im almost positive ill be back later with more questions so keep an eye on the forum plz, youre the best!
Time to get to work on the map, the help you've given will make alot of this go much smoother.

-Huh