build angles
Moderator: Moderators
build angles
One of the things that gave TA its personality was the fact that buildings weren't often built at perfect 90-degree angles, they were a few degrees to either side. Could this sort of randomness be added to Spring?
You can detect whether a unit is supposed to have this random build angle by searching for a FBI buildangle of anything greater than 0.
You can detect whether a unit is supposed to have this random build angle by searching for a FBI buildangle of anything greater than 0.
It's not, actually- if the Piece that the Unit that's being created isn't on a valid square, for example, it'd either ruin the factory, or ruin the illusion- I've done some experiments with this, and yes, you *can* cause units to become immobile, if the Factory won't open. Just imo, of course, but I don't recommend it. Everything else is fair game (for turrets or other active objects, remember to store the value and then post it to your weapon scripts, so that they get the correct heading).
- Guessmyname
- Posts: 3301
- Joined: 28 Apr 2005, 21:07
You can do that for factories as long as the pad is centered and you don't mind units passing through wall, or as long as you don't turn too much.
In Total Annilihilation factories had a buildangle tag but kept the value low enough so that it cause no issues, for exemple the ArmALab had buildangle=2048; where 2048 means 11°¼.
There's only problem with buildangle on factories when you turn so much the yardmap no fitting the model becomes too visible, or when the turned buildpad isn't any more over open square of the yardmap.
Spring ignore the BuildAngle tag, and indeed it would be nice if it supported it.
However, like Argh and KDR pointed out, you can do it in the script. Editing the script isn't as convenient as editing the FBI, but the result is the same.
I did that like 1.5 years ago, when I first noticed Spring ignored BuildAngle on my Stargate that had a very large buildangle.
Basically:
- In the 3do or s3o, have nothing in the root object, then have a "mother" piece child of root, and every other piece child or heir of "whatever". (This is because for some reason Spring doesn't like turn the root of s3o.)
- In the Create() of the script, have a "turn whatever to y-axis rand(<-11>,<11>) now;" where 11 is your random buildangle in degree.
If you used a scripted random buildangle on turret, you would have the problem of making sure the turret still point to the target. There's a variety of approach to that, you can make the turret of defense tower not a heir of the piece that is turned, so that the random rotation affects the tower but not the turret on top of the turret. Or you can store the random rotation in some static-var and then substract it to the "heading" in the AimPrimary, etc...
If I remember that thread right, for 0.75 FLOZi has implemented a "set HEADING", which means that instead of turning all the pieces of the unit, you could turn the unit itself, with a set HEADING to rand(<-11>,<11); in the Create(), which would be a better way since then the unit would actually be turned instead of appear to be turned, so stuff like aiming turret wouldn't need any correction.
Guessmyname: Scriptor doesn't like to have variables inside < >. It ges all confused and spout "Error: expected identifier". And understandably, since the < > are calculated at the preprocessing stage, when variables aren't fixed. It's better to put the < > directly around the 90, plus that way the startangle are in scripts native angular units, so like you can compare them with other angles such as get XZ_ATAN or aiming's heading. By the way, make it a static-var if you plan to use the variable later in other script, or don't use any var but put the "rand" directly inside the "turn" command it's a value we're supposed to forget as soon as the model is turned. And when I made the Kernel turn to face map center, I noticed Spring went really unhappy if I turned the base piece itself.
In Total Annilihilation factories had a buildangle tag but kept the value low enough so that it cause no issues, for exemple the ArmALab had buildangle=2048; where 2048 means 11°¼.
There's only problem with buildangle on factories when you turn so much the yardmap no fitting the model becomes too visible, or when the turned buildpad isn't any more over open square of the yardmap.
Spring ignore the BuildAngle tag, and indeed it would be nice if it supported it.
However, like Argh and KDR pointed out, you can do it in the script. Editing the script isn't as convenient as editing the FBI, but the result is the same.
I did that like 1.5 years ago, when I first noticed Spring ignored BuildAngle on my Stargate that had a very large buildangle.
Basically:
- In the 3do or s3o, have nothing in the root object, then have a "mother" piece child of root, and every other piece child or heir of "whatever". (This is because for some reason Spring doesn't like turn the root of s3o.)
- In the Create() of the script, have a "turn whatever to y-axis rand(<-11>,<11>) now;" where 11 is your random buildangle in degree.
If you used a scripted random buildangle on turret, you would have the problem of making sure the turret still point to the target. There's a variety of approach to that, you can make the turret of defense tower not a heir of the piece that is turned, so that the random rotation affects the tower but not the turret on top of the turret. Or you can store the random rotation in some static-var and then substract it to the "heading" in the AimPrimary, etc...
If I remember that thread right, for 0.75 FLOZi has implemented a "set HEADING", which means that instead of turning all the pieces of the unit, you could turn the unit itself, with a set HEADING to rand(<-11>,<11); in the Create(), which would be a better way since then the unit would actually be turned instead of appear to be turned, so stuff like aiming turret wouldn't need any correction.
Guessmyname: Scriptor doesn't like to have variables inside < >. It ges all confused and spout "Error: expected identifier". And understandably, since the < > are calculated at the preprocessing stage, when variables aren't fixed. It's better to put the < > directly around the 90, plus that way the startangle are in scripts native angular units, so like you can compare them with other angles such as get XZ_ATAN or aiming's heading. By the way, make it a static-var if you plan to use the variable later in other script, or don't use any var but put the "rand" directly inside the "turn" command it's a value we're supposed to forget as soon as the model is turned. And when I made the Kernel turn to face map center, I noticed Spring went really unhappy if I turned the base piece itself.
- Guessmyname
- Posts: 3301
- Joined: 28 Apr 2005, 21:07
Re: build angles
Epic Rez.
Searched the forum, no more recent references to this. Was it ever added to Spring?
I should add, I tried the script method a while ago. It works fine while the unit is alive, but the wreck always appears at the normal rotation, ruining the effect pretty bad.
Not sure, maybe the random number can be stored as a static var and then called when the... no that won't work.
Any ideas?
Searched the forum, no more recent references to this. Was it ever added to Spring?
I should add, I tried the script method a while ago. It works fine while the unit is alive, but the wreck always appears at the normal rotation, ruining the effect pretty bad.
Not sure, maybe the random number can be stored as a static var and then called when the... no that won't work.
Any ideas?
Re: build angles
No, it wasn't added to Spring. You can do it in BOS as described, though, and if it's just 1-2000K radians, it's not that likely to actually cause any Footprint issues anyhow.
Re: build angles
Will it still be noticeable?I remember solars in ota sometimes turned a lot.
Re: build angles
They didn't turn that much.
argh is speaking the truth though, script based is the way to go.
argh is speaking the truth though, script based is the way to go.
Re: build angles
Solars indeed had a huge buildangle, i think it was as much as 45 degrees!
Still someone has to make a patch for spring IMO!
Still someone has to make a patch for spring IMO!
Re: build angles
Argh wrote:You can do it in BOS as described, though
O haiCaydr wrote:I tried the script method a while ago. It works fine while the unit is alive, but the wreck always appears at the normal rotation, ruining the effect pretty bad.
smoth wrote:They didn't turn that much.
argh is speaking the truth though, script based is the way to go.
O HAI THERCaydr wrote:I tried the script method a while ago. It works fine while the unit is alive, but the wreck always appears at the normal rotation, ruining the effect pretty bad.
They turned by as much as 178 degrees.
Last edited by Caydr on 29 Jul 2009, 18:08, edited 4 times in total.
Re: build angles
random building turning works (ca mex's have them)
but imo it was one of the most random crappy things in OTA that i dont miss it ruined base unity and now that you got directional building its made more redundant.
tho diagonal buildings would be awesome (if it could work with labs to)
but imo it was one of the most random crappy things in OTA that i dont miss it ruined base unity and now that you got directional building its made more redundant.
tho diagonal buildings would be awesome (if it could work with labs to)
Re: build angles
Don't use a bos script to turn a piece. Use a Lua script to turn the unit whole.Caydr wrote:Argh wrote:You can do it in BOS as described, thoughCaydr wrote:I tried the script method a while ago. It works fine while the unit is alive, but the wreck always appears at the normal rotation, ruining the effect pretty bad.
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: build angles
If you did it with lua, I think structures should only be turned in one of the four cardinal directions, otherwise their texture becomes garbled. This doesn't apply to turning the base in cob.zwzsg wrote:Don't use a bos script to turn a piece. Use a Lua script to turn the unit whole.Caydr wrote:Argh wrote:You can do it in BOS as described, thoughCaydr wrote:I tried the script method a while ago. It works fine while the unit is alive, but the wreck always appears at the normal rotation, ruining the effect pretty bad.