Set a few years before the events of Episode IV A New Hope, Empire at War lets players rewrite history as well as experience the aftermath of Star Wars: Episode III Revenge of the Sith, the creation of the Rebel Alliance, and Darth Vader's rise to power.
In this Tutorial I will show you guys/gals how to create a projectile that has the same effects as the Y-Wings Ion cannon Shot.
Posted by rebel5555 on Apr 22nd, 2009
Intermediate Client Side Coding.
Before reading this tutorial I would highly recommend you read my tutorial "Good Times with the Rocket Ability" as I'm using the B-wing's "Rocket Ability" to use the ion cannon. Anyways, in this Tutorial I will show you guys/gals how to create a projectile that has the same effects as the Y-Wings Ion cannon Shot. This is a pretty easy thing to do and can make a Space Battle more interesting.
Below is the Hardpoint entry for the ion Cannon on my B-wing. The below code tells the game how the weapon acts as it's being fired from the B-Wing. To define what happens when the weapon hits the enemy we need to create/edit a projectile. So, lets open PROJECTILES.XML
<HardPoint Name="HP_BWING_ION"> <Type> HARD_POINT_WEAPON_ION_CANNON </Type> <Is_Targetable>No</Is_Targetable> <Is_Destroyable>No</Is_Destroyable> <Fire_Bone_A>MuzzleA_00</Fire_Bone_A> <Fire_Bone_B>MuzzleA_01</Fire_Bone_B> <Fire_Bone_B>MuzzleA_02</Fire_Bone_B> <Fire_Bone_B>MuzzleA_03</Fire_Bone_B> <Fire_Cone_Width>90.0</Fire_Cone_Width> <Fire_Cone_Height>90.0</Fire_Cone_Height> <Fire_Projectile_Type>Proj_Ship_Ion_Cannon_Bwing</Fire_Projectile_Type> <Fire_Min_Recharge_Seconds>1.0</Fire_Min_Recharge_Seconds> <Fire_Max_Recharge_Seconds>2.0</Fire_Max_Recharge_Seconds> <Fire_Pulse_Count>3</Fire_Pulse_Count> <Fire_Pulse_Delay_Seconds>0.25</Fire_Pulse_Delay_Seconds> <Fire_Range_Distance>900.0</Fire_Range_Distance> <Fire_SFXEvent>Unit_Ion_Fire</Fire_SFXEvent> <Damage_Type> Damage_IonCannon </Damage_Type> <Fire_Inaccuracy_Distance> Fighter, 2.0 </Fire_Inaccuracy_Distance> <Fire_Inaccuracy_Distance> Bomber, 2.0 </Fire_Inaccuracy_Distance> <Fire_Inaccuracy_Distance> Transport, 2.0 </Fire_Inaccuracy_Distance> <Fire_Inaccuracy_Distance> Corvette, 10.0 </Fire_Inaccuracy_Distance> <Fire_Inaccuracy_Distance> Frigate, 1.0 </Fire_Inaccuracy_Distance> <Fire_Inaccuracy_Distance> Capital, 1.0 </Fire_Inaccuracy_Distance> <Fire_Inaccuracy_Distance> Super, 30.0 </Fire_Inaccuracy_Distance> <Fire_When_In_Rocket_Attack_Mode>Yes</Fire_When_In_Rocket_Attack_Mode> <Fire_When_In_Normal_Attack_Mode>No</Fire_When_In_Normal_Attack_Mode> </HardPoint>
The below code is the new Projectile for the B-Wing's Ion Cannon. You
can see that I did away with the goofy looking projectile that the Ion
Shot uses and went with the default projectile. What's really cool
about this is that when using this projectile with the "Rocket Ability"
instead of the "Ion Shot" you don't have to wait to have the ability
recharge thus making battles require a little more strategy to win a
<Projectile Name="Proj_Ship_Ion_Cannon_Bwing"> <Text_ID>TEXT_NONE</Text_ID> <Projectile_Width>1.7</Projectile_Width> <Projectile_Length>55</Projectile_Length> <Projectile_Custom_Render>1</Projectile_Custom_Render> <Projectile_Texture_Slot>2</Projectile_Texture_Slot> <Scale_Factor>0.50</Scale_Factor> <Damage_Type> Damage_IonCannon </Damage_Type> <Max_Speed>35.0</Max_Speed> <Max_Rate_Of_Turn>0.0</Max_Rate_Of_Turn> <Behavior>PROJECTILE, HIDE_WHEN_FOGGED</Behavior> <Projectile_Ion_Stun_On_Detonation>Yes</Projectile_Ion_Stun_On_Detonation> <Projectile_Disables_Engines_When_Power_Drained>No</Projectile_Disables_Engines_When_Power_Drained> <Projectile_Ion_Stun_Duration>1.0</Projectile_Ion_Stun_Duration> <Projectile_Ion_Stun_Speed_Reduction_Percent>0.55</Projectile_Ion_Stun_Speed_Reduction_Percent> <Projectile_Ion_Stun_Shot_Rate_Reduction_Percent>0.55</Projectile_Ion_Stun_Shot_Rate_Reduction_Percent> <Projectile_Ion_Stun_Stack_Duration>Yes</Projectile_Ion_Stun_Stack_Duration> <Projectile_Stun_On_Detonation>Yes</Projectile_Stun_On_Detonation> <Projectile_Stun_Duration_Frames>300</Projectile_Stun_Duration_Frames> <Projectile_Stun_Radius>300</Projectile_Stun_Radius> <Projectile_Stun_Spawn_Effect> Stunned_Infantry </Projectile_Stun_Spawn_Effect> <Projectile_Stun_Victims_Category_Mask> All </Projectile_Stun_Victims_Category_Mask> <Projectile_Max_Flight_Distance>2200.0</Projectile_Max_Flight_Distance> <Damage_Type>Damage_Fighter</Damage_Type> <Projectile_Damage>8.0</Projectile_Damage> <Projectile_Does_Shield_Damage>Yes</Projectile_Does_Shield_Damage> <Projectile_Does_Energy_Damage>Yes</Projectile_Does_Energy_Damage> <Projectile_Does_Hitpoint_Damage>No</Projectile_Does_Hitpoint_Damage> <Projectile_Energy_Per_Shot>10</Projectile_Energy_Per_Shot> <Projectile_SFXEvent_Detonate>SFX_Ion_Detonation</Projectile_SFXEvent_Detonate> <Projectile_SFXEvent_Detonate_Reduced_By_Armor> SFX_Small_Damage_Detonation </Projectile_SFXEvent_Detonate_Reduced_By_Armor> </Projectile>
Some you might ask: How does it stun a spacecraft and not drain it's shields like an Ion battery? The answer is the following segments of code which will have shot explanations on what they do at the end of each line of code:
<Projectile_Disables_Engines_When_Power_Drained>No</Projectile_Disables_Engines_When_Power_Drained> (If this was set to True the targets engines would be disabled) <Projectile_Ion_Stun_Duration>1.0</Projectile_Ion_Stun_Duration> (How long the effect lasts) <Projectile_Ion_Stun_Speed_Reduction_Percent>0.55</Projectile_Ion_Stun_Speed_Reduction_Percent> (How much the speed is reduced) <Projectile_Ion_Stun_Shot_Rate_Reduction_Percent>0.55</Projectile_Ion_Stun_Shot_Rate_Reduction_Percent> (How much the Rate of fire is reduced) <Projectile_Ion_Stun_Stack_Duration>Yes</Projectile_Ion_Stun_Stack_Duration> (If hit multiple times the effect is greatly increased)
I hope this tutorial has been helpful to some people.
Have fun and May the force be with you
Rebel5555 (AKA Joshua R.)