Hey, I'm trying to make it on my map where when I drop an item *AKA a wheat plant* it contiously gives me 10 gold every 20 seconds. Also, how could I make this only work if the item was dropped in a certain region? Any ideas how how to get this to work?
10 posts The set of an imaginary childrens television show, behind the stage. joined
#2
eat that wheat!
ohh man, this is complex (either that or I'm a complete moron), but I like a challenge! I'm gonna make a map that does what your lookin' for, and you can see what I did. My idea is a little to long and booooring to write out, so I'll PM you when I'm done.
10 posts The set of an imaginary childrens television show, behind the stage. joined
#3
sooo tired
okay, I did it, and I will now e-mail you the map. The thing was, there is no trigger (that I know of) that allows you to count the number of items in a region, so in this demo, the wheat is a unit. When the wheat lady is within x units of a wheat unit, and you right-click on a wheat plant with her selected, the wheat unit is removed, and she gains 1 wheat item. When an item of the type wheat is dropped, it is removed and replaced with a unit wheat.
that, however, is only half the soultion. Every 20 seconds, the trigger "check and get" gives the player an amount of gold equal to the number of wheat units in the crop region multiplied by the amount of gold you want to give per plant per cycle.
the only problem, and one that I can't figure out, is that when a wheat plant item is dropped, 2 wheat plant units are created. (and no, it does not say to create 2). maybe if I looked at the problem when I wasn't dying of sleep deprivation.
anyone is welcome to ask and I'll send them the map (its really small) if they think they can fix the problem.[/b]
10 posts The set of an imaginary childrens television show, behind the stage. joined
#5
okay, there are 3 triggers, the first is what happens when the hero picks up the wheat, the second is what happens when the hero drops the wheat, and the third is what give the player gold every 20 second cycle depending on the amt. of wheat units in the crop area.
Pick it up
Events
Unit - A unit Is issued an order targeting an object
Conditions
(Unit-type of (Target unit of issued order)) Equal to Wheat
(Unit-type of (Ordered unit)) Equal to Wife Of The Guy On The Wheaties Box
(Issued order) Equal to (Order(smart))
((Region centered at (Position of (Target unit of issued order)) with size (300.00, 300.00)) contains (Ordered unit)) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
NUMBERWHEATS Less than 6
Then - Actions
Set NUMBERWHEATS = (NUMBERWHEATS + 1)
Special Effect - Create a special effect at (Position of (Target unit of issued order)) using Abilities\Spells\Human\Slow\SlowCaster.mdl
Unit - Remove (Target unit of issued order) from the game
Hero - Create Wheat and give it to (Ordered unit)
Else - Actions
drop it
Events
Unit - A unit Loses an item
Conditions
(Item-type of (Item being manipulated)) Equal to Wheat
Actions
Special Effect - Create a special effect at (Position of (Item being manipulated)) using Abilities\Spells\Human\Slow\SlowCaster.mdl
Item - Remove (Item being manipulated)
Unit - Create 1 Wheat for Neutral Passive at ((Position of (Hero manipulating item)) offset by 50.00 towards (Facing of (Hero manipulating item)) degrees) facing Default building facing degrees
Set NUMBERWHEATS = (NUMBERWHEATS - 1)
check and get
Events
Time - Every 2.00 seconds of game time
Conditions
Actions
Player - Add ((Number of units in (Units in Crop Area <gen> matching ((Unit-type of (Matching unit)) Equal to Wheat))) x 2) to Player 1 (Red) Current gold
You can count number of items by doing Item Group - Pick all Items in region and the Action, Set NumberOfItems=NumberOfItems+1. Well, the triggers needed for this to work should look something like this:
Note; The first trigger is obsolute if the map is single player, you could just use (Player 1 Red or whatever in the other trigger instead)
Event:
Unit Loses an item
Conditions:
Manipulated item equal to Wheat Plant
Item - Position of Manipulated Item is in Region [Your Region] <gen> equal to false [Or something simoular, not sure]
Actions:
Item - Set Custom Value of (Manipulated Item) to (Player number of (Owner of(Unit Manipulating Item))).
Event:
Every 20 seconds of game time
Actions:
Item Group - Pick every item in [Your Region] <gen> matching (((Picked Item) = Wheat Plant) and ((Picked Item) is Not owned[Or something simuolar, so wheat plants carried in a heroes/units inventory are not counted.]) and do (actions).
Actions:
Player - Add 10 gold to (Converted player number(Custom value of (Picked Item)) Current gold.
I wrote this without opening the editor. But I'm prettu sure it does what you want.
10 posts The set of an imaginary childrens television show, behind the stage. joined
#7
cool
thats a really cool way to do it! Looks like I took the hard way out.
Just so I am sure, when you have an action like "Pick all (Units/Items/Doodads etc...) ... and do multiple actions", it runs the actions within it once for each picked object?
Yes, if it doesn't pick a enourmous amount of units/items/destructables and loops more than 5000 times since that's the upper limit for loops. But I don't think it's even possible to create 5000 units. But with destructables it's possible to have 6000+ in a map. If that's the case the loop will exit somewhere around 4000-5000. Atleast this apply to normal loops. I barely never use group actions so I don't really know.