| 08-31-2003, 05:38 AM | #1 |
I've been working on a custom transport vehicle that requires a hero to be inside it to operate. The way I've done it is that I transfer the ownership of the unit to neutral passive when I exit the vehicle, then when someone "smart"s it while in range, I transfer ownership to them and board them. This has been problematic, however, and although I've coded many revisions and built in many failsafes (including threadsafe proceedures and such), I've managed to crash WC3 multiple times (ownership is buggy), as well as have lost my heros to neutral passive (transfer of ownership of transport with the hero still inside). Thus, is there a more elegant way of detecting whether or not a transport is full? This has to be done without using variables and arrays, mostly because the transport is not unique, and an unknown number of such transports can exist at any time in the game world. |
| 08-31-2003, 06:42 PM | #2 |
You could use two separate unit types: Transport without hero and transport with hero. Hide the hero when entering the transport. The transport with hero must have "Get the driver out" ability. This should unload the whole transport and unhide the hero. You can keep a reference on what hero drives which transport with the "unit custom value". You just need a unit array where you save your heroes and the index number of the driver is the unit's custom value. This should avoid all bugs you are struggling with I hope. But it's not a very clean solution. |
