Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // this code will trigger when the game finishes creating ability, item and character templates.
- static event OnPostTemplatesCreated()
- {
- // this is the list of local variables used in is code.
- local X2AbilityTemplate Template;
- local X2AbilityTemplateManager AbilityManager;
- local X2AbilityCost_ActionPoints ActionPointCost;
- local X2AbilityCooldown Cooldown;
- local X2AbilityCost_Ammo AmmoCost;
- // grab ability manager, which we will use to find ability templates by name.
- AbilityManager = class'X2AbilityTemplateManager'.static.GetAbilityTemplateManager();
- // find an ability template by name and record it into the "Template" variable.
- Template = AbilityManager.FindAbilityTemplate('Shadow');
- // if the ability template was successfully found, we can start making changes to it.
- if(Template != none)
- {
- // this how to remove ALL costs from the ability, such as charges, ammo, cooldown and action points.
- Template.AbilityCosts.Length = 0;
- // this is how you add a simple 1 action ability cost.
- ActionPointCost = new class'X2AbilityCost_ActionPoints';
- ActionPointCost.iNumPoints = 1;
- Template.AbilityCosts.AddItem(ActionPointCost);
- // this is how you add "turn ending action" cost to an ability.
- // i.e. this ability will consume all soldier's action points after being used.
- ActionPointCost = new class'X2AbilityCost_ActionPoints';
- ActionPointCost.iNumPoints = 1;
- ActionPointCost.bConsumeAllPoints = true;
- Template.AbilityCosts.AddItem(ActionPointCost);
- // this is how you add a "free action" ability cost to the ability.
- // even "free" abilities need to have the "free action" ability cost,
- // so that they can't be used after the soldier "finished turn", i.e. spent all their action points
- ActionPointCost = new class'X2AbilityCost_ActionPoints';
- ActionPointCost.iNumPoints = 1;
- ActionPointCost.bFreeCost = true;
- Template.AbilityCosts.AddItem(ActionPointCost);
- // note: don't give one ability more than one Action Point Cost.
- // It probably won't break anything if you do, but there's no reason to do it, I just list all three here as an example.
- // if you want to "hide" a piece of code from the game, you can comment it out like this:
- // Template.AbilityCosts.Length = 0;
- // this is how you add a cooldown to an ability
- Cooldown = new class'X2AbilityCooldown';
- Cooldown.iNumTurns = 2;
- Template.AbilityCooldown = Cooldown;
- // this is how you add an ammo cost to an ability, if it involves shooting, like Banish / Annihilation.
- AmmoCost = new class'X2AbilityCost_Ammo';
- AmmoCost.iAmmo = 1;
- Template.AbilityCosts.AddItem(AmmoCost);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement