What I want: When a unit is created via a trigger I want him to walk directly left towards a point and only attack what is "directly" in front of him. These spawned units only take up a 1x1 square. I also want him to ignore enemy units that are not directly in front of the 10x1 lane in which he is walking. Is there a way to do this?
The only thing I can relate this to is Plants vs. Zombies. The spawned zombies didn't go up or down they just walked in a straight line and only ate the plants that were directly in front of them. I want a system similar to this.
I have no idea where to even start. I searched the boards extensively for something like this and could not find anything pertaining to it. Please help
This would require a lot of work... I could do it but it would litterally take me hours apon hours to work out all the kinks. Units in the game really arnt meant to behave this way so yeah.
I suggest you come up with an idea that you have a better grasp of.
Rollback Post to RevisionRollBack
Skype
KageNinpo = SN
My Libraries
DialogLeaderboard & TeamSort
My Projects
SPACEWAR Tribute
Infinite TD
maybe set a Unit PAthing ( using the data editor ) with strait lines going from 1 side to an other , problem with that doh is all the untis will follow the set line where they spawn
maybe set a Unit PAthing ( using the data editor ) with strait lines
going from 1 side to an other , problem with that doh is all the untis
will follow the set line where they spawn
This doesnt take into account that he doesnt want the units to attack anything other then what is directly in thier path. That and I have no idea what you talking about setting unit pathing using the data editor. Care to elaborate?
Ya I'm not sure what unit pathing you are referring to in Data Editor.
BTW, here is where I'm at currently. I sort of have it working, but needs some improvement.
Trigger picking each unit owned by player 15 on the map and ordering them to attack targeting a point. the point is a polar offset from the picked unit moving directly 180degrees it looks like this:
It might not be as hard as you think... If your goal is to do a gameplay really similar to PvZ (units following a lane in order to reach a point, and destroying anything on its path), instead of making the spawned unit to attack you should make it MOVE toward a point. While moving it will ignore the combat behavior. When it comes in range of a unit, you just have to replace the existing order to "attack", then tell him to wait until his target is dead before continuing to move towards the point again. It will LOOK like the unit is rushing towards the unit, but in fact his true goal is the point behind. So when someone is on his way, he starts attacking then continue his way towards his true goal. It can be done quite easily:
-spawn the unit, give it the order to move towards a point
-wait for condition "distance between position of the spawned unit and position of "anyone blocking him" <= 2" (2 should be enough, obviously you'll need to test it and change it acordingly)
-give order to attack "anyone blocking him"
-wait until "anyone blocking him" is dead
-issue order to move towards point
-rinse and repeat
It's only theorical and a bit tricky, but it's possible with only a few triggers. I did something similar in my current project (basically I spawn a unit, order it to go towards a point, and it only attacks anyone in its path... when the unit reaches its goal it is teleported back to where it comes from, and it repeats the process until dead). Might not even require more than one trigger...
If you could be so kind as to post your trigger up for doing this? I understand the logic and what you are saying, but I'm having a difficult time organizing a trigger and how it would look with your trigger steps mentioned in your last post. Such as, "-wait for condition "distance between position of the spaned unit and position of "anyone blocking" him<=2" and "wait until "anyone blocking him" is dead
I'm not sure how to set those up in the trigger editor.
Ok I have the first step done where the "created unit" is ordered to move to the directed position. I'm hung up on the "wait for condition" part. I setup the condition as distance between two points and my first point is obviously the "created unit" but I'm not sure what I need to be putting in the 2nd point. I was looking for something like hostile unit or enemy unit but I can't find anything. And as you said "blocking unit" I have no idea what that is in the trigger editor.
I tried to adapt my method to something with 3 lanes, and 2 units blocking the way in each of these lanes... It's hard as hell to figure when and where there is a unit in the path, and what to do with which unit from the attacking player... Too many parameters to consider means the method is not the best we can find. I don't think the triggers on my project will be of any help here, since your problem is of an higher level.
Actually, on second though, the trigger you showed earlier can do the trick on its own... It orders them to attack, just order them to move instead so they will no longer aim at units in other lanes (let's hope so, at least). Then, add a condition that will only give the "move" order to IDLE units (I know this can be done somehow, I'll check later and tell you if I remember how... but this might actually be the key to the whole thing). Basically you don't want to move the units which are already attacking something or moving towards their target, so you wait for them to be idle before ordering them to move again. Decreasing the wait between each periodic execution of the trigger improves its efficiency (it prevents idle units from attacking something in the next lane while waiting to be given the move order again).
Create another trigger which periodically check that a unit owned by the ATTACKING_PLAYER comes close to the DEFENDING_PLAYER (this is where the "distance between points" comes into play). When the condition is met, order the unit owned by ATTACKING_PLAYER to attack the closest unit owned by DEFENDING_PLAYER...The attacker should normally attack the unit in its path, kill it, then it will become idle. The first trigger will then give the order to, once again, move along the path until there is another defending unit coming in range.
Sorry about only throwing ideas without actually illustrating them, but it takes time to make the triggers work and I'm actually kind of busy with a few projects already (AND it's late now... I need to sleep... sometimes...). I'll try to take some time later to actually create the triggers and share them. By the way, you may need to paint the terrain with the "no pathing" tool to prevent units from moving between lanes.
Why use triggers at all? Just make the unit incapable of turning (go to Unit - Flags and uncheck Turnable) and limit the "Stats - Arc" on his weapon to 2 - 8 degrees or some other low number; it depends on his attack range. It will not be able to attack any other units but the units right in front of him (because it can't turn towards them) so you can just attack move them. Sorry for not making it a page long essay; but I figure it's easier to understand this way. :)
Sorry for not making it a page long essay; but I figure it's easier to understand this way. :)
Understanding the Data editor is NEVER easy. :D
Good point though. I personally tend to avoid Data editing as much as possible, since it's a real mystery to me and I don't understand half of what I'm doing when modifying data... I assumed triggers were easier, but it obviously isn't true when trying to do something like PvZ...
Understanding the Data editor is NEVER easy. :D
Good point though. I personally tend to avoid Data editing as much as possible, since it's a real mystery to me and I don't understand half of what I'm doing when modifying data... I assumed triggers were easier, but it obviously isn't true when trying to do something like PvZ...
Yea I found it really hard to use as well when I switched over from WC3 (where you did everything in triggers); but it's really good and you can do a lot in it, it generally operates faster than triggers as well. Definitely worth learning.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
What I want: When a unit is created via a trigger I want him to walk directly left towards a point and only attack what is "directly" in front of him. These spawned units only take up a 1x1 square. I also want him to ignore enemy units that are not directly in front of the 10x1 lane in which he is walking. Is there a way to do this?
The only thing I can relate this to is Plants vs. Zombies. The spawned zombies didn't go up or down they just walked in a straight line and only ate the plants that were directly in front of them. I want a system similar to this.
I have no idea where to even start. I searched the boards extensively for something like this and could not find anything pertaining to it. Please help
Thank you
This would require a lot of work... I could do it but it would litterally take me hours apon hours to work out all the kinks. Units in the game really arnt meant to behave this way so yeah.
I suggest you come up with an idea that you have a better grasp of.
maybe set a Unit PAthing ( using the data editor ) with strait lines going from 1 side to an other , problem with that doh is all the untis will follow the set line where they spawn
This doesnt take into account that he doesnt want the units to attack anything other then what is directly in thier path. That and I have no idea what you talking about setting unit pathing using the data editor. Care to elaborate?
Ya I'm not sure what unit pathing you are referring to in Data Editor.
BTW, here is where I'm at currently. I sort of have it working, but needs some improvement.
Trigger picking each unit owned by player 15 on the map and ordering them to attack targeting a point. the point is a polar offset from the picked unit moving directly 180degrees it looks like this:
It might not be as hard as you think... If your goal is to do a gameplay really similar to PvZ (units following a lane in order to reach a point, and destroying anything on its path), instead of making the spawned unit to attack you should make it MOVE toward a point. While moving it will ignore the combat behavior. When it comes in range of a unit, you just have to replace the existing order to "attack", then tell him to wait until his target is dead before continuing to move towards the point again. It will LOOK like the unit is rushing towards the unit, but in fact his true goal is the point behind. So when someone is on his way, he starts attacking then continue his way towards his true goal. It can be done quite easily:
-spawn the unit, give it the order to move towards a point
-wait for condition "distance between position of the spawned unit and position of "anyone blocking him" <= 2" (2 should be enough, obviously you'll need to test it and change it acordingly)
-give order to attack "anyone blocking him"
-wait until "anyone blocking him" is dead
-issue order to move towards point
-rinse and repeat
It's only theorical and a bit tricky, but it's possible with only a few triggers. I did something similar in my current project (basically I spawn a unit, order it to go towards a point, and it only attacks anyone in its path... when the unit reaches its goal it is teleported back to where it comes from, and it repeats the process until dead). Might not even require more than one trigger...
@ZealNaga: Go
ZealNaga
If you could be so kind as to post your trigger up for doing this? I understand the logic and what you are saying, but I'm having a difficult time organizing a trigger and how it would look with your trigger steps mentioned in your last post. Such as, "-wait for condition "distance between position of the spaned unit and position of "anyone blocking" him<=2" and "wait until "anyone blocking him" is dead
I'm not sure how to set those up in the trigger editor.
Thank you
Ok I have the first step done where the "created unit" is ordered to move to the directed position. I'm hung up on the "wait for condition" part. I setup the condition as distance between two points and my first point is obviously the "created unit" but I'm not sure what I need to be putting in the 2nd point. I was looking for something like hostile unit or enemy unit but I can't find anything. And as you said "blocking unit" I have no idea what that is in the trigger editor.
Please let me know
I tried to adapt my method to something with 3 lanes, and 2 units blocking the way in each of these lanes... It's hard as hell to figure when and where there is a unit in the path, and what to do with which unit from the attacking player... Too many parameters to consider means the method is not the best we can find. I don't think the triggers on my project will be of any help here, since your problem is of an higher level.
Actually, on second though, the trigger you showed earlier can do the trick on its own... It orders them to attack, just order them to move instead so they will no longer aim at units in other lanes (let's hope so, at least). Then, add a condition that will only give the "move" order to IDLE units (I know this can be done somehow, I'll check later and tell you if I remember how... but this might actually be the key to the whole thing). Basically you don't want to move the units which are already attacking something or moving towards their target, so you wait for them to be idle before ordering them to move again. Decreasing the wait between each periodic execution of the trigger improves its efficiency (it prevents idle units from attacking something in the next lane while waiting to be given the move order again).
Create another trigger which periodically check that a unit owned by the ATTACKING_PLAYER comes close to the DEFENDING_PLAYER (this is where the "distance between points" comes into play). When the condition is met, order the unit owned by ATTACKING_PLAYER to attack the closest unit owned by DEFENDING_PLAYER...The attacker should normally attack the unit in its path, kill it, then it will become idle. The first trigger will then give the order to, once again, move along the path until there is another defending unit coming in range.
Sorry about only throwing ideas without actually illustrating them, but it takes time to make the triggers work and I'm actually kind of busy with a few projects already (AND it's late now... I need to sleep... sometimes...). I'll try to take some time later to actually create the triggers and share them. By the way, you may need to paint the terrain with the "no pathing" tool to prevent units from moving between lanes.
@SouLCarveRR: Go
was talking about regular pathing , ( in the terrain part i mean ) and for the attacks , minized range so they cant hit outside the path
but seems thes guy have a better solution
Why use triggers at all? Just make the unit incapable of turning (go to Unit - Flags and uncheck Turnable) and limit the "Stats - Arc" on his weapon to 2 - 8 degrees or some other low number; it depends on his attack range. It will not be able to attack any other units but the units right in front of him (because it can't turn towards them) so you can just attack move them. Sorry for not making it a page long essay; but I figure it's easier to understand this way. :)
Understanding the Data editor is NEVER easy. :D
Good point though. I personally tend to avoid Data editing as much as possible, since it's a real mystery to me and I don't understand half of what I'm doing when modifying data... I assumed triggers were easier, but it obviously isn't true when trying to do something like PvZ...
Yea I found it really hard to use as well when I switched over from WC3 (where you did everything in triggers); but it's really good and you can do a lot in it, it generally operates faster than triggers as well. Definitely worth learning.