Secret Weapons of the Empire

The forum for the Star Wars Empire at War: Forces of Corruption mod
 
HomePortalFAQSearchRegisterMemberlistUsergroupsLog in

Share | 
 

 Event Code: Upgrading/Replacing Units and new abilities based on conquered planets

View previous topic View next topic Go down 
AuthorMessage
SmallPox
Admin
avatar

Male Number of posts : 62
Age : 26
Location : Germany
Registration date : 2008-01-28

PostSubject: Event Code: Upgrading/Replacing Units and new abilities based on conquered planets   Sun Jul 17, 2011 1:04 am

Original Request
Quote :

I've got a multi part question about coding thats been bugging me for a while. What I had originally wanted to do was create a special weapon for most fighters to let them fire off missiles or torpedoes every minute or so. Thats done, but I also wanted to have a few planets that would grant additional bonuses to fighters. Namely I want to have a bonus that changes the projectile the missile ability fires(though that info is in the hardpoints file so more like change the hardpoint) from conc missiles and torpedoes to their advanced variants (I considered the permanent weapon swap for the merc squads disruptor upgrade, but not sure how to make a black market item a planet bonus). And second I want to have a planet or 2 that actually ADD/enable an ability(ECM ability based on crusader laser defense). No luck so far with either.

1- Is it possible to do either of those things with regular planet bonuses, or will I have to make 2 versions of the fighters, 1 with and 1 without changes, and use events to trigger the change?

2 - if the latter is the case, I assume I need to make separate events for all sides that only affects their fighters, so as to avoid capturing the planet as rebels and giving the same bonuses to empire and consortium?

3 - Canl the change affect fighters already built, replacing them with the new version, or will it only affect the ones built from that point on?

4 - now the tricky one. I would ideally like to have 2-3 planets that would offer these benefits, and obviously if the planet is lost, I want the abilities gone too. But if this is done through events, and I have 2 of said planets, and I lose one, will it revert the fighters to their original form, even though I still have the other planet? Can the event be made to be triggered by any of the planets, but only revert the fighters if you lose ALL of them?



Solution:


Code:
<Event Name="SET_FLAG_Special_Planet_Count">        <!-- set up the counter -->
<Event_Type>STORY_TRIGGER</Event_Type>
<Reward_Type>SET_FLAG</Reward_Type>
<Reward_Param1>Special_Planet_Count</Reward_Param1>
<Reward_Param2>0</Reward_Param2>                  <!-- if your faction already owns one or more of the planets from the start change 0 to that number -->
<Prereq>Universal_Story_Start</Prereq>
</Event>


<Event Name="STORY_FLAG_SPC_GREATER_THAN_0">         
<Event_Type>STORY_FLAG</Event_Type>                      <!-- if Special_Planet_Count > 0 ...-->
<Event_Param1>Special_Planet_Count</Event_Param1>
<Event_Param2>0</Event_Param2>
<Event_Param3>GREATER_THAN</Event_Param3>
<Reward_Type>BUILDABLE_UNIT</Reward_Type>                <!-- then enable the new units, lock the old ones -->
<Reward_Param1>New_Unit</Reward_Param1>
<Reward_Param2>Old_Unit</Reward_Param2>
<Prereq>SET_FLAG_Special_Planet_Count</Prereq>
<Perpetual>true</Perpetual>
</Event>

<Event Name="NEW_POWER_FOR_ALL">                      <!-- ...and give a new ability to some unit -->
<Event_Type>STORY_TRIGGER</Event_Type>
<Reward_Type>NEW_POWER_FOR_ALL</Reward_Type>
<Reward_Param1>Unit</Reward_Param1>                 
<Reward_Param2>Ability</Reward_Param2><Prereq>STORY_FLAG_SPC_GREATER_THAN_0</Prereq>             
<Perpetual>true</Perpetual>
</Event>

<!-- NOTE: the unit has to have the ability in its code already, add <Initially_Enabled>No</Initially_Enabled> to the ability code to disable it at first -->





<Event Name="Lose_Special_Planet_1">
<Event_Type>STORY_CONQUER</Event_Type>                <!-- if the an enemy conquers special planet 1 -->
<Event_Param1>Planet_1</Event_Param1>
<Event_Param3>FILTER_ENEMY_ONLY</Event_Param3>
<Reward_Type>INCREMENT_FLAG</Reward_Type>            <!-- then decrement Special_Planet_Count by 1 -->
<Reward_Param1>Special_Planet_Count</Reward_Param1>
<Reward_Param2>-1</Reward_Param2>
<Perpetual>true</Perpetual>
</Event>

<Event Name="DISABLE_STORY_EVENT_Lose_Special_Planet_1">  <!-- Disable the previous event -->
<Event_Type>STORY_TRIGGER</Event_Type>
<Reward_Type>DISABLE_STORY_EVENT</Reward_Type>
<Reward_Param1>Lose_Special_Planet_1</Reward_Param1>
<Reward_Param2>1</Reward_Param2>
<Prereq>Lose_Special_Planet_1</Prereq>
<Perpetual>true</Perpetual>
</Event>



