Help needed with ability constraints

I have only one fairly simple question. Is there a constraint that can limit the use of an ability to non combat only? That is I would like to restrict the use of a particular ability to times when the ship is not using weapons and is not taking any damage. If there is such a constraint it would be a great help if someone could show me the code for it. Many thanks!

Jefferies

26,657 views 5 replies
Reply #1 Top

I don't think there is a way to do this with constraints. Now there is an aiUseTime that might help with autocasting of the ability when 'NotInCombat'. If your goal is to keep the AI from casting during combat this may work.

Feel free to look through my syntax wiki which has structure rules and constants fo sins modding.

http://code.google.com/p/soaseplugin/wiki/targetFilter

http://code.google.com/p/soaseplugin/wiki/aiUseTime

+1 Loading…
Reply #2 Top

Thanks for responding! Shame this isn't directly possible but the alternatives you mention will be helpful to get around the issue.

Reply #3 Top

It should be possible though I need to think it through a little. Bassicly you will need 2 abilities (or just the one you are making if the entity is a spawned frigate) the ability you make and a passive one to "configure" when the ships attack and take damage. The passive buff will have 2 instant actions, both with ApplyBuffToSelf and one with the trigger OnDamageTaken and the other with WeaponFired (might be a little different).

If it is an ultimate ability then:

The buff applied will have the entityBoolModifier "DisableAbilitiesUltimate" and after a certain time it will expire. Make sure it doesn't stack and new buffs are priotized.

If it isn't an ultimate ability then you're screwed...

 

Just kidding, though it is not possible to disable a single ability (you can disable all of them by doing the same as above), but you can (probably) make it so the ability simply doesn't work. Now if it was so that it only works when you atack or take damage, then it would be simple as the following buff of the original ability would need the finishcondition FirstSpawnerNoLongerHasBuff "the passive buff". What we want to achive however is the oposite (should be possible with some tweaking to the afforementioned trick). If you upload the ability files then I could see if I can make it work.

+1 Loading…
Reply #4 Top

Thats a good work around. k1

Reply #5 Top

You can write a self canceling conditional buff.  I've written a few of them already.

 

For a nice, clean passive, you need four buff files, spawner, disruption, disruption check and effect.

 

All buffs should be PrioritizeOldBuffs.

 

In the spawner buff, do your application method.  This will work for radius effect abilities, targeted, self targeted, the works.  I suggest a periodic in the 5 second interval range.  Identical for the two buffs, disruption and check.

 

The disruption buff just needs to remove the check.

instantAction
    buffInstantActionType "RemoveBuffOfType"
    instantActionTriggerType "OnDamageTaken"
    delayTime 0.000000
    buffTypeToRemove "BuffWhatever"

 

Duplicate this action with the OnWeaponFired trigger and set it to 1.00000 chance for all weapons.

 

BuffWhatever, the check, is a simple OnDelay ApplyBuffToSelf of the effect.  It needs to be at least a second to avoid slow computers firing it off before it gets canceled properly just for a base time, so factor that addition into how long it needs to be to catch incoming and outgoing fire before it goes off.  You can use longer than needed delays to create a cooldown period after combat ends as well.

 

Then, in your effect file you just make the finish condition be LastSpawnerNoLongerHasBuff "BuffWhatever".

 

You now have a nice, clean, self removing buff.

 

Edit:  If you're trying to set up an end effect that needs to be reapplied to work, you've got a more complicated situation and will need to alter your timing properly in order to set check and effect to both be PrioritizeNewBuffs without replacing the check before it fires.