Hi, I have a unit type which I want to order to use a "custom" ability I made (Which targets "Player 0 Neutral" units only), it is a target unit ability.
I wanted to do this through behaviors which launched an effect of type "Issue Order" which orders the caster (Unit with the behavior) to look for nearby valid targets and to use this custom ability on the first one it finds. After 5 hours of no luck I'd like to ask for help on HOW EXACTLY can I make this work.
Can't you just use the built-in autocast system? Set the autocast filter to Neutral only, or if there are other neutral players on the map use the autocast validator field (all on the ability itself)
If autocast doesn't work use a standard aura setup (Behavior/Persistent Effect -> Search effect -> Issue order), the Issue Order should order the Caster Unit to cast the ability at the Target unit of the search.
I'd rather avoid getting super complex validators.
There can be more than 1 player 0? (Neutral player)
I have no idea how effects work (The fields in persistent, search and issue order are too vague and don't seem to have anything to do with each other), all the combinations I tried didn't seem to make the unit do anything (Plus I can;t find a tutorial which properly explains how things work).
I think you would need to order him to target something; assuming there is a target. I also think "source unit" as opposed to "Caster" may be a better choice; not positive though. They both may work.
To cast an ability on a unit; I think you would need a search effect to find the target unit; then that search would trigger the "issue order" command; ordering the "source unit" to cast "Ability A" on "target unit"
I Used a search effect which looks for 1 unit (Using a validator in the search effect to make sure it targets the correct unit type), the search effect launches the Issue Order to use ability effect (Issues order to source unit to use "Custom Ability" on "Target Unit" of "Search Area" effect).
If your requirement is just to auto-target neutral units, the auto-cast suggested by @Photoloss would be the way to go, and definitely the simplest. If you could elaborate on what exactly are you trying to do and what are your requirements, I am sure I could help with that.
If your requirement is just to auto-target neutral units, the auto-cast suggested by @Photoloss would be the way to go, and definitely the simplest. If you could elaborate on what exactly are you trying to do and what are your requirements, I am sure I could help with that.
I'll try to be as specific as possible :3
The Unit I want to give the order has the "Eat Food" ability.
The "Eat Food" ability is a targeted ability which can only target "Neutral" Units (Player 0) which have the "worker" flag (All "Food" units have this flag exclusively so that units won't try to eat neutral units that are not "Food", such as rocks).
The "Eat Food" ability is a melee range spell. When the ability targets a "Food" unit, it applies a buff type behavior to the caster (The "Currently Eating" behavior). The "Currently Eating" behavior lasts 2 seconds and disables the unit's Move and Attack abilities while active.
I have one trigger that detects when a unit literally "casts" the "Eat" ability, detects what unit type the target is, converts the ability's target to the player's team immediately (To avoid having more than one unit eat from the same "Food" unit), and after two seconds removes the ability's target from the game and modify's a variable (Adding Score Points).
The ability is a dummy spell that needs a target but only disables the monster while my "Eat" trigger does everything else.
What I want to achieve: I want to have the ability start with autocast off with the option to toggle it on (This is already done and functioning) (Human players and "Neutral" use this ability).
The reason why I want the auto-cast initially off is because units cannot attack while eating and might confuse the player if they act on their own without the player fully learning it is an autocast which can be toggled off (The "Eat Food" spell can be used by autocasting, targeting manually or right clicking (Smart Cast).
if autocast already works and you only need a buff for tutorial reasons i would use a trigger to issue the order instead of having a periodic buff. or even just toogle autocast on and tell something like hey you are eating, congrats.
btw instead of changing the owner you could add a buff to the target unit to avoid 2 players eat from the same unit and also remove the unit with an effect.
If you are using a validator for unit type in the search area effect it will most likely be validating the caster. Try using the search area effect filter field instead (only neutral, requiring worker).
If you are using a validator for unit type in the search area effect it will most likely be validating the caster. Try using the search area effect filter field instead (only neutral, requiring worker).
I second this.
No need for a validator when you can alter the search field on the "search" effect. I use a similar setup to issue a unit to "move" during a charge ability , offsetting himself in his facing direction. Def. will work properly for you.
I also think you can use an effect to change the owner of the unit as well; rather than a trigger.
I guess I could experiment in using data to avoid double eating, but as you can see I am all thumbs when working with data. I will not do so until I fix my current problem using data. (Data editor keeps convincing me that I shouldn't use it)
if autocast already works and you only need a buff for tutorial reasons i would use a trigger to issue the order instead of having a periodic buff. or even just toogle autocast on and tell something like hey you are eating, congrats.
btw instead of changing the owner you could add a buff to the target unit to avoid 2 players eat from the same unit and also remove the unit with an effect.
I need the ability for an AI controlled monster which players don't control, so using triggers would consume too much power (I heard that I should use data for events that happen super often). I'll try your second suggestion as soon as I can manage to order nonplayer units to eat.
If you are using a validator for unit type in the search area effect it will most likely be validating the caster. Try using the search area effect filter field instead (only neutral, requiring worker).
I did as you said and removed the validator as well as indicating neutral workers in the search field. But it still doesn't work XD (Data is so much harder than triggers, I wish it worked like triggers where functions make sense).
After a quick test, it seems a persistent is need in the effect chain to issue targeted orders, that's likely the reason your behavior doesn't work.
I'd suggest you use auto-casting for the ability. Would be much more elegant. Just use the ability auto-cast validators, filter and range to find the units you want to target.
I attached a quick test map for an eat ability with two types of eating; behavior based with a hidden ability and auto-castable ability. As you can see, the auto-castable ability is a much cleaner approach.
i dont get it, autocast works but you don't want to use it for no reason. just turn it on for your neutral units and you have no problem.
there is no persistant needed for order effect. it's only needed if the target is a point and not a unit.
The reason I don't use autocasting is because I want autocasting to be initially off for players, are you saying it is possible to toggle on/off autocasting for specific players? (I have no idea how to do that) Another weakness of using autocast is that I INTENTIONALLY have set the auto-cast radius to a small 2.5 unit distance (So players have to do some work in commanding their monsters, and so the monsters don't wander off too far), and I'd like the AI controlled units to be able to detect food from a longer distance.
By the way, I downloaded April's map and after 8 iterations (Demo was superb, its just me being dumb/slow), I managed to duplicate it using a persistent effect middleman, and the little runts are feasting like rats (That's a good thing). Thanks Aptril.
Would be much more elegant. Just use the ability auto-cast validators, filter and range to find the units you want to target.
What do you mean by elegant? Is it because it is an easier method (Can't argue with that) or because it consumes more power and would contribute to lag?
@april9: Go
i dont get it, autocast works but you don't want to use it for no reason. just turn it on for your neutral units and you have no problem. there is no persistant needed for order effect. it's only needed if the target is a point and not a unit.
I don't want to risk screwing up the setup I have right now (Using persistent effect as April suggested). Especially because I have no idea how to link Source/Target units and the other fields if there were no persistent effect in the chain. Maybe you could make April's demo cleaner (Not that I need another demo, I don't mind using the persistent effect).
Also, also, also, also, I am interested in this suggestion by Glorn, is it possible?
@april9: Go
I also think you can use an effect to change the owner of the unit as well; rather than a trigger.
I was thinking of maybe creating a Behavior for the "Food" which changes ownership and removes it after 2 seconds. Or maybe I could add an additional effect to my "Eat" ability which changes ownership of the target.
Problem is I can't find an effect which can change a unit's ownership or alter any of its flags (Like turn off that individual unit's "worker" flag which is one of the requirements for the "Eat" ability to target it).
yes you can toogle autocast on/off with triggers and you can increase the range for neutral player by using catalog triggers to increase the range.
persistant effects are as the name says persistant and therefore contribute to lag if there are many persistant effects around at the same time.
add a validator to the first effect of the ability(which is a set effect if you add a buff) that validates the target unit for your buff and there will be no unit targeted twice. the buff lasts 2 seconds and as final effect of the buff the unit gets killed.
Hi, I have a unit type which I want to order to use a "custom" ability I made (Which targets "Player 0 Neutral" units only), it is a target unit ability.
I wanted to do this through behaviors which launched an effect of type "Issue Order" which orders the caster (Unit with the behavior) to look for nearby valid targets and to use this custom ability on the first one it finds. After 5 hours of no luck I'd like to ask for help on HOW EXACTLY can I make this work.
Can't you just use the built-in autocast system? Set the autocast filter to Neutral only, or if there are other neutral players on the map use the autocast validator field (all on the ability itself)
If autocast doesn't work use a standard aura setup (Behavior/Persistent Effect -> Search effect -> Issue order), the Issue Order should order the Caster Unit to cast the ability at the Target unit of the search.
I'd rather avoid getting super complex validators.
There can be more than 1 player 0? (Neutral player)
I have no idea how effects work (The fields in persistent, search and issue order are too vague and don't seem to have anything to do with each other), all the combinations I tried didn't seem to make the unit do anything (Plus I can;t find a tutorial which properly explains how things work).
I think you would need to order him to target something; assuming there is a target. I also think "source unit" as opposed to "Caster" may be a better choice; not positive though. They both may work.
To cast an ability on a unit; I think you would need a search effect to find the target unit; then that search would trigger the "issue order" command; ordering the "source unit" to cast "Ability A" on "target unit"
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
I Used a search effect which looks for 1 unit (Using a validator in the search effect to make sure it targets the correct unit type), the search effect launches the Issue Order to use ability effect (Issues order to source unit to use "Custom Ability" on "Target Unit" of "Search Area" effect).
It didn't work.
@wisesquirrel: Go
If your requirement is just to auto-target neutral units, the auto-cast suggested by @Photoloss would be the way to go, and definitely the simplest. If you could elaborate on what exactly are you trying to do and what are your requirements, I am sure I could help with that.
I'll try to be as specific as possible :3
The Unit I want to give the order has the "Eat Food" ability.
The "Eat Food" ability is a targeted ability which can only target "Neutral" Units (Player 0) which have the "worker" flag (All "Food" units have this flag exclusively so that units won't try to eat neutral units that are not "Food", such as rocks).
The "Eat Food" ability is a melee range spell. When the ability targets a "Food" unit, it applies a buff type behavior to the caster (The "Currently Eating" behavior). The "Currently Eating" behavior lasts 2 seconds and disables the unit's Move and Attack abilities while active.
I have one trigger that detects when a unit literally "casts" the "Eat" ability, detects what unit type the target is, converts the ability's target to the player's team immediately (To avoid having more than one unit eat from the same "Food" unit), and after two seconds removes the ability's target from the game and modify's a variable (Adding Score Points).
The ability is a dummy spell that needs a target but only disables the monster while my "Eat" trigger does everything else.
What I want to achieve: I want to have the ability start with autocast off with the option to toggle it on (This is already done and functioning) (Human players and "Neutral" use this ability).
The reason why I want the auto-cast initially off is because units cannot attack while eating and might confuse the player if they act on their own without the player fully learning it is an autocast which can be toggled off (The "Eat Food" spell can be used by autocasting, targeting manually or right clicking (Smart Cast).
if autocast already works and you only need a buff for tutorial reasons i would use a trigger to issue the order instead of having a periodic buff. or even just toogle autocast on and tell something like hey you are eating, congrats.
btw instead of changing the owner you could add a buff to the target unit to avoid 2 players eat from the same unit and also remove the unit with an effect.
Hi wisesquirrel,
If you are using a validator for unit type in the search area effect it will most likely be validating the caster. Try using the search area effect filter field instead (only neutral, requiring worker).
I second this.
No need for a validator when you can alter the search field on the "search" effect. I use a similar setup to issue a unit to "move" during a charge ability , offsetting himself in his facing direction. Def. will work properly for you.
I also think you can use an effect to change the owner of the unit as well; rather than a trigger.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
I guess I could experiment in using data to avoid double eating, but as you can see I am all thumbs when working with data. I will not do so until I fix my current problem using data. (Data editor keeps convincing me that I shouldn't use it)
I need the ability for an AI controlled monster which players don't control, so using triggers would consume too much power (I heard that I should use data for events that happen super often). I'll try your second suggestion as soon as I can manage to order nonplayer units to eat.
I did as you said and removed the validator as well as indicating neutral workers in the search field. But it still doesn't work XD (Data is so much harder than triggers, I wish it worked like triggers where functions make sense).
After a quick test, it seems a persistent is need in the effect chain to issue targeted orders, that's likely the reason your behavior doesn't work. I'd suggest you use auto-casting for the ability. Would be much more elegant. Just use the ability auto-cast validators, filter and range to find the units you want to target.
I attached a quick test map for an eat ability with two types of eating; behavior based with a hidden ability and auto-castable ability. As you can see, the auto-castable ability is a much cleaner approach.
@april9: Go
i dont get it, autocast works but you don't want to use it for no reason. just turn it on for your neutral units and you have no problem. there is no persistant needed for order effect. it's only needed if the target is a point and not a unit.
The reason I don't use autocasting is because I want autocasting to be initially off for players, are you saying it is possible to toggle on/off autocasting for specific players? (I have no idea how to do that) Another weakness of using autocast is that I INTENTIONALLY have set the auto-cast radius to a small 2.5 unit distance (So players have to do some work in commanding their monsters, and so the monsters don't wander off too far), and I'd like the AI controlled units to be able to detect food from a longer distance.
By the way, I downloaded April's map and after 8 iterations (Demo was superb, its just me being dumb/slow), I managed to duplicate it using a persistent effect middleman, and the little runts are feasting like rats (That's a good thing). Thanks Aptril.
What do you mean by elegant? Is it because it is an easier method (Can't argue with that) or because it consumes more power and would contribute to lag?
I don't want to risk screwing up the setup I have right now (Using persistent effect as April suggested). Especially because I have no idea how to link Source/Target units and the other fields if there were no persistent effect in the chain. Maybe you could make April's demo cleaner (Not that I need another demo, I don't mind using the persistent effect).
Also, also, also, also, I am interested in this suggestion by Glorn, is it possible?
I was thinking of maybe creating a Behavior for the "Food" which changes ownership and removes it after 2 seconds. Or maybe I could add an additional effect to my "Eat" ability which changes ownership of the target.
Problem is I can't find an effect which can change a unit's ownership or alter any of its flags (Like turn off that individual unit's "worker" flag which is one of the requirements for the "Eat" ability to target it).
@wisesquirrel: Go
yes you can toogle autocast on/off with triggers and you can increase the range for neutral player by using catalog triggers to increase the range.
persistant effects are as the name says persistant and therefore contribute to lag if there are many persistant effects around at the same time.
add a validator to the first effect of the ability(which is a set effect if you add a buff) that validates the target unit for your buff and there will be no unit targeted twice. the buff lasts 2 seconds and as final effect of the buff the unit gets killed.