How to obtain weapon range and projectile lifetime in TLISP
Posted: Mon Jun 02, 2014 8:45 am
Just discovered it is possible to get weapon range and shot lifetime in TLISP!
Weapon range (in light-seconds) = (typGetDataField weaponUNID "range")
Example (Laser Cannon, pointer):
Returns "60"
Example 2 (Fusionfire Howitzer, UNID):
Returns "120"
These are indeed correct, the laser cannon does has a range of 60 ls, and the FF has a range of 120 ls.
Basic algebra can be used to obtain lifetime:
Weapon range in ls / (Weapon speed in %c / (50 %c / (ls/tick))) = lifetime in ticks
Example (Laser Cannon, pointer):
Returns "30", which means 30 ticks (1 second real-time)
Weapon range (in light-seconds) = (typGetDataField weaponUNID "range")
Example (Laser Cannon, pointer):
Code: Select all
(typGetDataField &itLaserCannon; "range")
Example 2 (Fusionfire Howitzer, UNID):
Code: Select all
(typGetDataField 0x0000412C "range")
These are indeed correct, the laser cannon does has a range of 60 ls, and the FF has a range of 120 ls.
Basic algebra can be used to obtain lifetime:
Weapon range in ls / (Weapon speed in %c / (50 %c / (ls/tick))) = lifetime in ticks
Example (Laser Cannon, pointer):
Code: Select all
(divide (typGetDataField &itLaserCannon; "range") (divide (typGetDataField &itLaserCannon; "speed") 50))