Is there any way of getting the armor segment that is being damaged from events on the ship (player or otherwise)
I'd prefer if I didn't have to use the direction of the shot to work it out, as this would be messy, and especially annoying because I intended to use this on ships with many armor segments.
EDIT: unfinished post
had a look through the changelog for something I thought I saw earlier... I am hoping there is something like aArmorSeg that works for <OnDamage>
Thanks anyway.
Armor Segment
- Aury
- Fleet Admiral
- Posts: 5510
- Joined: Tue Feb 05, 2008 1:10 am
- Location: At the VSS Shipyards in the frontier, designing new ships.
Do you want this from the weapon side or the armor side?
(shpOrder gPlayership 'barrelRoll)
<New tutorials, modding resources, and official extension stuff coming to this space soon!>
<New tutorials, modding resources, and official extension stuff coming to this space soon!>
- Aury
- Fleet Admiral
- Posts: 5510
- Joined: Tue Feb 05, 2008 1:10 am
- Location: At the VSS Shipyards in the frontier, designing new ships.
Then it should be there for the armor; unless it got renamed to gSource or something like that. If neither of those are the case, it's a bug.
(shpOrder gPlayership 'barrelRoll)
<New tutorials, modding resources, and official extension stuff coming to this space soon!>
<New tutorials, modding resources, and official extension stuff coming to this space soon!>
I've tried gItem and lots of other variants along the lines of aArmorSeg, within an <OnDamage> event. Can anyone think of a workaround which will let me get the segment of the ship that has been hit?
Would calculating it with angles cause problems in combat when the ship is hit very often? I don't want things to freeze up when you get hit with an ares lightning turret.
Would calculating it with angles cause problems in combat when the ship is hit very often? I don't want things to freeze up when you get hit with an ares lightning turret.
- Aury
- Fleet Admiral
- Posts: 5510
- Joined: Tue Feb 05, 2008 1:10 am
- Location: At the VSS Shipyards in the frontier, designing new ships.
Well, if the variable is missing, than its a bug.
(shpOrder gPlayership 'barrelRoll)
<New tutorials, modding resources, and official extension stuff coming to this space soon!>
<New tutorials, modding resources, and official extension stuff coming to this space soon!>
-
- Developer
- Posts: 2998
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
I agree that the armor segment should be added to <OnDamage>.
Until then, here's how you can work around it:
Note: I haven't tested the above, so it might have bugs.
The calculation is not very expensive, so I wouldn't worry about it taking too long.
Until then, here's how you can work around it:
Code: Select all
(setq CalcArmorSegment (lambda ()
(block (theAngle theArmorAngle)
; First we need to compute the angle that the
; shot hit the ship (compensating for the
; rotation of the ship)
(setq theAngle (mod (subtract (add aHitDir 360) (shpGetDirection gSource)) 360))
; Next we need to figure out the angle for armor
; segment. For now we assume that all armor
; segments are the same size. (We don't have
; enough data to make any other assumption.)
(setq theArmorAngle (divide 360 (shpGetArmorCount gSource)))
; Now we just return the armor segment. We
; adjust by half an armor segment because the
; front armor has its center at 0 degrees.
(divide (add theAngle (divide theArmorAngle 2)) theArmorAngle)
)
))
The calculation is not very expensive, so I wouldn't worry about it taking too long.
- Aury
- Fleet Admiral
- Posts: 5510
- Joined: Tue Feb 05, 2008 1:10 am
- Location: At the VSS Shipyards in the frontier, designing new ships.

Should I make a ticket simply for the sake of tracking its progress?
(shpOrder gPlayership 'barrelRoll)
<New tutorials, modding resources, and official extension stuff coming to this space soon!>
<New tutorials, modding resources, and official extension stuff coming to this space soon!>
-
- Developer
- Posts: 2998
- Joined: Thu Jul 24, 2003 9:53 pm
- Contact:
Yes, if you don't mind. Tickets are always good.Wolfy wrote:Thanks for the workaround george!
Should I make a ticket simply for the sake of tracking its progress?