Jump to content

(Secondary) attack types (https://code.wildfiregames.com/D368)


Recommended Posts

Hi! If it is of any interest, i've found that if you copy the <melee> attack of a spearman.xml and add it to a javelineer.xml file it will show on the ui, but the javelineer will still only use it's ranged attack. However, if you change the <PreferredClasses datatype="tokens"> of that <melee> attack from "Human" to "Structure", when you order those Javelineers to attack a structure, they will use the melee attack instead of the ranged one. I even changed the damage of the melee attack to something stupid like 250 Hack just to be sure that it wasn't using the damage values of the ranged attack.

I might be wrong, but this small experiment leads me to believe that it might be possible to implement the secondary attack mechanic by making use of this preference thing.

Also, i found in the component Attack.js a GetBestAttackAgainst function (lines 343 to 378), that draws a distinction between Slaughter, Capture and other forms of attack. I don't know if this function is used or not since i haven't found another reference to it, but it might be possible to add more distinctions to it (maybe even one based on distance between units and stuff).

I don't know if this will help but, who knows?

Link to comment
Share on other sites

6 hours ago, Micfild said:

Hi! If it is of any interest, i've found that if you copy the <melee> attack of a spearman.xml and add it to a javelineer.xml file it will show on the ui, but the javelineer will still only use it's ranged attack. However, if you change the <PreferredClasses datatype="tokens"> of that <melee> attack from "Human" to "Structure", when you order those Javelineers to attack a structure, they will use the melee attack instead of the ranged one. I even changed the damage of the melee attack to something stupid like 250 Hack just to be sure that it wasn't using the damage values of the ranged attack.

I might be wrong, but this small experiment leads me to believe that it might be possible to implement the secondary attack mechanic by making use of this preference thing.

Also, i found in the component Attack.js a GetBestAttackAgainst function (lines 343 to 378), that draws a distinction between Slaughter, Capture and other forms of attack. I don't know if this function is used or not since i haven't found another reference to it, but it might be possible to add more distinctions to it (maybe even one based on distance between units and stuff).

I don't know if this will help but, who knows?

Well it already works in @bb_'s patch

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...