<Event Name="Lose_Special_Planet_2">              <!-- if the an enemy conquers special planet 2 -->
<Event_Type>STORY_CONQUER</Event_Type>
<Event_Param1>Planet_2</Event_Param1>
<Event_Param3>FILTER_ENEMY_ONLY</Event_Param3>
<Reward_Type>INCREMENT_FLAG</Reward_Type>
<Reward_Param1>Special_Planet_Count</Reward_Param1>
<Reward_Param2>-1</Reward_Param2>                  <!-- then decrement Special_Planet_Count by 1 -->
<Perpetual>true</Perpetual>
</Event>

<Event Name="DISABLE_STORY_EVENT_Lose_Special_Planet_2"> <!-- Disable the previous event  -->
<Event_Type>STORY_TRIGGER</Event_Type>
<Reward_Type>DISABLE_STORY_EVENT</Reward_Type>
<Reward_Param1>Lose_Special_Planet_2</Reward_Param1>
<Reward_Param2>1</Reward_Param2>
<Prereq>Lose_Special_Planet_2</Prereq>
<Perpetual>true</Perpetual>
</Event>

                                                      <!-- NOTE: I have written the event code for two planets, so you can see that the code is always the same -->


<Event Name="STORY_FLAG_SPC_EQUAL_TO_0">
<Event_Type>STORY_FLAG</Event_Type>                  <!-- if Special_Planet_Count == 0 -->
<Event_Param1>Special_Planet_Count</Event_Param1>
<Event_Param2>0</Event_Param2>
<Event_Param3>EQUAL_TO</Event_Param3>
<Reward_Type>BUILDABLE_UNIT</Reward_Type>            <!-- then enable the old units, lock the new units -->
<Reward_Param1>Old_Unit</Reward_Param1>
<Reward_Param2>New_Unit</Reward_Param2>
<Prereq>SET_FLAG_Special_Planet_Count</Prereq>
<Perpetual>true</Perpetual>
</Event>


<Event Name="REMOVE_POWER_FROM_ALL">
<Event_Type>STORY_TRIGGER</Event_Type>              <!-- ...and remove the ability from your units -->
<Reward_Type>REMOVE_POWER_FROM_ALL</Reward_Type>
<Reward_Param1>Unit</Reward_Param1>
<Reward_Param2>Ability</Reward_Param2>
<Prereq>STORY_FLAG_SPC_EQUAL_TO_0"</Prereq>
<Perpetual>true</Perpetual>
</Event>




<Event Name="Conquer_Special_Planet_1">
<Event_Type>STORY_CONQUER</Event_Type>  <!-- if a friendly faction (which is only the faction itself, since there are no allies in eaw) conquers special planet 1 -->
<Event_Param1>Planet_1</Event_Param1>                             
<Event_Param3>FILTER_FRIENDLY_ONLY</Event_Param3>
<Reward_Type>INCREMENT_FLAG</Reward_Type>                  <!-- then increment Special_Planet_Count by 1 -->
<Reward_Param1>Special_Planet_Count</Reward_Param1>
<Reward_Param2>1</Reward_Param2>
<Perpetual>true</Perpetual>
</Event>

<Event Name="ENABLE_STORY_EVENT_Lose_Special_Planet_1">  <!-- Re-Enable the event Lose_Special_Planet_1 -->
<Event_Type>STORY_TRIGGER</Event_Type>
<Reward_Type>DISABLE_STORY_EVENT</Reward_Type>
<Reward_Param1>Lose_Special_Planet_1</Reward_Param1>
<Reward_Param2>0</Reward_Param2>
<Prereq>Conquer_Special_Planet_1</Prereq>
<Perpetual>true</Perpetual>
</Event>



<Event Name="Conquer_Special_Planet_2">                          <!-- Same as the two events above -->
<Event_Type>STORY_CONQUER</Event_Type>
<Event_Param1>Planet_2</Event_Param1>
<Event_Param3>FILTER_FRIENDLY_ONLY</Event_Param3>
<Reward_Type>INCREMENT_FLAG</Reward_Type>
<Reward_Param1>Special_Planet_Count</Reward_Param1>
<Reward_Param2>1</Reward_Param2>
<Perpetual>true</Perpetual>
</Event>

<Event Name="ENABLE_STORY_EVENT_Lose_Special_Planet_2">
<Event_Type>STORY_TRIGGER</Event_Type>
<Reward_Type>DISABLE_STORY_EVENT</Reward_Type>
<Reward_Param1>Lose_Special_Planet_2</Reward_Param1>
<Reward_Param2>0</Reward_Param2>
<Prereq>Conquer_Special_Planet_2</Prereq>
<Perpetual>true</Perpetual>
</Event>

_________________
Back to top Go down
View user profile http://secretweapons.heavenforum.com
 
Event Code: Upgrading/Replacing Units and new abilities based on conquered planets
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Event Celebi
» [EVENT] Referral/Invitation Rewards [Sept 14 - ?]
» Guild Event Mechanics (Match Up Portion Complete!)
» Dallas Event in April 2011
» Replacing Stock Vacuum Lines

Permissions in this forum:You cannot reply to topics in this forum
Secret Weapons of the Empire :: General Modding :: XML/LUA Modding-
Jump to: