Wednesday, April 18, 2012

Another problem - adding max HP to all players units as gold increases?

On the map I'm making, I'm trying to find the right way on how to increase every units HP for a particular player, but only when there gold is between a particular amount. The higher the amount of gold the higher the HP bonus.

I'm trying to do it in intervals of 600 seconds.

Additionally if your gold is at 50000, every 600 seconds your heroes should get a 150% bonus XP from kills as well as random lvl 2 powerup items.

Any suggestions on how to do this right? My way so far hasnt had any luck =(|||I think you know the basics of triggers already so I'll leave you to this and I hope you understand:


Quote:




Give HP etc

Events

Time - Every 600.00 seconds of game time

Conditions

Actions

Player Group - Pick every player in (All players) and do (Actions)

Loop - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Picked player) Current gold) Greater than or equal to 50000

Then - Actions

Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Equal to True)) and do (Actions)

Loop - Actions

Hero - Make (Owner of (Picked unit)) Heroes gain 150.00% experience from future kills

Item - Create (Random level 2 item-type) at (Center of (Playable map area))

Hero - Give (Last created item) to (Picked unit)

Else - Actions

Unit Group - Pick every unit in (Units owned by (Picked player)) and do (Actions)

Loop - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Owner of (Picked unit)) Current gold) Less than or equal to 20000

Then - Actions

Item - Create Manual of Health at (Center of (Playable map area))

Hero - Give (Last created item) to (Picked unit)

Else - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Owner of (Picked unit)) Current gold) Less than or equal to 50000

Then - Actions

Item - Create Manual of Health at (Center of (Playable map area))

Hero - Give (Last created item) to (Picked unit)

Else - Actions




And then just change the goldvalues to the one you want and create/copy 1 Manual Of Health for each different you want, so if you want the unit to have 60 instead of 50 more hp then create a manual of health with that valua and use the book in the trigger, else if you're lazy you can just copy-paste the Add Item and Give Item so you give it multiple times = give 50 + 50 or change it so it's 20 + 20 as many times as you want. Ah, you know what I mean..)

[To make it leak-free change the region to Temp_Region and make that a local region (see JASS tutorials for more help about that) But imho never mind that, this trigger will only run each 10 minute anyways..}

Well, you're welcome|||Sorry for double-posting, was my internet that screwed up and while I tried to fix it it has sent the message without my knowing 2 times while I thought: none. :P|||thanks a ton! I didnt realise that you could also do it that way...no wonder my way wasnt working for me. And I just realised another work around to getting every trained units HP & dmg up would be to make a particular item trigger a particular upgrade (like glyph of fortification) that modifies the HP and damage of all basic units owned by that player...going to look into this more though.

For those who are curious I am tweaking my map a bit and making gold mines into Fountains of Gaia. They deal DOT to any unit near them but if you gather enough Power (gold) then your units evolve slightly. Night Elves and Undead who capture these sources of power can actually heal the damage it deals to their own units. If all fountains of Gaia are drained though then the world tree dies and the world turns into a nightmare (it becomes very difficult to survive) and the worlds true form is revealed. Then I'm trying to make an ultimate world boss for the end of the map ;)

gonna take a while though before its finished haha.



Edit: hmmm...not sure if this method is working...I put in text comments to try and distinguish if and when the trigger is working. I cheated and made the gold over 50000 lol

Edit: I just have confirmed that using a modified version of the item, ability and upgrade "Glyph of Fortification" can actualy increase every units HP and damage amount....but only by modifying every single unit and adding the upgrade to it's "Techtree - Upgrades Used" list...I was hoping I wouldnt have to though since it allways screws up the AI in the game. Ah well dont need those AI's for this map anyways.|||You must've done something wrong if my trigger didn't work, cause I'm using a similiar system to my map and it works wonderful :)

Anyway, since you found another way to do it I congratulate you, [reason of why I'm not using that system is that my unit's hp increases every 10 second and if I'd have that going for an hour I'd need to put 360levels to the abilities and adding that to every unit; even one. would case formidable lag :P ]

