Disarm weapon script?
#1
Posté 24 novembre 2010 - 12:55
Anyone know?
#2
Posté 25 novembre 2010 - 12:07
//::///////////////////////////////////////////////
//:: Example XP2 OnItemUnAcquireScript
//:: x2_mod_def_unaqu
//:: © 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
Put into: OnItemUnAcquire Event
*/
//:://////////////////////////////////////////////
//:: Created By: Georg Zoeller
//:: Created On: 2003-07-16
//:://////////////////////////////////////////////
#include "x2_inc_switches"
#include "x2_inc_itemprop"
void main()
{
object oItem = GetModuleItemLost();
///////////////////////////////////////////////////////////////////////////
//::Added to place disarmed weapons back into a player inventory.
///////////////////////////////////////////////////////////////////////////
object oPC = GetModuleItemLostBy();
int iLoopStop = GetLocalInt(oItem, "LOOP_STOP");
if (GetIsPC(oPC) && GetIsInCombat(oPC))
{
if (IPGetIsMeleeWeapon(oItem))
{
if (iLoopStop != TRUE)
{
SetLocalInt(oItem, "LOOP_STOP", TRUE);
object oCopy = CopyItem(oItem, oPC, TRUE);
DelayCommand(2.0, DeleteLocalInt(oCopy, "LOOP_STOP"));
DestroyObject(oItem, 0.0);
}
}
}
///////////////////////////////////////////////////////////////////////////
// * Generic Item Script Execution Code
// * If MODULE_SWITCH_EXECUTE_TAGBASED_SCRIPTS is set to TRUE on the module,
// * it will execute a script that has the same name as the item's tag
// * inside this script you can manage scripts for all events by checking against
// * GetUserDefinedItemEventNumber(). See x2_it_example.nss
if (GetModuleSwitchValue(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)
{
SetUserDefinedItemEventNumber(X2_ITEM_EVENT_UNACQUIRE);
int nRet = ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem),OBJECT_SELF);
if (nRet == X2_EXECUTE_SCRIPT_END)
{
return;
}
}
}
This does not include anything for delaying the ability to equipp the weapon again. I suppose you could just add another variable to the weapon and then add a delay to delete the variable. Then go to your "OnPlayerEquipItem" script and do a check for the variable. If found then unequip the weapon?
Hope this helps. good luck.
P.S. This also takes into consideration the fact that the players inventory might be full. In which case the item will still have to go onto the ground.
Modifié par GhostOfGod, 25 novembre 2010 - 12:09 .
#3
Posté 25 novembre 2010 - 07:23
#4
Posté 25 novembre 2010 - 10:26
#5
Posté 25 novembre 2010 - 11:01
Baragg wrote...
Can only melee weapons be disarmed?
I was under the impression that was the case. However since I've never used it I am most likely mistaken.
If Baragg is correct then this line:
if (IPGetIsMeleeWeapon(oItem))
should be changed to:
if (IPGetIsMeleeWeapon(oItem) || IPGetIsRangedWeapon(oItem))
#6
Posté 25 novembre 2010 - 11:23
int GetItemIsWeapon (object oItem) {
switch (GetBaseItemType(oItem)) {
case BASE_ITEM_CLUB:
case BASE_ITEM_DIREMACE:
case BASE_ITEM_HEAVYFLAIL:
case BASE_ITEM_LIGHTFLAIL:
case BASE_ITEM_LIGHTHAMMER:
case BASE_ITEM_LIGHTMACE:
case BASE_ITEM_MORNINGSTAR:
case BASE_ITEM_QUARTERSTAFF:
case BASE_ITEM_WARHAMMER:
case BASE_ITEM_DAGGER:
case BASE_ITEM_RAPIER:
case BASE_ITEM_SHORTSPEAR:
case BASE_ITEM_SHORTSWORD:
case BASE_ITEM_TRIDENT:
case BASE_ITEM_LANCE:
case BASE_ITEM_BASTARDSWORD:
case BASE_ITEM_BATTLEAXE:
case BASE_ITEM_DOUBLEAXE:
case BASE_ITEM_DWARVENWARAXE:
case BASE_ITEM_GREATAXE:
case BASE_ITEM_GREATSWORD:
case BASE_ITEM_HALBERD:
case BASE_ITEM_HANDAXE:
case BASE_ITEM_KAMA:
case BASE_ITEM_KATANA:
case BASE_ITEM_KUKRI:
case BASE_ITEM_LONGSWORD:
case BASE_ITEM_SCIMITAR:
case BASE_ITEM_SCYTHE:
case BASE_ITEM_SICKLE:
case BASE_ITEM_TWOBLADEDSWORD:
case BASE_ITEM_WHIP:
case BASE_ITEM_DART:
case BASE_ITEM_HEAVYCROSSBOW:
case BASE_ITEM_LIGHTCROSSBOW:
case BASE_ITEM_LONGBOW:
case BASE_ITEM_SHORTBOW:
case BASE_ITEM_SHURIKEN:
case BASE_ITEM_SLING:
case BASE_ITEM_THROWINGAXE:
case BASE_ITEM_MAGICSTAFF:
case BASE_ITEM_CEP_ASSASSINDAGGER:
case BASE_ITEM_CEP_DOUBLEPICK:
case BASE_ITEM_CEP_DOUBLESCIMITAR:
case BASE_ITEM_CEP_FALCHION:
case BASE_ITEM_CEP_GOAD:
case BASE_ITEM_CEP_HEAVYMACE:
case BASE_ITEM_CEP_HEAVYPICK:
case BASE_ITEM_CEP_KATAR:
case BASE_ITEM_CEP_LIGHTPICK:
case BASE_ITEM_CEP_MAUL:
case BASE_ITEM_CEP_MERCURIALGREATSWORD:
case BASE_ITEM_CEP_MERCURIALLONGSWORD:
case BASE_ITEM_CEP_NUNCHAKU:
case BASE_ITEM_CEP_SAI:
case BASE_ITEM_CEP_SAP:
case BASE_ITEM_CEP_WINDFIREWHEEL:
return TRUE;
}
return FALSE;
}
Here are all the non-standard consts:
const int BASE_ITEM_LANCE = 92; const int BASE_ITEM_TRUMPET = 93; const int BASE_ITEM_MOONONASTICK = 94; const int BASE_ITEM_CRAFTBASE = 112; const int BASE_ITEM_CEP_COINS = 203; const int BASE_ITEM_CEP_THINBOX = 204; const int BASE_ITEM_CEP_HERB_SMALL = 205; const int BASE_ITEM_CEP_HERB_THIN = 206; const int BASE_ITEM_CEP_STACKSMALL_1 = 207; const int BASE_ITEM_CEP_PELT_LARGE = 208; const int BASE_ITEM_CEP_PELT_THIN = 209; const int BASE_ITEM_CEP_TINYSPEAR = 210; const int BASE_ITEM_CEP_MISCSMALL_3 = 211; const int BASE_ITEM_CEP_MISCMEDIUM_3 = 212; const int BASE_ITEM_CEP_DYE = 224; const int BASE_ITEM_CEP_TRIDENT = 300; const int BASE_ITEM_CEP_HEAVYPICK = 301; const int BASE_ITEM_CEP_LIGHTPICK = 302; const int BASE_ITEM_CEP_SAI = 303; const int BASE_ITEM_CEP_NUNCHAKU = 304; const int BASE_ITEM_CEP_FALCHION = 305; const int BASE_ITEM_CEP_SMALLBOX = 306; const int BASE_ITEM_CEP_MISCMEDIUM_2 = 307; const int BASE_ITEM_CEP_SAP = 308; const int BASE_ITEM_CEP_ASSASSINDAGGER = 309; const int BASE_ITEM_CEP_KATAR = 310; const int BASE_ITEM_CEP_MISCSMALL_2 = 311; const int BASE_ITEM_CEP_FASHION_ACCESSORY = 314; const int BASE_ITEM_CEP_HEAVYMACE = 317; const int BASE_ITEM_CEP_MAUL = 318; const int BASE_ITEM_CEP_MERCURIALLONGSWORD = 319; const int BASE_ITEM_CEP_MERCURIALGREATSWORD = 320; const int BASE_ITEM_CEP_DOUBLESCIMITAR = 321; const int BASE_ITEM_CEP_GOAD = 322; const int BASE_ITEM_CEP_WINDFIREWHEEL = 323; const int BASE_ITEM_CEP_DOUBLEPICK = 324; const int BASE_ITEM_CEP_FLOWERS = 325; const int BASE_ITEM_CEP_CLOAK = 349; const int BASE_ITEM_CEP_RING_2 = 350; const int BASE_ITEM_CEP_AMULET_2 = 351; const int BASE_ITEM_CEP_BUCKLER = 352; const int BASE_ITEM_CEP_RING_ARMOR = 353; const int BASE_ITEM_CEP_RING_NATURAL = 354; const int BASE_ITEM_CEP_RING_SHIELD = 355; const int BASE_ITEM_CEP_AMULET_ARMOR = 356; const int BASE_ITEM_CEP_AMULET_DEFLECT = 357; const int BASE_ITEM_CEP_AMULET_SHIELD = 358; const int BASE_ITEM_CEP_BELT_ARMOR = 359; const int BASE_ITEM_CEP_BELT_NATURAL = 360; const int BASE_ITEM_CEP_BELT_SHIELD = 361; const int BASE_ITEM_CEP_BRACER_SHIELD = 362; const int BASE_ITEM_CEP_CLOAK_ARMOR = 363; const int BASE_ITEM_CEP_CLOAK_DODGE = 364; const int BASE_ITEM_CEP_CLOAK_NATURAL = 365; const int BASE_ITEM_CEP_CLOAK_SHIELD = 366; const int BASE_ITEM_CEP_TORCH_SHIELD = 367; const int BASE_ITEM_CEP_RING_2_ARMOR = 368; const int BASE_ITEM_CEP_RING_2_NATURAL = 369; const int BASE_ITEM_CEP_RING_2_SHIELD = 370; const int BASE_ITEM_CEP_AMULET_2_ARMOR = 371; const int BASE_ITEM_CEP_AMULET_2_DEFLECT = 372; const int BASE_ITEM_CEP_AMULET_2_SHIELD = 373; const int BASE_ITEM_CEP_RUNESTONE = 374; const int BASE_ITEM_CEP_HELMET_ARMOR = 375; const int BASE_ITEM_CEP_GLOVES_SPIKED = 376; const int BASE_ITEM_CEP_GLOVES_BLADED = 377; const int BASE_ITEM_CEP_MISCSMALL_4 = 380; const int BASE_ITEM_CEP_MISCMEDIUM_4 = 381; const int BASE_ITEM_CEP_MISCTHIN_2 = 382; const int BASE_ITEM_CEP_MISCTHIN_3 = 383; const int BASE_ITEM_CEP_MISCTHIN_4 = 384; const int BASE_ITEM_CEP_MISCLARGE_2 = 385; const int BASE_ITEM_CEP_MISCLARGE_3 = 386; const int BASE_ITEM_CEP_MISCLARGE_4 = 387; const int BASE_ITEM_CEP_STACKSMALL_2 = 388; const int BASE_ITEM_CEP_STACKSMALL_3 = 389; const int BASE_ITEM_CEP_STACKSMALL_4 = 390; const int BASE_ITEM_CEP_STACKMEDIUM_1 = 391; const int BASE_ITEM_CEP_STACKMEDIUM_2 = 392; const int BASE_ITEM_CEP_STACKMEDIUM_3 = 393; const int BASE_ITEM_CEP_STACKMEDIUM_4 = 394; const int BASE_ITEM_CEP_STACKTHIN_1 = 395; const int BASE_ITEM_CEP_STACKTHIN_2 = 396; const int BASE_ITEM_CEP_STACKTHIN_3 = 397; const int BASE_ITEM_CEP_STACKTHIN_4 = 398; const int BASE_ITEM_CEP_STACKLARGE_1 = 399; const int BASE_ITEM_CEP_STACKLARGE_2 = 400; const int BASE_ITEM_CEP_STACKLARGE_3 = 401; const int BASE_ITEM_CEP_STACKLARGE_4 = 402;
Funky
Modifié par FunkySwerve, 25 novembre 2010 - 11:24 .
#7
Posté 26 novembre 2010 - 01:21
#8
Posté 27 novembre 2010 - 04:33
//::///////////////////////////////////////////////
//:: Example XP2 OnItemUnAcquireScript
//:: x2_mod_def_unaqu
//:: © 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
Put into: OnItemUnAcquire Event
*/
//:://////////////////////////////////////////////
//:: Created By: Georg Zoeller
//:: Created On: 2003-07-16
//:://////////////////////////////////////////////
#include "x2_inc_switches"
#include "x2_inc_itemprop"
#include "zep_inc_main"
//GetItemIsWeapon prototype:
int GetItemIsWeapon(object oItem);
const int BASE_ITEM_LANCE = 92;
const int BASE_ITEM_DOUBLEPICK = 324;
void main()
{
object oItem = GetModuleItemLost();
///////////////////////////////////////////////////////////////////////////
//::Added to place disarmed weapons back into a player inventory.
///////////////////////////////////////////////////////////////////////////
object oPC = GetModuleItemLostBy();
int iLoopStop = GetLocalInt(oItem, "LOOP_STOP");
if (GetIsPC(oPC) && GetIsInCombat(oPC))
{
if (GetItemIsWeapon(oItem))
{
if (iLoopStop != TRUE)
{
SetLocalInt(oItem, "LOOP_STOP", TRUE);
SetLocalInt(oItem, "EQUIP_DELAY", TRUE);
object oCopy = CopyItem(oItem, oPC, TRUE);
DelayCommand(2.0, DeleteLocalInt(oCopy, "LOOP_STOP"));
//Equip delay below:
DelayCommand(10.0, DeleteLocalInt(oCopy, "EQUIP_DELAY"));
DestroyObject(oItem, 0.0);
}
}
}
///////////////////////////////////////////////////////////////////////////
// * Generic Item Script Execution Code
// * If MODULE_SWITCH_EXECUTE_TAGBASED_SCRIPTS is set to TRUE on the module,
// * it will execute a script that has the same name as the item's tag
// * inside this script you can manage scripts for all events by checking against
// * GetUserDefinedItemEventNumber(). See x2_it_example.nss
if (GetModuleSwitchValue(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)
{
SetUserDefinedItemEventNumber(X2_ITEM_EVENT_UNACQUIRE);
int nRet = ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem),OBJECT_SELF);
if (nRet == X2_EXECUTE_SCRIPT_END)
{
return;
}
}
}
int GetItemIsWeapon(object oItem)
{
switch (GetBaseItemType(oItem))
{
case BASE_ITEM_CLUB:
case BASE_ITEM_DIREMACE:
case BASE_ITEM_HEAVYFLAIL:
case BASE_ITEM_LIGHTFLAIL:
case BASE_ITEM_LIGHTHAMMER:
case BASE_ITEM_LIGHTMACE:
case BASE_ITEM_MORNINGSTAR:
case BASE_ITEM_QUARTERSTAFF:
case BASE_ITEM_WARHAMMER:
case BASE_ITEM_DAGGER:
case BASE_ITEM_RAPIER:
case BASE_ITEM_SHORTSPEAR:
case BASE_ITEM_SHORTSWORD:
case BASE_ITEM_TRIDENT:
case BASE_ITEM_LANCE:
case BASE_ITEM_BASTARDSWORD:
case BASE_ITEM_BATTLEAXE:
case BASE_ITEM_DOUBLEAXE:
case BASE_ITEM_DWARVENWARAXE:
case BASE_ITEM_GREATAXE:
case BASE_ITEM_GREATSWORD:
case BASE_ITEM_HALBERD:
case BASE_ITEM_HANDAXE:
case BASE_ITEM_KAMA:
case BASE_ITEM_KATANA:
case BASE_ITEM_KUKRI:
case BASE_ITEM_LONGSWORD:
case BASE_ITEM_SCIMITAR:
case BASE_ITEM_SCYTHE:
case BASE_ITEM_SICKLE:
case BASE_ITEM_TWOBLADEDSWORD:
case BASE_ITEM_WHIP:
case BASE_ITEM_DART:
case BASE_ITEM_HEAVYCROSSBOW:
case BASE_ITEM_LIGHTCROSSBOW:
case BASE_ITEM_LONGBOW:
case BASE_ITEM_SHORTBOW:
case BASE_ITEM_SHURIKEN:
case BASE_ITEM_SLING:
case BASE_ITEM_THROWINGAXE:
case BASE_ITEM_MAGICSTAFF:
case BASE_ITEM_DAGGERASSASSIN:
case BASE_ITEM_DOUBLEPICK:
case BASE_ITEM_KUKRI2:
case BASE_ITEM_TRIDENT_1H:
case BASE_ITEM_DOUBLESCIMITAR:
case BASE_ITEM_FALCHION1:
case BASE_ITEM_FALCHION2:
case BASE_ITEM_GOAD:
case BASE_ITEM_HEAVYMACE:
case BASE_ITEM_HEAVYPICK:
case BASE_ITEM_KATAR:
case BASE_ITEM_LIGHTPICK:
case BASE_ITEM_MAUL:
case BASE_ITEM_MERCURIALGREATSWORD:
case BASE_ITEM_MERCURIALLONGSWORD:
case BASE_ITEM_NUNCHAKU:
case BASE_ITEM_SAI:
case BASE_ITEM_SAP:
case BASE_ITEM_WINDFIREWHEEL:
return TRUE;
}
return FALSE;
}
And then you need to add to your modules "OnPlayerEquipItem" script. The red highlighted section is all I added to the default "x2_mod_def_equ" script.
//::///////////////////////////////////////////////
//:: Example XP2 OnItemEquipped
//:: x2_mod_def_equ
//:: © 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
Put into: OnEquip Event
*/
//:://////////////////////////////////////////////
//:: Created By: Georg Zoeller
//:: Created On: 2003-07-16
//:://////////////////////////////////////////////
//:: Modified By: Deva Winblood
//:: Modified On: April 15th, 2008
//:: Added Support for Mounted Archery Feat penalties
//:://////////////////////////////////////////////
#include "x2_inc_switches"
#include "x2_inc_intweapon"
#include "x3_inc_horse"
void main()
{
object oItem = GetPCItemLastEquipped();
object oPC = GetPCItemLastEquippedBy();
if (GetLocalInt(oItem, "EQUIP_DELAY"))
{
ActionUnequipItem(oItem);
SendMessageToPC(oPC, "You must wait 10 seconds before equipping this weapon.");
return;
}
// -------------------------------------------------------------------------
// Intelligent Weapon System
// -------------------------------------------------------------------------
if (IPGetIsIntelligentWeapon(oItem))
{
IWSetIntelligentWeaponEquipped(oPC,oItem);
// prevent players from reequipping their weapon in
if (IWGetIsInIntelligentWeaponConversation(oPC))
{
object oConv = GetLocalObject(oPC,"X2_O_INTWEAPON_SPIRIT");
IWEndIntelligentWeaponConversation(oConv, oPC);
}
else
{
//------------------------------------------------------------------
// Trigger Drain Health Event
//------------------------------------------------------------------
if (GetLocalInt(oPC,"X2_L_ENSERRIC_ASKED_Q3")==1)
{
ExecuteScript ("x2_ens_dodrain",oPC);
}
else
{
IWPlayRandomEquipComment(oPC,oItem);
}
}
}
// -------------------------------------------------------------------------
// Mounted benefits control
// -------------------------------------------------------------------------
if (GetWeaponRanged(oItem))
{
SetLocalInt(oPC,"bX3_M_ARCHERY",TRUE);
HORSE_SupportAdjustMountedArcheryPenalty(oPC);
}
// -------------------------------------------------------------------------
// Generic Item Script Execution Code
// If MODULE_SWITCH_EXECUTE_TAGBASED_SCRIPTS is set to TRUE on the module,
// it will execute a script that has the same name as the item's tag
// inside this script you can manage scripts for all events by checking against
// GetUserDefinedItemEventNumber(). See x2_it_example.nss
// -------------------------------------------------------------------------
if (GetModuleSwitchValue(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)
{
SetUserDefinedItemEventNumber(X2_ITEM_EVENT_EQUIP);
int nRet = ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem),OBJECT_SELF);
if (nRet == X2_EXECUTE_SCRIPT_END)
{
return;
}
}
}
Hope that is what you needed. Good luck.
#9
Posté 27 novembre 2010 - 04:41
#10
Posté 27 novembre 2010 - 06:48
#11
Posté 28 novembre 2010 - 04:20
Modifié par ffbj, 28 novembre 2010 - 04:25 .
#12
Posté 28 novembre 2010 - 05:10
#13
Posté 28 novembre 2010 - 05:22
#include "x2_inc_switches"
void main()
{
object oDisarmed = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, OBJECT_SELF);
object oItem = GetModuleItemLost();
if (GetIsInCombat(OBJECT_SELF) && (oItem == oDisarmed))
{
SetLocalInt (oDisarmed, "Disarmed", 1);
DelayCommand (6.0, DeleteLocalInt(oDisarmed, "Disarmed"));
}
So not sure about the difference as far as in the disarm feature the item actually gets destroyed and then recreated in the PC's inventory. So there the local int might be lost, which should not be a problem either since when you recreate it, the item, if the int would be lost, you just set it, the int, on the recreated item.
Modifié par ffbj, 28 novembre 2010 - 06:06 .
#14
Posté 28 novembre 2010 - 10:06
#15
Posté 28 novembre 2010 - 10:40
#include "hg_inc"
#include "ac_itemprop_inc"
#include "ac_itemenh_inc"
int ABFeat (object oPC, int nFeat, int nBonus) {
if (nFeat > 0 && GetHasFeat(nFeat, oPC))
return nBonus;
return 0;
}
int GetTotalAttackBonus (object oPC) {
/* include +20 magical bonus always */
int nAB = GetBaseAttackBonus(oPC) + 20;
if (GetHitDice(oPC) == 40)
nAB = (nAB - 20) + GetLocalInt(oPC, "LegendaryBAB");
int nBaseItem = BASE_ITEM_GLOVES;
object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
if (GetIsObjectValid(oWeapon))
nBaseItem = GetBaseItemType(oWeapon);
nAB += ABFeat(oPC, FEAT_EPIC_PROWESS, 1);
nAB += ABFeat(oPC, GetWeaponFocusFeat(nBaseItem), 1);
nAB += ABFeat(oPC, GetWeaponEpicFocusFeat(nBaseItem), 2);
nAB += GetAttackBonusAdjustment(oPC, oWeapon, 0);
int nWM = GetLevelByclass(class_TYPE_WEAPON_MASTER, oPC);
if (nWM >= 5 && ABFeat(oPC, GetWeaponOfChoiceFeat(nBaseItem), 1) > 0) {
nAB++;
if (nWM >= 10)
nAB += (nWM - 10) / 3;
}
return nAB;
}
void main () {
object oPC = OBJECT_SELF;
object oTarget = GetLocalObject(oPC, "EventTarget");
DeleteLocalObject(oPC, "EventTarget");
if (!GetIsObjectValid(oPC) || !GetIsObjectValid(oTarget) || !GetIsTarget(oTarget))
return;
if (GetDistanceBetween(oPC, oTarget) > RADIUS_SIZE_LARGE) {
FloatingTextStringOnCreature("You must be closer to your target to disarm it!", oPC, FALSE);
return;
}
if (GetItemIsRangedWeapon(GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC))) {
FloatingTextStringOnCreature("You cannot disarm with a ranged weapon!", oPC, FALSE);
return;
}
object oWeapon = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oTarget);
if (!GetIsObjectValid(oWeapon)) {
FloatingTextStringOnCreature("You cannot disarm that target!", oPC, FALSE);
return;
}
int bDisarmable;
if (!GetIsPC(oTarget) && !GetDroppableFlag(oWeapon)) {
SetLocalInt(oWeapon, "REPLACED", 1);
SetDroppableFlag(oWeapon, TRUE);
bDisarmable = GetIsCreatureDisarmable(oTarget);
SetDroppableFlag(oWeapon, FALSE);
} else
bDisarmable = GetIsCreatureDisarmable(oTarget);
if (!bDisarmable) {
FloatingTextStringOnCreature("You cannot disarm that target!", oPC, FALSE);
return;
}
float fDelay = (GetHasFeat(HGFEAT_SUPERIOR_DISARM, oPC) ? 3.0 : 6.0);
if (!CheckSwiftAction(oPC, fDelay))
return;
SignalEvent(oTarget, EventSpellCastAt(OBJECT_SELF, SPELL_BIGBYS_FORCEFUL_HAND));
int nAB = GetTotalAttackBonus(oPC);
int nDC = (GetHasFeat(FEAT_IMPROVED_DISARM, oPC) ? 15 : 25);
int nDisc = GetSkillRank(SKILL_DISCIPLINE, oTarget);
int nDisarmAdjustment = nDisc/10;
nDC += nDisc + d20() - nDisarmAdjustment;
int nCheck = GetSkillCheckResult(1000, oPC, nDC, TRUE, -1, oTarget, 0.0, 0, nAB);
if (nCheck > 0) {
effect eDisarm = EffectDisarm(0);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDisarm, oTarget);
}
}
Let me know if you want to see any of the subfunctions.
Funky
#16
Posté 29 novembre 2010 - 04:12
If a player is in combat and they hand someone a weapon from their inventory, the weapon will just be destroyed and the new one created back into the players inventory. This can just be viewed as "You are too busy fighting to fish around in your back pack for that dagger with the slashing resistence to give to your budy".
And it is a deterent for players to pickpocket other players while in combat. If the pick pocket snags a nice weapon...it gets destroyed and gos back to the original player.
As far as switching weapons while in combat, that shouldn't be a problem since they don't unacquire the item.
I was a bit confused about your solution ffbj. Not sure how that would work.
#17
Posté 29 novembre 2010 - 12:49
Remember, when switching weapons, you unequip first, equip later. So if, for example, you had an axe (2x3) and a great shield (2x4) equipped, but due to some reason needed to switch to, say, a quarterstaff (1x4), if you don't have free 2x3 space, and 2x4 after that, the shield and maybe even axe would get dropped. Then the staff gets equipped, then you destroy the axe, then try to push it in again. If there still isn't room, it could mess things up even more.
How I would go about it is to replace the whole standard disarm script instead of trying to hotfix its results on the fly.
#18
Posté 29 novembre 2010 - 02:19
CheeseshireCat wrote...
How I would go about it is to replace the whole standard disarm script instead of trying to hotfix its results on the fly.
There is the problem, The disarm is hard coded. Unless of cource you have hacked the server, like funky has.
#19
Posté 29 novembre 2010 - 03:36
CheeseshireCat wrote...
The item will get unacquired when switching if you have little free space due to full and/or cluttered inventory.
Remember, when switching weapons, you unequip first, equip later. So if, for example, you had an axe (2x3) and a great shield (2x4) equipped, but due to some reason needed to switch to, say, a quarterstaff (1x4), if you don't have free 2x3 space, and 2x4 after that, the shield and maybe even axe would get dropped. Then the staff gets equipped, then you destroy the axe, then try to push it in again. If there still isn't room, it could mess things up even more.
How I would go about it is to replace the whole standard disarm script instead of trying to hotfix its results on the fly.
That's why I put the infinite loop check in. So even if a player switches weapons(And only a weapon and while in combat) and there is no room in the inventory, it will drop to the ground, the unacquire fires, the weapon wil try once to be recreated in the inventory, if there is no room the new one will drop to the ground and stay there as it normaly would if the inventory was too full.
It's been working for us in our meager pw.
#20
Posté 30 novembre 2010 - 01:03
Then all you need do is check for the int disarmed on the equip item script and while that int is present the weapon can't be re-equipped, which was part of the oringinal question the op asked. That the item not be re-equipable for a few seconds, in my example 6.0. My only concern was the when the weapon is re-created the int might be lost, which is easy to fix by setting the local when the weapon is re-created in the PC's inventory. If the int disarmed is not lost then that step would not be needed.
Modifié par ffbj, 30 novembre 2010 - 01:11 .
#21
Posté 30 novembre 2010 - 03:59
#22
Posté 01 décembre 2010 - 01:49
#23
Posté 04 janvier 2011 - 07:50
In my mod, I use ActionPickUpItem which will take a little time to perform and justify the use of Disarm by fighters.
Modifié par La Rose Noire, 04 janvier 2011 - 07:51 .





Retour en haut






