| 01-04-2008, 03:55 AM | #1 |
Not sure if anyone else knew this, but I saw nothing mentioned of it when I searched for it except it was useful for chaos abilities. Maybe someone didnt know it? Anyway, It lets you have OR'd tech requirements. e.g, make a Catapult require a Blacksmith and a Lumbermill, you need both... Create a new unit, WarBuilding, add BlackSmith and Lumbermill to its dependency equivalents, and make the catapult require WarBuilding... (you don't ever have to use this new unit) Now you can create a catapult if you have either a blacksmith OR a lumbermill. Things that require just a lumbermill are unaffected. Same goes for blacksmith. Also just tested, if you set the requirement level to 5 you need 5 blacksmiths or 5 lumbermills or "1 and 4" or "2 and 3", etc. And to go further, I went out on a limb with blizzard assumptions but.. I was half right and half wrong calling GetPlayerTechCount(player, WarBuilding, TRUE) would ideally return 0 because you never build WarBuildings, but it returns the number of WarBuildings + Lumbermills + Blacksmiths. calling GetPlayerTechCount(player, WarBuilding, FALSE) returns the same value. Furthermore, I went WAY out on a limb, SetPlayerMaxTechAllowed(player, WarBuilding, 1) would then limit you to either 1 blacksmith or 1 lumbermill? Unfortunately not, it doesnt do anything in this case because it doesnt limit other techs (infinite loop problem could arise?) it is equivalent with. What it does do though is SOMETHING. I had a builder who could build A and B, and A was equivalent to B, and B was equivalent to A. The second I opened the build menu, poof, WC3 Crashed to desktop. Something is up with that I'm not sure. The fact that it only crashes when you open the build menu is what really bugs me. |
| 01-05-2008, 02:51 PM | #2 |
Further investigation. Does anyone really care about this? A equivalent to B SetPlayerMaxTechAllowed(player, A, 2) Now you can only have 2 A's, if and only if you have no B's. Once you have 2 B's you cannot build any more A's. You can have unlimited B's. Dependency Equivalency loops are totally not allowed, and will crash WC3. If A equivalent to B and B equivalent to A, crash. One alternative is to do: A equivalent to B B equivalent to C When A enters map, make dummy C. When A is removed, remove dummy C. SetPlayerMaxTechAllowed(player,A,2) SetPlayerMaxTechAllowed(player,B,2) Now you can only have 2 A's or 2 B's, or 1 A and 1 B. This too sloppy and cumbersome though, so allowing 1 or the other isn't all that realistically possible. On a side note, if you have an ability that requires tech B, then it will not be active until B is created. You'll see "Requires - B" when you hover over it. IF the ability is in a spellbook AND you SetPlayerMaxTechAllowed(player, B, 0), it will be completely REMOVED from the spellbook. The alternative here is to make a dummy unit A, make A equivalent to B, then make the ability require A. Now the ability in the spellbook appears with the correct requirement. Once B is created, the ability will become active. In case you were wondering, the ability being removed does shift all the other spells over. I also experimented with setting tech information to ability codes. Trying to make it so a unit must have ability X to use ability Y. In the world editor the field remained blank even after manually entering the ability code into the techtree requirements. In the game, the "Requires: - Some Ability" actually DID show up! Unfortunately when I added the required ability to that unit the ability X did not activate. That would have opened some windows. It seems you cannot have a per unit basis techtree requirement at all. I don't blame blizzard for this, I just wished it worked :P. |
| 01-05-2008, 03:57 PM | #3 |
I figured somewhat the first post on my own (you can sort of figure it out on some of my recent posts, not that it matters), but holy fucking shit your second post brings a lot of shit on the table that i was carzy looking for without resorting to artificial workarounds. Thank you sir, for all this information. I did try too with other handle-based requirements, such as items, spells and even destructibles and buffs, but it seems that the player needs explicit ownership of such handle objects to be recognized as a valid requirement meeting; i know items may work, for you can claim ownership trough triggers (and they even show their name when putting their rawcode in a requirement filed), but I have not tried it yet. |
