HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

i need help with 2 things

04-24-2014, 02:49 PM#1
andreasaspenberg
one is to kill units that run out of mana and the other is to make lumber generated every 2 seconds by 40 for each town hall and drop by 40 for each farm while gold is increased by the same amount. as it is gold is dropping while lumber doesnt increase.
Attached Files
File type: w3xservival.w3x (88.5 KB)
04-26-2014, 04:09 AM#2
Anitarf
For the gold/lumber thing, I'd make two group arrays, one for storing the town halls of each player and one for storing the farms. Whenever a town hall/farm is built, add it to the appropriate group, whenever it dies, remove it. Then, have a periodic trigger which counts the units in each player's group and modifies gold and lumber accordingly.

Now that I think about it, you wouldn't even need groups, you could just use an integer array and increase the number whenever a building is built and decrease it whenever a building is destroyed.

To kill units that run out of mana, you'd also need to use a periodic trigger that goes through all the units and checks their mana, if it is 0 then kill the unit.
04-26-2014, 05:40 AM#3
Fledermaus
Also to fix the type, replace the E with a U.
04-26-2014, 07:42 PM#4
andreasaspenberg
i tried to check mana and kill units but that destroyed every building, is there a way to deal with that without giving mana to every building. i fixed the original issue with the resource system but i got a new one. each townhall changes minimum lumber by 40 so please take a look at it for me.
Attached Files
File type: w3xservival.w3x (88.8 KB)
04-26-2014, 09:56 PM#5
Anitarf
In the same condition where you check the mana of the unit, you could also check that it is not classified as a structure.
04-28-2014, 09:13 PM#6
andreasaspenberg
that will only solve part of the problem. there will be units that doesnt use mana.(mana displays a unit`s oxygen level and robotic units doesnt have that.) any help you can give me with the resource system. this website is my last hope in this matter.
05-04-2014, 12:41 PM#7
Anitarf
You could give all your robotic units that do not use oxygen the "mechanical" classification. Then, you could ignore units with that classification in your mana checks the same way you ignore structures.

I'm not sure what the problem is with your resource system, looking at the triggers it should work the way you described it in your first post. I rewrote it a bit to make it easier to manage: I put everything in one trigger and used a loop to cover all the players so you don't have to copy the same code for each player. I also removed the group memory leaks. Try out the new trigger and if it is not working the way you want it to, explain in more detail what you want to change.

Also, the way triggers are currently set up, they can't properly handle situations when gold or lumber hits 0, maybe that's your problem since the starting lumber of all players is 0?
Attached Files
File type: w3xservival.w3x (88.8 KB)