Can ChangePlayerIndex work with OnChance Trigger?

I have been trying to make an ability where planets can be taken over through negotiation rather then bombardment. For this I have tried to use the ChangePlayerIndexToFirstSpawner instant action. However, to prevent this from being an overpowered ability I want to trigger this ability OnChance. So far this has not worked for me. This is my current set up in the BuffTarget entity:

TXT
entityType "Buff"
onReapplyDuplicateType "PrioritizeNewBuffs"
buffStackingLimitType "ForAllPlayers"
stackingLimit 1
allowFirstSpawnerToStack FALSE
buffExclusivityForAIType "ExclusiveForAllPlayers"
isInterruptable TRUE
isChannelling TRUE
numInstantActions 1
instantAction
    buffInstantActionType "ChangePlayerIndexToFirstSpawner"
    instantActionTriggerType "OnChance"
    buffApplyChance
        Level:0 0.300000
        Level:1 0.400000
        Level:2 0.500000
numPeriodicActions 0
numOverTimeActions 0
numEntityModifiers 0
numEntityBoolModifiers 0
numFinishConditions 1
finishCondition
    finishConditionType "TimeElapsed"
    time
        Level:0 1.000000
        Level:1 1.000000
        Level:2 1.000000

Changing the chance to 1.0000 makes no difference.

I'm also confused about the finish condition. I have tried OwnerChanged, OwnerIsFriendlyToFirstSpawner and TargetOwnerIsFriendly all to no avail.

BTW the ability works when I change the trigger to OnDelay with AllOnDelayInstantActionsDone as the finish condition.

Any help on this would be much appreciated!

13,428 views 10 replies
Reply #1 Top

numInstantActions 1
instantAction
    buffInstantActionType "ChangePlayerIndexToFirstSpawner"
    instantActionTriggerType "OnChance"

OnChance only works in periodicAction

Reply #2 Top

Is there any way then to reduce the trigger rate of instantAction below 100%? I realise one could trick the game by using a finite periodicAction with only 1 actionCount but that is a very unclean solution that generates problems with the infocard and timing.

Reply #3 Top

The only way in instant action is to use the on weapon fired event with the passive hit chance.

The other option is as you have stated with using a periodic action with a fixed 1 count.

 

Reply #4 Top

I'm not familiar with that mechanic can you give me an example ability?

Reply #5 Top

CAPITALSHIP_PHASEBATTLESHIP.entity

AbilityDisruptiveStrikes

instantAction
buffInstantActionType "ApplyBuffToTargetOnWeaponFired"
instantActionTriggerType "OnWeaponFired"
numWeaponClasses 2
weaponClassForWeaponPassive "WAVE"
weaponClassForWeaponPassive "FLASHBEAM"
passiveWeaponEffectChance
Level:0 0.300000
Level:1 0.300000
Level:2 0.300000
Level:3 0.300000

+1 Loading…
Reply #6 Top

Thanks mate. Do you know if this would work with a targeted ability? I assume the answer is no due to the nature of the effect being passive and therefore only working with ApplyBuffToTargetInRadius.

Reply #7 Top

Quoting Jefferies, reply 2
I realise one could trick the game by using a finite periodicAction with only 1 actionCount but that is a very unclean solution that generates problems with the infocard and timing.

I rely on this all the time but I have not noticed any issues with the infocard. If there is an issue with timing, I've found just adding a second to all subsequent onDelay actions works fine.

In short, there is no cleaner way.

Reply #8 Top

My problem with the infocard is that it does not display the chance of success.

Basically what I would like is a capital ship ability that allows you to take over an enemy planet without bombing it to hell. It should be channelled (so that it can't succeed with hostile ships in orbit) and should have a chance of failing. Therefore having an infocard that displays waves and their duration bares no resemblance to the ability and is really confusing when you are upgrading it. Also making the ability so that it takes less time to be carried out as it levels up is difficult to do with the periodicAction.

Currently I'm looking into the OnWeaponFired triggerType but I can't get it to work with a targeted channelled ability.

 

Reply #9 Top

Here's my thought. Make the ability AM based 0 cost or not then...

Make it an Ability that uses a aiUseTime of OnlyWhenBombing.

Then in the Buff use the OnWeaponFired with the PLANETBOMBARDMENT as the weaponClassForWeaponPassive.

Then for the finishConditionType use DamageTaken to short circuit if it's in combat.

 

You can add a more complicated set of buffs if you want to make sure no enemy ships are present, but that should make for a good starting base.

 

Edit - You'll also want a cooldown on the ability to keep it from firing off too often if you are in combat.

+1 Loading…
Reply #10 Top

That certainly sounds worth trying! I will give it a bash and see if it works!