Take care|||Quote:






View Post

You must've done something wrong if my trigger didn't work, cause I'm using a similiar system to my map and it works wonderful :)

Anyway, since you found another way to do it I congratulate you, [reason of why I'm not using that system is that my unit's hp increases every 10 second and if I'd have that going for an hour I'd need to put 360levels to the abilities and adding that to every unit; even one. would case formidable lag :P ]

Take care




Yeah your right about that. I made 50 levels of 3 different abilities that fall under the same category lol. And I did try that trigger a few times. It just only didnt work when my gold was set at or above 50000. It works for the 20000 and lower so all it needs is a bit of tweaking (maybe i did do something wrong thats hard to notice, I'll double check it again) And I like the fact that your using the 10 second interval on your map. Definently would be hard to beat up a player who had their units all buffed up and swarming with peasants lol I'll try posting some pics of my map just to kind of show you what the atmosphere/game is going to be like.







it gets darker/more cloudy or brighter/less cloudy as the day progresses :P



Edit: ok I have rewrote the trigger based off of yours and this is how it ended up:


Quote:




Player gold bonus 1

Events

Time - Every 10.00 seconds of game time

Conditions

Actions

Player Group - Pick every player in (All players) and do (Actions)

Loop - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Picked player) Current gold) Greater than or equal to 2500

((Picked player) Current gold) Less than 5000

Then - Actions

Hero - Make (Picked player) Heroes gain 100.00% experience from future kills

Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Not equal to True)) and do (Actions)

Loop - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Picked unit) is A Hero) Equal to True

Then - Actions

Do nothing

Else - Actions

Unit - Add Inventory (Unit) to (Picked unit)

Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Equal to True)) and do (Actions)

Loop - Actions

Item - Create Orb of Power (Least) at (Center of (Playable map area))

Hero - Give (Last created item) to (Picked unit)

Unit Group - Pick every unit in (Units owned by (Picked player) matching ((Unit-type of (Picked unit)) Equal to (Trained unit-type))) and do (Actions)

Loop - Actions

Item - Create Orb of Power (Least) at (Center of (Playable map area))

Hero - Give (Last created item) to (Picked unit)

Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Not equal to True)) and do (Actions)

Loop - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Picked unit) is A Hero) Equal to True

Then - Actions

Do nothing

Else - Actions

Unit - Remove Inventory (Unit) from (Picked unit)

Game - Display to pickedplayer the text: Your units are adap...

Else - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Picked player) Current gold) Greater than or equal to 5000

((Picked player) Current gold) Less than 10000

Then - Actions

Hero - Make (Picked player) Heroes gain 100.00% experience from future kills

Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Equal to False)) and do (Actions)

Loop - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Picked unit) is A Hero) Equal to True

Then - Actions

Do nothing

Else - Actions

Unit - Add Inventory (Unit) to (Picked unit)

Unit Group - Pick every unit in (Units owned by (Picked player) matching ((Unit-type of (Picked unit)) Equal to (Trained unit-type))) and do (Actions)

Loop - Actions

Item - Create Orb of Power (Lesser) at (Center of (Playable map area))

Hero - Give (Last created item) to (Picked unit)

Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Equal to True)) and do (Actions)

Loop - Actions

Item - Create Orb of Power (Lesser) at (Center of (Playable map area))

Hero - Give (Last created item) to (Picked unit)

Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Equal to False)) and do (Actions)

Loop - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Picked unit) is A Hero) Equal to True

Then - Actions

Do nothing

Else - Actions

Unit - Remove Inventory (Unit) from (Picked unit)

Game - Display to pickedplayer the text: Your units have gro...

Else - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Picked player) Current gold) Greater than or equal to 10000

((Picked player) Current gold) Less than 25000

Then - Actions

Hero - Make (Picked player) Heroes gain 100.00% experience from future kills

Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Equal to False)) and do (Actions)

