• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Second map sys +rep

Status
Not open for further replies.
Level 12
Joined
Dec 17, 2009
Messages
951
in my second map 'plants vs zombies:

Zombies spawn - Zombies walk down their lane - You kill sombies by constructing towers and walls that will stop them from destroying your farm.
pvzh.png

This is my first REAL project and everything have worked out fine... until now.
Problem:
I want my towers to only attack the zombies on their own lane.
pvz2.png

At the moment, towers do attack closest zombie and dosen't care if it is on its own lane or not.
I can't solve this problem on my own, so i ask you for help. Do you have a tip or a solution?
This is the problem:
pvzcurrent.png

And this is what i need help with to accomplish my vision:
pvzhelp.png


If you guys can help me i will give +rep and special thanks
ty.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Why don't you create lanes that each of it is separated by walls/cliffs/doodads ?
attachment.php

Separate them up by doodads
OR, you could separate them with cliffs, it'd be better
 

Attachments

  • Lane.jpg
    Lane.jpg
    151 KB · Views: 114
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240
You could trigger it by comparing the angle and the distance from attacker to target. That way you could plot the edges of the lane in a way. Very much possible.

However here's a bit more simple solution:


  • Stop Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Guard Tower
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Region 003 <gen> contains (Triggering unit)) Equal to True
                  • (Region 003 <gen> contains (Attacking unit)) Equal to True
              • And - All (Conditions) are true
                • Conditions
                  • (Region 004 <gen> contains (Triggering unit)) Equal to True
                  • (Region 004 <gen> contains (Attacking unit)) Equal to True
        • Then - Actions
        • Else - Actions
          • Unit - Order (Attacking unit) to Stop
          • Game - Display to Player Group - Player 1 (Red) the text: Stop


It only works well if the lanes are horizontal or vertical, since regions can then cover the lane in a better way.

There might be another ways too, I'm trying to think this problem further.

@defskull
Please crop and/or put the image in hidden tags.
 

Attachments

  • TD_Attack_System.w3x
    19.5 KB · Views: 35
Level 33
Joined
Mar 27, 2008
Messages
8,035
You could trigger it by comparing the angle and the distance from attacker to target. That way you could plot the edges of the lane in a way. Very much possible.

However here's a bit more simple solution:


  • Stop Attack
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Guard Tower
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Region 003 <gen> contains (Triggering unit)) Equal to True
                  • (Region 003 <gen> contains (Attacking unit)) Equal to True
              • And - All (Conditions) are true
                • Conditions
                  • (Region 004 <gen> contains (Triggering unit)) Equal to True
                  • (Region 004 <gen> contains (Attacking unit)) Equal to True
        • Then - Actions
        • Else - Actions
          • Unit - Order (Attacking unit) to Stop
          • Game - Display to Player Group - Player 1 (Red) the text: Stop


It only works well if the lanes are horizontal or vertical, since regions can then cover the lane in a better way.

There might be another ways too, I'm trying to think this problem further.

@defskull
Please crop and/or put the image in hidden tags.

Done
And I know it HAS to do with Stop order through trigger, LOL + Regions covered, pretty much same as my prevent attack region trigger from the recent thread
 
Status
Not open for further replies.
Top