| 07-10-2008, 01:18 PM | #1 |
Hi everyone, I'm trying to have a setup similar to Castle Fight where you build a building, and when it's built it immediately queues two units, and from then on whenever a unit builds it queues another to be built. There will be lots of different buildings building different units so I'm trying to find a quite generic solution rather than one trigger for each building. I've got the second half working fine - a simple A Unit Finishes Training A Unit trigger. Getting the first bit is much harder. I can detect the building being built using A Unit Finishes Construction. I then need to use an Order X To Train/Upgrade To A Z order to get it to queue up two units. But I can't figure out how to determine what Z should be. One thought was to make the building and its produced unit be adjacent UnitIds. This is only a good solution if it's possible to change UnitIds in the map editor. Is this possible or are they only assigned automatically and impossible to change? My other thought was that if it's possible to order a building to click a particular button in its grid (x,y) then this would be easy - but I can't find a function to do this. Can anyone help me with my problems? TIA |
| 07-11-2008, 04:27 AM | #2 |
Oh another question... a super-practical one. If you're planning to use only JASS to make a map, how do you physically do that? Do you still make all the triggers in GUI and then convert them all to custom text immediately? Or do you Export Script and then use the Import Manager to import it back in? Or am I way off track here? :D |
| 07-11-2008, 04:41 AM | #3 | |
Quote:
|
| 07-11-2008, 05:04 AM | #4 |
Sweet, thanks :) Any ideas for my other problem? |
| 07-11-2008, 05:15 AM | #5 |
Are you sure there isnt' an action or something that forces the training of a unit? I'm fairly sure you can do that. Yes, there is. Trigger: Unit - Issue Train/Research Order JASS:if id == 'h000' then call IssueImmediateOrderById(Unit, 'hfoo') elseif id == 'h001 then call .... //and so on id is the Unit ID of the constructed building, and 'hfoo' (which would make a footman) is where you put the ID of the unit you want that building to train. This is the only way I can think to do it, but it should work. |
| 07-11-2008, 05:20 AM | #6 |
Sorry I didn't explain myself properly... I've found that Unit - Issue Train/Research Order. But the problem is, you have to specify which Unit-Type you want it to build. And I -could- do that separately for each building but I'd like to find a more elegant solution. So my question is, given a building, how do I find what units it is able to build? |
| 07-11-2008, 05:24 AM | #7 | |
Quote:
|
| 07-11-2008, 07:26 AM | #8 |
Okie dokie... at least it's not too hard with your way. Thanks so much! |
| 07-11-2008, 04:46 PM | #9 |
You're very welcome. Let me know if there's anything else you might need help with. |
| 07-13-2008, 08:35 AM | #10 |
How about having an array of the buildings, and what they build, then loop through and check for the index that corresponds to the building in the array. Then use the index to train the corresponding unit, this should be nice n clean. |
| 07-13-2008, 09:29 AM | #11 |
There's no way to get most of the object data, including train list. Sadly. |
| 07-13-2008, 10:45 AM | #12 |
Oo clever Gorman... tidies up the code I reckon. |
