Aller au contenu

Photo

Script for NPC equipping melee weapon in close-range?


  • Veuillez vous connecter pour répondre
8 réponses à ce sujet

#1
Grani

Grani
  • Members
  • 560 messages
 I have an NPC that has both a crossbow and a set of a sword and a shield. If I attack him close range he takes out his melee "set" and it's alright. If I attack him long range, he takes out a crossbow and it's alright.

But how can I make him change his equipment to melee (or vice versa) depending on the range?

Thanks for help. :)

#2
kalbaern

kalbaern
  • Members
  • 824 messages
Use this in the NPC's OnSpawn Event: ActionEquipMostDamagingRanged(OBJECT_SELF);

By default, this'll also equip a melee weapon when no ranged weapon w/ matching ammo exists.

#3
Grani

Grani
  • Members
  • 560 messages
But it doesn't look like it will make the NPC change his weapon when the enemy comes into melee range, right?

#4
Shadooow

Shadooow
  • Members
  • 4 474 messages
This is fixed is my patch...

#5
Grani

Grani
  • Members
  • 560 messages

ShaDoOoW wrote...

This is fixed is my patch...


I'm using your patch. ^^
Though I know I should use the builder resources probably. :?

Modifié par Grani, 09 décembre 2012 - 11:06 .


#6
Shadooow

Shadooow
  • Members
  • 4 474 messages
well which version? I dont recall when I fixed this, maybe around beta 6 or latest beta. Its definitely not in initial 1.70 release. And it might not work correctly, if you using old includes (this issue is fixed in x0_i0_equip) or old AI scripts (nw_c2_def*) which you haven't recompiled.

In clean module with 1.71b8 installed, the creature you specified will behave just as you wish. Except in easy difficulty or if she has point blank shot, she will not unequip ranged in close combat.

#7
Grani

Grani
  • Members
  • 560 messages
Well, I'm using original 1.70, so that's probably it.

#8
Shadooow

Shadooow
  • Members
  • 4 474 messages
To clarify. This is an issue in default bioware AI. It probably was intented to work that way, unfortunately the script for this has an error - it works only for henchmans. It would be possible to fix it otherwise, such as extra code in heartbeat (if distance is long, try to equip ranged weapons) but in fact that would be simply workaround for real issue. I suppose that custom AIs such as Tony K's surely have this feature too.

#9
Grani

Grani
  • Members
  • 560 messages
Alright, thanks for help :D