Jump to content

attack based by distance


newcivs
 Share

Recommended Posts

I mod the Pil Mahalmit's actor, i put a ptolomeaic tower and a javelinist inside and i have a question:

how i can put an attack based on distance:

the means the if the unit detects enemies on shoot distance of javelinists the javelinist gonna shoot their javelins, and if the enemies are nearing into the elephants the melee attack begins

Link to comment
Share on other sites

i have a new bug with my mod, i hear calvary sounds not elephant sounds, but i patch it

template_unit_champion_cavalry_javelinist2

the code:

<Entity parent="template_unit_champion_cavalry">  <Armour>    <Hack>4</Hack>    <Pierce>5</Pierce>    <Crush>6</Crush>  </Armour>  <Attack>    <Ranged>      <Hack>30.0</Hack>      <Pierce>30.0</Pierce>      <Crush>0.0</Crush>      <MaxRange>56</MaxRange>      <MinRange>0.0</MinRange>      <ProjectileSpeed>50.0</ProjectileSpeed>      <PrepareTime>1200</PrepareTime>      <RepeatTime>2000</RepeatTime>      <Spread>1.2</Spread>      <Bonuses>        <BonusPrimary>          <Classes>Infantry Bow</Classes>          <Multiplier>2.0</Multiplier>        </BonusPrimary>        <BonusSecondary>          <Classes>Cavalry Sword</Classes>          <Multiplier>1.5</Multiplier>        </BonusSecondary>      </Bonuses>    </Ranged>  </Attack>  <Cost>    <Resources>      <food>100</food>      <wood>70</wood>    </Resources>  </Cost>  <Identity>    <Classes datatype="tokens">Ranged Javelin</Classes>    <GenericName>Champion Cavalry Skirmisher</GenericName>    <Tooltip>Classes: Champion Ranged Cavalry Skirmisher.Counters: 2x vs. Archers, 1.5x vs. Cavalry Swordsmen.Countered by: Spearmen and Elephants.</Tooltip>  </Identity>  <Obstruction>    <Unit radius="1.0"/>  </Obstruction>  <Sound>    <SoundGroups>      <select>actor/fauna/animal/elephant_select.xml</select>      <order_walk>actor/fauna/animal/elephant_order.xml</order_walk>      <order_attack>actor/fauna/animal/elephant_attack.xml</order_attack>      <attack>actor/fauna/animal/elephant_attack.xml</attack>      <death>actor/fauna/animal/elephant_death.xml</death>      <trained>actor/fauna/animal/elephant_trained.xml</trained>    </SoundGroups>  </Sound>  <UnitMotion>    <WalkSpeed>14.0</WalkSpeed>    <Run>      <Speed>28.0</Speed>      <Range>1000.0</Range>      <RangeMin>10.0</RangeMin>    </Run>  </UnitMotion></Entity>
Link to comment
Share on other sites

  • 1 month later...

Are you talking about javelinist in towers? Or ontop an elephant?

I think via JavaScript you could decide yourself which unit to attack. So compare the nearest enemy position to your units position and decide whether the javelins' reach is enough. Once the enemies are coming too close draw back the javelinists and send in the melee. (all in javascript)

  • Like 1
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...