Warcraft III resources & community, 2003–2006 · archived

New Resources - Woot another problem!

15 posts
#1

New Resources - Woot another problem!

Here is the deal, in my map Shadow Tactics, you can mine Iron Ore from Iron Deposits by attacking them with miners. It slowly adds to a variable called P(player number)IronOre.

When you build a blacksmith, it slowly adds Equipment to the P(Player number)Equip variable and removes iron ore from the P(player number)IronOre variable.

So every 2 seconds it does a small -10 in bright grey, and +1 in Dark Grey above your blacksmith. Meaning it removes 10 iron ore and adds one equipment.

Equipment is used to hire units. Well the thing is, I need to make a trigger that...

[b]----------------------------------
When Player owns Blacksmith

P(#)IronOre > or = 10

Every 2 seconds create floating text above blacksmith -10 (light grey) +1 (Dark Grey)
set P(#)IronOre = P(#)IronOre - 10
set P(#)Equip = P(#)Equip + 1
----------------------------------
When Player owns Blacksmith

P(#)IronOre < 10

Every 2 seconds create floating text above blacksmith 0 (light grey) 0 (dark grey)
----------------------------------
[/b]

But its madness! I'd have to make a trigger for creating equip for each player, and another for mining, and another for multiple blacksmiths!

Thats...
10 x 10 x 10 = 1000
Even with the help of coffee I'd be sitting here awhile.

Please help, Im about to go sepuku over this damn plan. It seems so perfect in my head, but when I hit the triggers, its a nightmare, I'm probably gonna lose sleep over this one lol.
#2
Actually... since every player has 3 triggers it would be 3*10=30.

~Daelin
#3
Stop insulting my math skills... lol

I just wanna know how I can cut down from 30 triggers.

Actually more of how the hell I could do the blacksmith/multiple blacksmiths thing...

The mining Iron ore is kinda confusing too actually...

Unit is damaged

Unit type of damaged unit = Iron Deposit
Unit type of attacking unit = Miner

Add 10 to P(# owner of miner)IronOre


Is this even possible? Because that I know of there is no set variable thing for...
|set (conc.Strings[P][Player number of owner of miner][IronOre]) equal to (conc.Strings[P][Player number of owner of miner][IronOre]) + 10|
#4
Yes.. That is possible.

Event - An Unit Is Attacked
Conditions - (Unit type of (Attacked Unit) equal to Tralala)
- (Unit type of (Attacking Unit) equal to Tralala2)
Actions - Add 10 to (Owner of (Attacking Unit))

~Daelin
#5
add ten to owner of attacking unit???

dont you mean add 10 to owner of attacking unit's variable? But how the hell would you set that?

(sorry if I sound ticked, ive been up all night working on my arcane spell contest entry.)
#6
Umm... the whole adding stuff I didn't get it. Do whatever you want as actions as long as you mention the (Triggering Unit) instead of (Attacking Unit) after waits.

~Daelin
#7
Ok let me try explaining this...

Player 1 has a miner attacking the ore rock, every few seconds it adds 10 to the variable P1IronOre

Player 2 has a miner attacking the ore rock, every few seconds it adds 10 to the variable P2IronOre

Player 3...

All the way through player 10, how would I simplify this down to just 1 trigger instead of 10?


Well Im off to bed, Ill check this in the morning...
#8
Ok... You have an array I suppose. It must be an array of integers. And then:

set a[GetPlayerNumber(Owner of (Attacking Unit))]=a+10

~Daelin
#9
Daelin I love you..

in a non-homosexual kinda way lol

I didn't even know arrays existed! This is gonna save me SO much time in my maps!
#10
Crap now Im hitting a problem with floating text...

Currently its...

Unit - Unit is attacked

(Unit Type of (Attacked Unit)) = Iron Deposit
(Unit Type of (Attacking Unit)) = Iron Ore

Set IronOre[(Player number of (Owner of Attacking unit)))] = (Iron Ore[(Player number of (Owner of (Attacking unit)))] +5

Floating Text - Create Floating Text that reads +5 at (Position of (Attacking Unit)) with Z offset 0.00, using font size 10.00. color (50.00%, 50.00%, 50.00%), and 0.00% transparency
Floating Text - Set the Velocity of (Last created floating text) to 64.00 towards 90.00 degrees
Floating Text - Change the lifespan of (Last created floating text) to 1.00


There are two problems here...
#1 If multiple people are mining ore it defines the *last created floating text* wrong, and will remove only one of the many if they are done at the same time.
#2 The Text isn't turning out right, I just want it to live maybe 1 second, but its staying permenently, and since WE doesn't show what the average age of floating text is, I have no clue what to put.
#11
Unfortunately we are having a problem here... Since making multiple floating texts already requires JASS. Thing pretty nasty if you don't know it. So, you can either make a request (though I don't know when I'll have the time to fulfill it). And btw, floating texts are not my speciality... :roll: To be honest I never worked with them.

~Daelin
#12
So would I request it here?

If so all I need is a little text that immitates the gold thing when you bring gold back to the Town Hall, but its grey instead.

Thanks for all your help Daelin, you trully deserve your spot as moderator.
#13
Here... never request spells in the "Request" forum.

~Daelin
#14
You need to enable the lifespan.

Floating Text - Permanent/Expires

Disable it.

If your still having trouble with multiple ones, then you could make a seperate trigger for each player... Or try playing around with the Change Position and Show/Hide options, so that you can use a variable floating text instead of (last created floating text).
#15
Thank you so much Komodo! It helped greatly. The text problem is fixed now, thank god.

And thanks Daelin.

New Question:
How do you order a building to stop researching an upgrade?