Getting a structure to constantly shoot a weapon
...only when it is damaged, is impossible.
Either 1. I can make it shoot all the time, or 2. I can make it shoot when its 3/4 of its energy or less.
And frankly, both options are useless as I need it to shoot as soon as its damaged only by 1 energy and then stop when its full.
Reason why I need this, is because I am making a repair button that charges you as it repairs, I got that part done however it constantly charges you after you have clicked it once even when the building is fixed, worse still is after the first repair, no matter what you have no choice whether it should repair or not after that.
I worked around this, however, due to EA's baffling inflexible code I can only make it repair and then stop at 75% of the energy (using the FireWeaponWhenDamaged module).
The idea is, and bare with me now, is that the repair button shoots a weapon once on the structure which creates a special repairobject in its position (invisible) this object deletes itself in 101 ms, however, a weapon shooting from the building when its damaged destroys the object in 100ms to activate the repairobjects death OCL which fires a repair weapon, creates a negative cash crate and another repairobject only to repeat until the structure is repaired.
I am working out how to disable the repair through pressing the button a second time, however I cannot fixed the problem of not being able to get the structure to fire as soon as it is damaged and not just when its at 75% of its health.
Oh and just to clarify, I could change the percentage at which a unit is considered 'Damaged' however that would mess with unit and building damage art.
|