I want to create an event that will detect when an enemy baneling enters the range of 4 of any marine, and order that marine to pull back. How to do this? I'm new to this. I found the event of Unit enters/leaves range of unit, but I don't know what to do from there. Can someone help me? thanks!
You would use that event in conjunction with some Comparison Conditions, but it would probably be simpler and much more efficient to make a behavior in the data editor.
thanks for the reply. Can you be more specific? I have never created any behavior before, or used any in conjunction with triggers. In fact, it's the first time I try to use the starcraft 2 editor. Can you explain more? Thanks
I dont really understand the behaviour approach but i kinda understand the trigger approach.
will have to make a event that is Unit - Any Unit(your baneling) Enters a distance of 4.0 from Unit(have to change this Unit to the marine/im unsure of how to do that without the marine being placed in the terrain GUI editor beforehand)
then action as give order to BLAH and change the order to move.
GL you will probs need more help since mine was missing a bit of info because yeee im not sure how to indentify ANY UNIT and change that into BANELING :S
That's pretty much where I'm stuck, too. Though I know how to identify any unit with baneling, in case you want to know, just compare type of triggering unit with baneling in conditons.
Triggers might not be the best solution here, since this event would trigger whenever any unit comes in range of any other unit. The number of events triggered would grow drastically, the more units are on the map.
Either limit the event to only register for banelings (would require custom script, you cannot add events dynamically in Gui), or use a data approach. Depending on what you actually want to achieve, it would be fairly simple to give banelings an autocastable ability, which has 4 range. You can even change the trigger event to register casting of this ability, if you want a trigger.
Triggers might not be the best solution here, since this event would trigger whenever any unit comes in range of any other unit. The number of events triggered would grow drastically, the more units are on the map.
Thats what I worry about, too, and I would be more than happy to take the data approach, but I don't know how. So basically what I want to do is to let units micro themselves on their own. And I'm starting with marines. So whenever a marine is NOT selected by its owner who is also a user player (not a computer), and it sees a baneling coming into its range (4), it would run away and should keeping running until all banelings in its range either died or left. If more than one baneling is in its range, than it should calculate the best angle first, then start running. If the baneling gets too close (range of 3) and the marine has stimpack and is not currently under the effect of stimpack, then it would use stimpack, mimicking what a real person would do when a baneling is heading your way. Can you or anybody show me how to do this? Thanks.
Well, I guess it is indeed possible using data. You want to create an autocastable ability, which has a range of 4. Add this to the marine.
The ability uses a validator to validate that the target is a baneling and another one to check, if the marine is selected (dunno if such a validator exists, but it should) and starts a persistent effect, which orders the marine to run in the opposite direction of the baneling and use stimpack, if it is not active (need another validator to check). Both the running and the stimpack activation can be done using issue order effects on the marine.
The angle calculation would be a problem, maybe.
If you still want a trigger, you could just use the ability cast as an event, might be better for the performance.
1. Because I want marines that belong to an ai player to be left alone, also when a human player selects a marine, I assume he wants to control the marine himself, so the selected marines should not move around on their own. If, by 4 or more, you are referring to the range, its because banelings have a splash distance of 2.X (can't remember the exact number), and they move faster than marines (especially on creep or after upgraded), so I want marines to start running when the distance between the marine and the baneling is 4 to have a head start.
2. Is behavior better or ability better? and how to create that behavior?
your trying to make an "ai" where marines flee from banelings right? just create a behaviors on the marine that periodically scans for nearby banelings and issues an order to move away from the baneling
you could then create a validator for if the unit is selected or not.... so it wont do it when the unit is selected...
or you can create a trigger that removed the behavior when the unit is selected and re-apply it when the unit is nolonger selected.
behaviors are better for things that are automatic ... becuase you dont have to create "abilties/buttons/set up command cards" an autocast abilty is basically interchangeable with a behaviors that periodically runs an aoe scan of sorts.
@SouLCarveRR: Go
2. Is behavior better or ability better? and how to create that behavior?
This is yet to be determined. I have no idea, how the game handles things internally. But in theory, an ability should have performance advantages. A behavior would use multiple effects periodically, even without banelings in range, while an ability with autocast would only use effects, when there is actually a baneling in range. However internally this would involve periodic checking anyway, so probably not that much of a difference. Also it might be possible to deactivate the behavior if no banelings are in range by using validators.
I want to create an event that will detect when an enemy baneling enters the range of 4 of any marine, and order that marine to pull back. How to do this? I'm new to this. I found the event of Unit enters/leaves range of unit, but I don't know what to do from there. Can someone help me? thanks!
@bignamethefucker: Go
You would use that event in conjunction with some Comparison Conditions, but it would probably be simpler and much more efficient to make a behavior in the data editor.
@Abion47: Go
thanks for the reply. Can you be more specific? I have never created any behavior before, or used any in conjunction with triggers. In fact, it's the first time I try to use the starcraft 2 editor. Can you explain more? Thanks
I dont really understand the behaviour approach but i kinda understand the trigger approach.
will have to make a event that is Unit - Any Unit(your baneling) Enters a distance of 4.0 from Unit(have to change this Unit to the marine/im unsure of how to do that without the marine being placed in the terrain GUI editor beforehand)
then action as give order to BLAH and change the order to move.
GL you will probs need more help since mine was missing a bit of info because yeee im not sure how to indentify ANY UNIT and change that into BANELING :S
@zeropoints: Go
That's pretty much where I'm stuck, too. Though I know how to identify any unit with baneling, in case you want to know, just compare type of triggering unit with baneling in conditons.
If you are using triggered events, then you should add a condition that compairs the unit type of the unit in range with the type baneling.
Triggers might not be the best solution here, since this event would trigger whenever any unit comes in range of any other unit. The number of events triggered would grow drastically, the more units are on the map.
Either limit the event to only register for banelings (would require custom script, you cannot add events dynamically in Gui), or use a data approach. Depending on what you actually want to achieve, it would be fairly simple to give banelings an autocastable ability, which has 4 range. You can even change the trigger event to register casting of this ability, if you want a trigger.
@Kueken531: Go
Thats what I worry about, too, and I would be more than happy to take the data approach, but I don't know how. So basically what I want to do is to let units micro themselves on their own. And I'm starting with marines. So whenever a marine is NOT selected by its owner who is also a user player (not a computer), and it sees a baneling coming into its range (4), it would run away and should keeping running until all banelings in its range either died or left. If more than one baneling is in its range, than it should calculate the best angle first, then start running. If the baneling gets too close (range of 3) and the marine has stimpack and is not currently under the effect of stimpack, then it would use stimpack, mimicking what a real person would do when a baneling is heading your way. Can you or anybody show me how to do this? Thanks.
Well, I guess it is indeed possible using data. You want to create an autocastable ability, which has a range of 4. Add this to the marine.
The ability uses a validator to validate that the target is a baneling and another one to check, if the marine is selected (dunno if such a validator exists, but it should) and starts a persistent effect, which orders the marine to run in the opposite direction of the baneling and use stimpack, if it is not active (need another validator to check). Both the running and the stimpack activation can be done using issue order effects on the marine.
The angle calculation would be a problem, maybe.
If you still want a trigger, you could just use the ability cast as an event, might be better for the performance.
@Kueken531: Go
Thanks for the help, I'll experiment a bit, see if I can create this ability. I might need more help.
@bignamethefucker: Go
@SouLCarveRR: Go
1. Because I want marines that belong to an ai player to be left alone, also when a human player selects a marine, I assume he wants to control the marine himself, so the selected marines should not move around on their own. If, by 4 or more, you are referring to the range, its because banelings have a splash distance of 2.X (can't remember the exact number), and they move faster than marines (especially on creep or after upgraded), so I want marines to start running when the distance between the marine and the baneling is 4 to have a head start.
2. Is behavior better or ability better? and how to create that behavior?
Thanks
@Kueken531: Go
Wouldn't you need a mover too?
@bignamethefucker: Go
umm.....
your trying to make an "ai" where marines flee from banelings right? just create a behaviors on the marine that periodically scans for nearby banelings and issues an order to move away from the baneling
you could then create a validator for if the unit is selected or not.... so it wont do it when the unit is selected...
or you can create a trigger that removed the behavior when the unit is selected and re-apply it when the unit is nolonger selected.
behaviors are better for things that are automatic ... becuase you dont have to create "abilties/buttons/set up command cards" an autocast abilty is basically interchangeable with a behaviors that periodically runs an aoe scan of sorts.
@SouLCarveRR: Go
Can you tell me more about the behavior? Like which type of behavior to use and which fields need to be edited, etc. Appreciate your help.
This is yet to be determined. I have no idea, how the game handles things internally. But in theory, an ability should have performance advantages. A behavior would use multiple effects periodically, even without banelings in range, while an ability with autocast would only use effects, when there is actually a baneling in range. However internally this would involve periodic checking anyway, so probably not that much of a difference. Also it might be possible to deactivate the behavior if no banelings are in range by using validators.
No, why? and for what? We would just order the marine to step away and use stimpacks.
behavior ... type: buff.... you want to set it to periodically do an effect.....
if you dont understand ... the whole effects stuff....
then i suggest you start with something maybe a bit simplier... such as making some AOE spells or something... it gets pretty complicated....
@SouLCarveRR: Go
I guess I should. Well, thanks for the help.