Height Detection in Spring
Moderator: Moderators
-
- Posts: 6
- Joined: 20 Apr 2007, 06:38
Height Detection in Spring
I'm working on porting over my mod, Devolution, to Spring and I've run into an issue (or maybe I'm just confused). Many of the features in Devolution rely on one unit detecting another one, and then responding in a certain way. For example, I have Captain units, and when other units are nearby the Captain units, they receive power ups. They do this by detecting the height of the Captain model, which is as far as I know, the best/only functional way to distinguish one unit from another in TA scripting.
When I tried to copy over the scripts into Spring, however, they did not seem to work.
I was wondering if height was measured the same way in Spring as in OTA, or if I should remeasure everything. Or better yet, if there was some way to detect a unit NAME in Spring scripting, rather than just the height.
When I tried to copy over the scripts into Spring, however, they did not seem to work.
I was wondering if height was measured the same way in Spring as in OTA, or if I should remeasure everything. Or better yet, if there was some way to detect a unit NAME in Spring scripting, rather than just the height.
I consider the unit height hack to be very poor form. I'll add the scriptID tag (cobID?).
P.S. It'll be cobID, and the default value is -1.
P.S. It'll be cobID, and the default value is -1.
Code: Select all
#define COB_ID 100 // get
GET COB_ID 0 => unit's own cobID
GET COB_ID <unitID> => unitID's cobID
-
- Posts: 6
- Joined: 20 Apr 2007, 06:38
The easiest way to use this is as follows:
1. Setup a file like the following:(this step could be automated to generate linear IDs if
you don't mind recompiling the COBs for the changed IDs)
2. Use those definitions while compiling your COB scripts.
3. Add a gamedata/unitdefs_post.lua script to parse the file
(which must be included in your mod archive), and assign the
cobID values to the appropriate unitDefs. The parsing script
would look very much like the one I did for cob->lua sounds.
You could skip step 3 if you add all of the cobIDs to the unitDefs manually.
1. Setup a file like the following:
Code: Select all
#define COBID_ARMCOM 1234
#define COBID_CORCOM 1235
etc...
you don't mind recompiling the COBs for the changed IDs)
2. Use those definitions while compiling your COB scripts.
3. Add a gamedata/unitdefs_post.lua script to parse the file
(which must be included in your mod archive), and assign the
cobID values to the appropriate unitDefs. The parsing script
would look very much like the one I did for cob->lua sounds.
You could skip step 3 if you add all of the cobIDs to the unitDefs manually.
Re: Height Detection in Spring
Boogalizer wrote:I'm working on porting over my mod, Devolution, to Spring

This is such a simple 5 minute job it could have been done ages ago by most of us. Why are we so lazy that trepan needs to step up. :P
Devolution was the mod which had three different commanders where only one was allowed to exist at any time right?
On that note a group limit feature which takes armor.txt groups sure would come in handy as a global override for the local limit tag.
Devolution was the mod which had three different commanders where only one was allowed to exist at any time right?
On that note a group limit feature which takes armor.txt groups sure would come in handy as a global override for the local limit tag.
I did, except it uses a separate config file, not armor.txt.tombom wrote:You could do it with Lua.rattle wrote:On that note a group limit feature which takes armor.txt groups sure would come in handy as a global override for the local limit tag.
http://www.unknown-files.net/3632/Group_Limit_Gadget/