2 hander AC
#1
Posté 25 mars 2011 - 12:33
#2
Posté 25 mars 2011 - 01:40
hope I didn't forget any, check it with NWN Wiki pleaseint GetIsTwoHandedWeapon(object oWeapon)
{
switch(GetBaseItemType(oWeapon))
{
case BASE_ITEM_GREATAXE:
case BASE_ITEM_SHORTSPEAR:
case BASE_ITEM_TRIDENT:
case BASE_ITEM_GREATSWORD:
case BASE_ITEM_HALBERD:
case BASE_ITEM_SCYTHE:
case BASE_ITEM_HEAVYFLAIL:
case BASE_ITEM_QUARTERSTAFF:
return TRUE;
case BASE_ITEM_SCIMITAR:
case BASE_ITEM_CLUB:
case BASE_ITEM_MORNINGSTAR:
case BASE_ITEM_LIGHTFLAIL:
case BASE_ITEM_WARHAMMER:
case BASE_ITEM_BATTLEAXE:
case BASE_ITEM_BASTARDSWORD:
case BASE_ITEM_LONGSWORD:
case BASE_ITEM_RAPIER:
case BASE_ITEM_DWARVENWARAXE:
switch(GetRacialType(GetItemPossessor(oWeapon)))
{
case RACIAL_TYPE_GNOME:
case RACIAL_TYPE_HALFLING:
return TRUE;
}
}
return FALSE;
}
Modifié par ShaDoOoW, 25 mars 2011 - 01:42 .
#3
Posté 25 mars 2011 - 01:49
#4
Posté 25 mars 2011 - 03:53
#5
Posté 25 mars 2011 - 10:41
#6
Posté 25 mars 2011 - 10:44
then you need to apply the effect in OnEquip this way
AssignCommand(GetObjectByTag("EC_TWOHANDED"), ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectACIncrease(8,AC_SHIELD_ENCHANTMENT_BONUS)),oPC));
then in OnUnEquip you need to remove it this way
oPC = GetPCItemLastUnequippedBy();
effect e = GetFirstEffect(oPC);
while(GetIsEffectValid(e))
{
if(GetTag(GetEffectCreator(e)) == "EC_TWOHANDED")
{
RemoveEffect(oPC,e);
}
e = GetNextEffect(oPC);
}
Modifié par ShaDoOoW, 25 mars 2011 - 10:45 .
#7
Posté 25 mars 2011 - 10:48
Ok added bows and crossbows.0pie wrote...
Also I added bows to the include you made me. But it wont let me put 2 instances of shortbow ( because it is 2 handed for both medium and small races ) in it. Any way to fix this so that both medium and small races get the ac ?
int GetIsTwoHandedWeapon(object oWeapon)
{
switch(GetBaseItemType(oWeapon))
{
case BASE_ITEM_GREATAXE:
case BASE_ITEM_SHORTSPEAR:
case BASE_ITEM_TRIDENT:
case BASE_ITEM_GREATSWORD:
case BASE_ITEM_HALBERD:
case BASE_ITEM_SCYTHE:
case BASE_ITEM_HEAVYFLAIL:
case BASE_ITEM_QUARTERSTAFF:
case BASE_ITEM_LONGBOW:
case BASE_ITEM_SHORTBOW:
case BASE_ITEM_HEAVYCROSSBOW:
case BASE_ITEM_LIGHTCROSSBOW:
return TRUE;
case BASE_ITEM_SCIMITAR:
case BASE_ITEM_CLUB:
case BASE_ITEM_MORNINGSTAR:
case BASE_ITEM_LIGHTFLAIL:
case BASE_ITEM_WARHAMMER:
case BASE_ITEM_BATTLEAXE:
case BASE_ITEM_BASTARDSWORD:
case BASE_ITEM_LONGSWORD:
case BASE_ITEM_RAPIER:
case BASE_ITEM_DWARVENWARAXE:
switch(GetRacialType(GetItemPossessor(oWeapon)))
{
case RACIAL_TYPE_GNOME:
case RACIAL_TYPE_HALFLING:
return TRUE;
}
}
return FALSE;
}
Modifié par ShaDoOoW, 25 mars 2011 - 10:49 .
#8
Posté 25 mars 2011 - 11:06
#9
Posté 25 mars 2011 - 12:27
#10
Posté 25 mars 2011 - 12:50
#11
Posté 25 mars 2011 - 12:56
case BASE_ITEM_HEAVYCROSSBOW:
case BASE_ITEM_LIGHTCROSSBOW:
return TRUE;
case BASE_ITEM_SHORTBOW:
#12
Posté 25 mars 2011 - 01:07
I have another question though. If I wanted to setup the same thing for duel wielders would I do it this same way ?
Once again thank you so much 8)
#13
Posté 25 mars 2011 - 01:24
#14
Posté 25 mars 2011 - 10:51
The only real differance is that it will not return true for the short bow in the hands of a human. but it will return true for the short bow in the hands on a smal creature. I assume you are shooting for the weapon being as large as the creature to explain the AC increase.
int GetIsWeaponACWorthy(object oWeapon, object oWielder=OBJECT_SELF)
{
int nWeaponType = GetBaseItemType(oWeapon);
int nWeaponSize = StringToInt(Get2DAString("baseitems","WeaponSize",nWeaponType));
return GetCreatureSize(oWielder)< nWeaponSize ;
}
#15
Posté 02 avril 2011 - 05:25
ShaDoOoW wrote...
First you need to create a special placeable (non static, non useable, no scripts) with unique tag.Eg. EC_TWOHANDED.
then you need to apply the effect in OnEquip this wayAssignCommand(GetObjectByTag("EC_TWOHANDED"), ApplyEffectToObject(DURATION_TYPE_PERMANENT, SupernaturalEffect(EffectACIncrease(8,AC_SHIELD_ENCHANTMENT_BONUS)),oPC));
then in OnUnEquip you need to remove it this wayoPC = GetPCItemLastUnequippedBy();
effect e = GetFirstEffect(oPC);
while(GetIsEffectValid(e))
{
if(GetTag(GetEffectCreator(e)) == "EC_TWOHANDED")
{
RemoveEffect(oPC,e);
}
e = GetNextEffect(oPC);
}
Ooo, this is great!. It is the perfect answer to a couple things I've both done and want to do.
#16
Posté 10 avril 2011 - 03:59
I'm assuming that these scripts will go in OnPlayerEquipItem or a tag-based script, and that those don't work for NPCs.
#17
Posté 10 avril 2011 - 07:26
#18
Posté 10 avril 2011 - 08:24
If you were going to do that for NPCs by script, would you put in their OnSpawn event, or somewhere else?
#19
Posté 10 avril 2011 - 08:37
For example I have a script which makes a random weapon with random boosts in OnSpawn, so the weapon is not present in inventory in time the OnSpawn is fired and I would have to do it in my script or Acquire.
If they are already present in inventory, then you can use OnSpawn.
But this has very little sense if your creature is using one weapon all the time since you could "fake" that bonus via natural armor. Of course if the creature would have ranged weapon + dagger or if she would be disarmable there would be a reason to do it the way you want...
#20
Posté 10 avril 2011 - 07:20
(I'm running a virtual tabletop game that uses a lot of henchmen.)
I could handle PCs, henchmen, and town guards / monsters in three different ways, but I'd rather keep the scripts as few as possible.
I'm afraid I'll have to use the heartbeat event for NPCs, but people here often have extremely clever ways of doing things that I've never thought of.
#21
Posté 10 avril 2011 - 08:04
If henchman acquire a 2hand weapon then apply a temporary ac bonus on it (which would need to change the weapon ac type do shield or dodge if you want to count it into +20 cap) if this weapon is unacquire remove it.
This way would work also for players.
Modifié par ShaDoOoW, 10 avril 2011 - 08:05 .
#22
Posté 29 mai 2012 - 02:07
I'd like to make a SCRIPT similar to this, but my I'd like to maybe put in OnPlayerEquipItem, so that when the PC is using the SET full ARMOR001 + HELMT001, he will gain an AC bonus (DODGE) + 2, for example , could someone help me with this?





Retour en haut






