Instead of firing the enemies projectiles back to its sender, it uses the energy from the projectile to fire a projectile instead so it can still shoot back even though the enemy that shot you shot a kinetic bolt, but I do not want it to just do that, I want to create some cons to this shield deflector as well like if the enemy shot you that can take down the shield with one hit, you will get a power surge and the shield gets ionised, since the shield cannot absorb so much energy that it just releases the energy in a different way. definitely the shield will has less than average health than normal shield generators.
Another thing, about this generator, if it absorb a shot with heavy damage but not exceeds the projectiles damage of 10 damage, it divides the energy into a burst or projectiles, I think I can sort out a formula to create this event.
such as...
100 Dmg of shield sustained
divide by...
10 (how much damage can 1 retaliating projectile can do)
equals...
10 (use this answer to know how much projectiles it fire to your shooter)
If the answer has a remainder, (like 97) then use a function to ignore the remainder (so it only fires 9 to the shooter)
Here is the code that I modified (Below) from (^o^)'s shield deflector to make the retaliating part but not the power surge, ionisation and the operations mentioned above.
Code: Select all
</ItemType>
<ItemType UNID="&itShield;"
name= "directional reflector"
level= "50"
value= "0"
mass= "0"
frequency= "notRandom"
attributes= "commonwealth, majorItem"
description= "This shield reflects energy projectiles toward the attacker."
>
<Image imageID="&rsItemsBushido1;" imageX="0" imageY="0" imageWidth="96" imageHeight="96"/>
<Shields
hitPoints= "100"
regen= "100"
depletionDelay= "300"
powerUse= "0"
/>
<Events>
<OnShieldDamage>
(if
(and
(objGetShieldLevel gSource)
(itmCreate &vtEnergyCannon; 1)
(not (itmIsDamaged gItem))
)
(block Nil
(setq theShot
(sysCreateWeaponFire
&vtEnergyCannon;
gSource
aHitPos
(switch
aAttacker
(sysCalcFireSolution
(sysVectorSubtract (objGetPos aAttacker) aHitPos)
(sysVectorSubtract (objGetVel aAttacker) (objGetVel gSource))
(typGetDataField (itmGetUNID &vtEnergyCannon;) 'speed)
)
aHitDir
)
(typGetDataField (itmGetUNID &vtEnergyCannon;) 'speed)
aAttacker
Nil
Nil
)
)
(objIncVel theShot (objGetVel gSource))
Nil
)
)
</OnShieldDamage>
</Events>
</ItemType>
<ItemType UNID="&vtEnergyCannon;"
attributes= "majorItem, notrandom, speciality, energyWeapon, tinkers"
name= "directional cannon"
virtual= "true"
level= "11"
frequency= "notrandom"
value= "1"
mass= "5000"
description= "Debug cannon."
>
<Image imageID="&rsItems10;" imageX="192" imageY="0" imageWidth="96" imageHeight="96"/>
<Weapon
type= "beam"
damage= "positron:10"
missileSpeed= "150"
fireRate= "0"
lifetime= "60"
poweruse= "0"
sound= "&snLaserCannon;"
>
<Effect>
<Ray
shape="straight"
style="wavy"
primaryColor="#ffff00"
secondaryColor="ffff00"
intensity="40"
length="100"
width="10"
/>
</Effect>
</Weapon>
</ItemType>