Hello, does anyone have a script of carrying a corpse makes using weapons or casting spells impossible?
#1
Posté 15 juin 2011 - 03:25
Basically they have to bring remains of someone back but might have to deal with pursuit and the corpse weighs 175 lbs which should slow down those who don't have high strength. The corpse could be placed in only largest bag of holding but not sure if that can be imposed either.
Any insight./script help appreciated.
#2
Posté 15 juin 2011 - 05:24
#3
Posté 15 juin 2011 - 05:30
Note: I took the super easy route and just made it so that the player couldn't equip anything in the right or left hand. So this includes sheilds, torches, etc. Otherwise you have to check for weapon base items and whether or not you are using CEP weapons and all that jazz. Also the only parts I added to the 2 scripts below are between the red "/////". Also make sure you plug in your corpse tag where it says "TEST_CORPSE".
//::///////////////////////////////////////////////
//:: 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 (GetItemPossessedBy(oPC, "TEST_CORPSE") != OBJECT_INVALID)
{
if (oItem == GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC) ||
oItem == GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC))
{
DelayCommand(1.0, AssignCommand(oPC, ActionUnequipItem(oItem)));
SendMessageToPC(oPC, "You can not equip a weapon or shield while carrying a corpse.");
}
}
////////////////////////////////////////////////////////////////////
// -------------------------------------------------------------------------
// Intelligent Weapon System
// -------------------------------------------------------------------------
if (IPGetIsIntelligentWeapon(oItem))
//etc........
Now you 2 choices for the second part. You can either alter your modules "OnPlayerAcquireItem" script or you can make a tag based script for the corpse. I'll just put the alteration to the "OnPlayerAcquireItem" script for now. If you want it tag based so you don't have to mess with this event then just let us know.
So this would be the alteration to the default "x2_mod_def_aqu":
//::///////////////////////////////////////////////
//:: Example XP2 OnItemAcquireScript
//:: x2_mod_def_aqu
//:: © 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
Put into: OnItemAcquire Event
*/
//:://////////////////////////////////////////////
//:: Created By: Georg Zoeller
//:: Created On: 2003-07-16
//:://////////////////////////////////////////////
#include "x2_inc_switches"
void main()
{
object oItem = GetModuleItemAcquired();
/////////////////////////////////////////////////////////////////
object oPC = GetModuleItemAcquiredBy();
object oSlotRH = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
object oSlotLH = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC);
if (GetTag(oItem) == "TEST_CORPSE")
{
AssignCommand(oPC, ActionUnequipItem(oSlotRH));
AssignCommand(oPC, ActionUnequipItem(oSlotLH));
SendMessageToPC(oPC, "You can not equip a weapon or shield while carrying a corpse.");
}
/////////////////////////////////////////////////////////////////
// * Generic Item Script Execution Code
//etc......
As far as the spells go you are going to have to get into the spell hooking which I haven't done for awhile. And if I remember right, the player will still be able to use spell items and cast spells using the spellhook...the spells/items will just fail.
Hope this helps.
Modifié par GhostOfGod, 15 juin 2011 - 05:37 .
#4
Posté 15 juin 2011 - 05:48
#5
Posté 15 juin 2011 - 06:20
Tag based script for the corpse item. This will fire when the item is acquired and unacquired. Just make sure the name that you save it under matches the tag of your corpse item:
#include "x2_inc_switches"
void main()
{
int iEvent = GetUserDefinedItemEventNumber();
object oPC = GetModuleItemAcquiredBy();
if (iEvent == X2_ITEM_EVENT_ACQUIRE)
{
object oSlotRH = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
object oSlotLH = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC);
AssignCommand(oPC, ActionUnequipItem(oSlotRH));
AssignCommand(oPC, ActionUnequipItem(oSlotLH));
SendMessageToPC(oPC, "You can not equip items in hands while carrying a corpse.");
SetLocalInt(oPC, "CARRY_CORPSE", TRUE);
}
else if (iEvent == X2_ITEM_EVENT_UNACQUIRE)
{
SetLocalInt(oPC, "CARRY_COPRSE", FALSE);
}
}
And then the changes to your OnPlayerEquipItem script should look something like this(again just added the stuff in between the red "////" to the default 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(oPC, "CARRY_CORPSE") == TRUE)
{
if (oItem == GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC) ||
oItem == GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC))
{
DelayCommand(1.0, AssignCommand(oPC, ActionUnequipItem(oItem)));
SendMessageToPC(oPC, "You can not equip items in hands while carrying a corpse.");
}
}
////////////////////////////////////////////////////////////////////
// -------------------------------------------------------------------------
// Intelligent Weapon System
// -------------------------------------------------------------------------
if (IPGetIsIntelligentWeapon(oItem))
///etc....
Either of the ways I posted should work for you but the second method is better. Good luck.
Modifié par GhostOfGod, 15 juin 2011 - 06:21 .
#6
Posté 15 juin 2011 - 08:48
Thank you again.
#7
Posté 15 juin 2011 - 09:07
#8
Posté 15 juin 2011 - 09:16
However If you want to still have just one tag based script you could give all 4 corpses the same tags and then if you have a script that requires the unique tags just change it to GetResRef of each item instead. Personally this is what I would do if you are able to.
Altered tag based script(Also fixed other issue):
#include "x2_inc_switches"
void main()
{
int iEvent = GetUserDefinedItemEventNumber();
if (iEvent == X2_ITEM_EVENT_ACQUIRE)
{
object oPC = GetModuleItemAcquiredBy();
int iCorpses = GetLocalInt(oPC, "CARRY_CORPSE");
object oSlotRH = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC);
object oSlotLH = GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC);
if (oSlotRH != OBJECT_INVALID)
AssignCommand(oPC, ActionUnequipItem(oSlotRH));
if (oSlotLH != OBJECT_INVALID)
AssignCommand(oPC, ActionUnequipItem(oSlotLH));
SendMessageToPC(oPC, "You can not equip items in hands while carrying a corpse.");
SetLocalInt(oPC, "CARRY_CORPSE", iCorpses + 1);
}
if (iEvent == X2_ITEM_EVENT_UNACQUIRE)
{
object oPC = GetModuleItemLostBy();
int iCorpses = GetLocalInt(oPC, "CARRY_CORPSE");
if (iCorpses > 0)
SetLocalInt(oPC, "CARRY_CORPSE", iCorpses - 1);
}
}
The Altered OnPlayerEquipItem:
//::///////////////////////////////////////////////
//:: 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(oPC, "CARRY_CORPSE") > 0)
{
if (oItem == GetItemInSlot(INVENTORY_SLOT_LEFTHAND, oPC) ||
oItem == GetItemInSlot(INVENTORY_SLOT_RIGHTHAND, oPC))
{
DelayCommand(1.0, AssignCommand(oPC, ActionUnequipItem(oItem)));
SendMessageToPC(oPC, "You can not equip items in hands while carrying a corpse.");
}
}
////////////////////////////////////////////////////////////////////
// -------------------------------------------------------------------------
// Intelligent Weapon System
// -------------------------------------------------------------------------
if (IPGetIsIntelligentWeapon(oItem))
///etc....
Modifié par GhostOfGod, 15 juin 2011 - 09:24 .
#9
Posté 15 juin 2011 - 09:30
#10
Posté 15 juin 2011 - 11:55





Retour en haut






