It's a bit complicated to explain but I'll give it a try...
I have a validator or filters problem in one of my custom abilities... Basically it's a "ride unit" spell, which gives you the control of the targeted unit and lets the caster mount the target (it's based on the face hugger spell, featured here a few weeks ago). My ability already has target filters to prevent casting it on your own units... But it seems like 2 units, ordered to cast the spell on the same target at the same time, will both cast the spell anyway... Regardless of the target filters, the second caster always rides the target, even if you already ride it with the first caster (and consequently own the target already).
I just want to deny the use of the spell on a target already controlled, but it seems like if you order them both to do it far away from their target, the first one reaching the target will succeed, and the second one will cast the spell anyway if you don't order him to stop/hold manually... How to prevent this? Im not sure how to add a validator to an ability, and I'm not even sure it will prevent this from happening. Clue, anyone?
Do I need to upload a video to show what the problem is?
Here, this is how the ability behaves normally. It works in that case, just because I did not order 2 units at once to cast the spell:
In the following video, it does not work:
As you can see, ordering more than one unit to cast the spell leads to a giant mess where all casters disappear as if they mounted the worm. I want something to cancel the spell if any unit already started to cast it on that unit, to prevent many huge bugs with my triggers... I'm pretty sure it's easy to fix (with validators or whatever) but I already spent hours trying to figure it out (meaning I had to upload my map dozens of time) and I'm getting bored to see I'm doing it wrong, whatever I try...
You're only using target filter's on the ability itself? Maybe you should try checking the very effect (the one ability is linking to) that causes the controll effect and (from you videos i saw you apply behavior to the unit), you should easily be able to create validator for it (validator type - Unit Compare Behavior Count) then and add it to the effect.
Also, is your ability flagged for Best Unit? (or sth like that), if it is only one unit from selected will use the ability.
You're only using target filter's on the ability itself?
Yep.
Quote:
Maybe you should try checking the very effect (the one ability is linking to) that causes the controll effect and (from you videos i saw you apply behavior to the unit), you should easily be able to create validator for it (validator type - Unit Compare Behavior Count) then and add it to the effect.
I thought so too, that's the first thing I tried but it doesn't seem to work... I just tried putting the validator elsewhere right now (I wasn't sure if it needs to be in the "disable" or "remove" validation field), but it doesn't seem to work either. Maybe my validator itself is wrong though, I'm not sure anymore...
Quote:
Also, is your ability flagged for Best Unit? (or sth like that), if it is only one unit from selected will use the ability.
Yes, but it doesn't help much. There are 2 players using these units, so if Player 1 casts the spell on a worm while Player 2 does the same, the problem remains. Actually, if you order a unit to cast the spell and the target dodges it and flee (it happens a lot because the worm is very fast), you often end up sending multiple units against the target and a few of them may eventually cast the spell at the same time, even with the Best unit flag checked... I also have a fake AI which sends all the units on a target at the same time, so it happens very often that they cast the spell together (this is how I detected it could be done, to begin with).
Anyway, just in case it could help, here's how the ability is made:
First, a spell requiring a target... It applies a buff to the target (the negative buff you see on the worm in the video), and a buff to the rider (because the caster needs to be hidden and set to invulnerable)
The rider does not actually move on the head of the worm, it is faked via Model Additions. The caster is just hidden and left aside until something happens to the worm (ie. death, mostly)
I have a few triggers to make sure the caster unhides when the worm is either killed or captured, then it is moved where the worm just died (and a few other actions but it doesn't matter here)
The ownership of the worm is changed via triggers (couldn't find how to do it via data), I actually check whenever a worm receives the negative buff to change its owner
The "ride" ability is disabled for the casting player via trigger when he already controls a worm, and it is enabled again when he controls no worm
If I could think of a solution, it has to do with the ownership modification. I'm pretty sure it would be safer to do it via data instead of using triggers, but I haven't found a way... I did search in the forums, I checked the neural parasite ability too, but couldn't find anything of help so I decided to go for triggers.
If you want to change the owner of a unit which has a buff, find the behavior, and change the Behavior - Player + field and change it to Caster.
If you use a Modify Unit effect, just change Unit - Transfer Unit + to Caster and also put a check next to 'Owner' in Effect - Modification Flags field.
I thought so too, that's the first thing I tried but it doesn't seem to work... I just tried putting the validator elsewhere right now (I wasn't sure if it needs to be in the "disable" or "remove" validation field), but it doesn't seem to work either. Maybe my validator itself is wrong though, I'm not sure anymore...
From what I get you were trying to put validator on the behavior? (that's where disable and remove validation fields are).
Create validator based on Unit Compare Behavior Count with following values:
Validator - Behavior =TamedWorm (behavior on worms here)
Validator - Compare =Equal To
Validator - Failure Result =Must target unit
Validator - Ignore While Channeling =0
Validator - Other Unit - Effect =(None)
Validator - Other Unit - Value e_effectUnitUnknown
Validator - Result - Failure Error
Validator - Unit - Effect (None)
Validator - Unit - Value Target
Validator - Value 0
Then put that validator in the effect fired by Ability (i think that will be Set which applies behavior to both worm and zealot at the same time)
BorgDragon was right about the ownership and it worked perfectly... I already saw the field once or twice but didn't dare to modify it, because I thought you needed to add a "Player - Effect" to make it work.
Uiasdnmb, my bad... I forgot I had put my validator in the effect too, which was exactly done the way you describe. I played with the different validator fields a bit today, but whatever I tried never worked.
I found the solution however, by checking how the neural parasite ability is done. It seems like instead of checking for an effect on the target, it just checks for markers (I don't know what they are exactly but I assume it's something that defines whether a unit receives/sends a "cast" order or not). I replaced my custom validator by "No Markers" (the validator used in neural parasite) and it works perfectly. So... For anyone wishing to know, if you want to limit the use of a spell to one caster per target, use marker counts instead of behavior counts!
Problem solved! :)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
It's a bit complicated to explain but I'll give it a try... I have a validator or filters problem in one of my custom abilities... Basically it's a "ride unit" spell, which gives you the control of the targeted unit and lets the caster mount the target (it's based on the face hugger spell, featured here a few weeks ago). My ability already has target filters to prevent casting it on your own units... But it seems like 2 units, ordered to cast the spell on the same target at the same time, will both cast the spell anyway... Regardless of the target filters, the second caster always rides the target, even if you already ride it with the first caster (and consequently own the target already).
I just want to deny the use of the spell on a target already controlled, but it seems like if you order them both to do it far away from their target, the first one reaching the target will succeed, and the second one will cast the spell anyway if you don't order him to stop/hold manually... How to prevent this? Im not sure how to add a validator to an ability, and I'm not even sure it will prevent this from happening. Clue, anyone?
Do I need to upload a video to show what the problem is?
I uploaded videos to show the problem...
Here, this is how the ability behaves normally. It works in that case, just because I did not order 2 units at once to cast the spell:
In the following video, it does not work:
As you can see, ordering more than one unit to cast the spell leads to a giant mess where all casters disappear as if they mounted the worm. I want something to cancel the spell if any unit already started to cast it on that unit, to prevent many huge bugs with my triggers... I'm pretty sure it's easy to fix (with validators or whatever) but I already spent hours trying to figure it out (meaning I had to upload my map dozens of time) and I'm getting bored to see I'm doing it wrong, whatever I try...
You're only using target filter's on the ability itself? Maybe you should try checking the very effect (the one ability is linking to) that causes the controll effect and (from you videos i saw you apply behavior to the unit), you should easily be able to create validator for it (validator type - Unit Compare Behavior Count) then and add it to the effect.
Also, is your ability flagged for Best Unit? (or sth like that), if it is only one unit from selected will use the ability.
Yep.
I thought so too, that's the first thing I tried but it doesn't seem to work... I just tried putting the validator elsewhere right now (I wasn't sure if it needs to be in the "disable" or "remove" validation field), but it doesn't seem to work either. Maybe my validator itself is wrong though, I'm not sure anymore...
Yes, but it doesn't help much. There are 2 players using these units, so if Player 1 casts the spell on a worm while Player 2 does the same, the problem remains. Actually, if you order a unit to cast the spell and the target dodges it and flee (it happens a lot because the worm is very fast), you often end up sending multiple units against the target and a few of them may eventually cast the spell at the same time, even with the Best unit flag checked... I also have a fake AI which sends all the units on a target at the same time, so it happens very often that they cast the spell together (this is how I detected it could be done, to begin with).
Anyway, just in case it could help, here's how the ability is made:
If I could think of a solution, it has to do with the ownership modification. I'm pretty sure it would be safer to do it via data instead of using triggers, but I haven't found a way... I did search in the forums, I checked the neural parasite ability too, but couldn't find anything of help so I decided to go for triggers.
@ZealNaga: Go
If you want to change the owner of a unit which has a buff, find the behavior, and change the Behavior - Player + field and change it to Caster.
If you use a Modify Unit effect, just change Unit - Transfer Unit + to Caster and also put a check next to 'Owner' in Effect - Modification Flags field.
From what I get you were trying to put validator on the behavior? (that's where disable and remove validation fields are).
Create validator based on Unit Compare Behavior Count with following values:
Validator - Behavior =TamedWorm (behavior on worms here)
Validator - Compare =Equal To
Validator - Failure Result =Must target unit
Validator - Ignore While Channeling =0
Validator - Other Unit - Effect =(None)
Validator - Other Unit - Value e_effectUnitUnknown
Validator - Result - Failure Error
Validator - Unit - Effect (None)
Validator - Unit - Value Target
Validator - Value 0
Then put that validator in the effect fired by Ability (i think that will be Set which applies behavior to both worm and zealot at the same time)
Thank you both!
BorgDragon was right about the ownership and it worked perfectly... I already saw the field once or twice but didn't dare to modify it, because I thought you needed to add a "Player - Effect" to make it work.
Uiasdnmb, my bad... I forgot I had put my validator in the effect too, which was exactly done the way you describe. I played with the different validator fields a bit today, but whatever I tried never worked.
I found the solution however, by checking how the neural parasite ability is done. It seems like instead of checking for an effect on the target, it just checks for markers (I don't know what they are exactly but I assume it's something that defines whether a unit receives/sends a "cast" order or not). I replaced my custom validator by "No Markers" (the validator used in neural parasite) and it works perfectly. So... For anyone wishing to know, if you want to limit the use of a spell to one caster per target, use marker counts instead of behavior counts!
Problem solved! :)