Loop - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Picked unit) is A Hero) Equal to True

Then - Actions

Do nothing

Else - Actions

Unit - Add Inventory (Unit) to (Picked unit)

Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Equal to True)) and do (Actions)

Loop - Actions

Item - Create Orb of Power at (Center of (Playable map area))

Hero - Give (Last created item) to (Picked unit)

Unit Group - Pick every unit in (Units owned by (Picked player) matching ((Unit-type of (Picked unit)) Equal to (Trained unit-type))) and do (Actions)

Loop - Actions

Item - Create Orb of Power at (Center of (Playable map area))

Hero - Give (Last created item) to (Picked unit)

Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Equal to False)) and do (Actions)

Loop - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Picked unit) is A Hero) Equal to True

Then - Actions

Do nothing

Else - Actions

Unit - Remove Inventory (Unit) from (Picked unit)

Game - Display to pickedplayer the text: Your units seem to ...

Else - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Picked player) Current gold) Greater than or equal to 25000

((Picked player) Current gold) Less than 50000

Then - Actions

Hero - Make (Picked player) Heroes gain 100.00% experience from future kills

Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Equal to False)) and do (Actions)

Loop - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Picked unit) is A Hero) Equal to True

Then - Actions

Do nothing

Else - Actions

Unit - Add Inventory (Unit) to (Picked unit)

Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Equal to True)) and do (Actions)

Loop - Actions

Item - Create Orb of Power (Greater) at (Center of (Playable map area))

Hero - Give (Last created item) to (Picked unit)

Unit Group - Pick every unit in (Units owned by (Picked player) matching ((Unit-type of (Picked unit)) Equal to (Trained unit-type))) and do (Actions)

Loop - Actions

Item - Create Orb of Power (Greater) at (Center of (Playable map area))

Hero - Give (Last created item) to (Picked unit)

Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Equal to False)) and do (Actions)

Loop - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Picked unit) is A Hero) Equal to True

Then - Actions

Do nothing

Else - Actions

Unit - Remove Inventory (Unit) from (Picked unit)

Game - Display to pickedplayer the text: Your units seemed t...

Else - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Picked player) Current gold) Greater than or equal to 50000

Then - Actions

Hero - Make (Picked player) Heroes gain 150.00% experience from future kills

Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Equal to False)) and do (Actions)

Loop - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Picked unit) is A Hero) Equal to True

Then - Actions

Do nothing

Else - Actions

Unit - Add Inventory (Unit) to (Picked unit)

Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Equal to True)) and do (Actions)

Loop - Actions

Item - Create (Random level 2 Powerup item-type) at (Center of (Playable map area))

Hero - Give (Last created item) to (Picked unit)

Item - Create (Random level 1 Powerup item-type) at (Center of (Playable map area))

Hero - Give (Last created item) to (Picked unit)

Item - Create Orb of Power (Greatest) at (Center of (Playable map area))

Hero - Give (Last created item) to (Picked unit)

Unit Group - Pick every unit in (Units owned by (Picked player) matching ((Unit-type of (Picked unit)) Equal to (Trained unit-type))) and do (Actions)

Loop - Actions

Item - Create Orb of Power (Greatest) at (Center of (Playable map area))

Hero - Give (Last created item) to (Picked unit)

Unit Group - Pick every unit in (Units owned by (Picked player) matching (((Picked unit) is A Hero) Equal to False)) and do (Actions)

Loop - Actions

If (All Conditions are True) then do (Then Actions) else do (Else Actions)

If - Conditions

((Picked unit) is A Hero) Equal to True

Then - Actions

Do nothing

Else - Actions

Unit - Remove Inventory (Unit) from (Picked unit)

Game - Display to pickedplayer the text: Your units have evo...

Else - Actions

Do nothing




and so far am not having any problems at the moment :D I cant wait to try this out on a normal map and see what difference it makes against the computer or another player!

No comments:

Post a Comment