Author Topic: Make towers attack monsters, not players?  (Read 4576 times)

Vaderman24

  • Posts: 6
  • Tower Destroyer
    • View Profile
Make towers attack monsters, not players?
« on: December 31, 2014, 07:50:48 PM »
I've come across a discussion while browsing through the forums saying can make towers attack monsters and not harm players. I've been messing around with the idea but haven't been able to solve the problem on how to do it. My main concern is, is it even possible to make such a tower? Maybe by editing the xml file of a tower, using scripts to change it's behavior, or making a custom tower that's player friendly. Is someone could inform me of a solution, or if it's even possible, I would be most appreciative :)
« Last Edit: January 02, 2015, 11:06:35 PM by Vaderman24 »

Hipshot

  • Developer
  • Posts: 455
  • Level Designer
    • View Profile
Re: Make towers attack monsters, not players?
« Reply #1 on: January 05, 2015, 09:45:25 AM »
Yes, you can create such a tower, you can't specify the tower to aim at monsters, but you can change the projectiles to damage only monsters. If the behavior is behavior="neutral" or behavior="penetrating" then you can change the target by changing the category in the behavior section, like this example of the large boulder inside the temple, in the desert campaign:

Code: XML
  1. <projectile directions="1" collision="13" damage="1000" speed="1.5" behavior="penetrating" hit-sound="sound/misc.xml:info_boulder">
  2.        
  3.         <behavior>
  4.                 <dictionary>
  5.                         <entry name="category-override"><string>None</string></entry>  
  6.                         <entry name="range"><float>1000</float></entry>                
  7.                         <entry name="penetration"><int>100</int></entry>
  8.                         <entry name="dmg-mul"><float>1</float></entry>                 
  9.                 </dictionary>
  10.         </behavior>    

You can change the category from None (means target all) to Player (avoids players) or Enemy (avoids monsters)

Vaderman24

  • Posts: 6
  • Tower Destroyer
    • View Profile
Re: Make towers attack monsters, not players?
« Reply #2 on: January 06, 2015, 04:15:26 AM »
Yes, you can create such a tower, you can't specify the tower to aim at monsters, but you can change the projectiles to damage only monsters.
Ah, is's a shame you can't do that, it would really open up more possibility's for what I am working on.
Code: XML
  1. <projectile directions="1" collision="13" damage="1000" speed="1.5" behavior="penetrating" hit-sound="sound/misc.xml:info_boulder">
  2.        
  3.         <behavior>
  4.                 <dictionary>
  5.                         <entry name="category-override"><string>None</string></entry>  
  6.                         <entry name="range"><float>1000</float></entry>                
  7.                         <entry name="penetration"><int>100</int></entry>
  8.                         <entry name="dmg-mul"><float>1</float></entry>                 
  9.                 </dictionary>
  10.         </behavior>    

You can change the category from None (means target all) to Player (avoids players) or Enemy (avoids monsters)
I came across this in another post somewhere and added the override to projectiles I didn't what the player to be hurt by, thanks for the additional information :D