II have a few examples for ya
I build for a nother PW and we use this script on on most of our doors:
-Door is set to plot.
-Door is locked, note the DC of the lock.
-This script goes in the OnPhysicalAttacked Event:
Code: Select all
int DoorBash(object oPC)
{
object oBasher=GetLastAttacker();
int nLockDC=GetLockUnlockDC(OBJECT_SELF);
int nSTRMod=GetAbilityScore(oBasher,ABILITY_STRENGTH);
int nRoll=d10()+1;
int nSuccess=0;
if (GetIsPC(oBasher))
{
SendMessageToPC(oBasher,IntToString(nRoll)+" (roll) + "+IntToString(nSTRMod)+" (STR mod) versus DC "+IntToString(nLockDC));
if (nLockDC<=(nRoll+nSTRMod))
{
nSuccess=1;
}
}
return nSuccess;
}
void main()
{
int nSuccessAttempts=0;
object oAttacker=GetLastAttacker();
nSuccessAttempts=DoorBash(oAttacker)+DoorBash(oAttacker);
if (!GetWeaponRanged(GetLastWeaponUsed(oAttacker)))
{
switch(nSuccessAttempts)
{
case 0:
ApplyEffectToObject(DURATION_TYPE_TEMPORARY,EffectKnockdown(),oAttacker,5.0f);
PlayVoiceChat(VOICE_CHAT_CUSS,oAttacker);
break;
case 1:
PlayVoiceChat(VOICE_CHAT_CANTDO,oAttacker);
SendMessageToPC(oAttacker,"You fail to bash the door in.");
break;
default:
SendMessageToPC(oAttacker,"You manage to bash the door open.");
SetLocked(OBJECT_SELF, FALSE);
ActionOpenDoor(OBJECT_SELF);
break;
}
}
else
{
SendMessageToPC(oAttacker,"You cannot bash a door with a missle weapon, silly!");
}
}
ALSO
To close the door and relock it:
This goes in the OnOpen event of the door:
Code: Select all
void main()
{
DelayCommand(10.0, ActionCloseDoor(OBJECT_SELF));
DelayCommand(10.5, ActionDoCommand(SetLocked(OBJECT_SELF, TRUE)));
}
Now, this requires that you do the following:
- Door is set to plot
- Door is set to locked. (( The DC of the lock is the DC of the STR check for the door bash)) Upon a failed doorbash, the attacker will be knocked to his knees,ass.
What ever you set the door lock DC as will be the door bash DC. The door bash DC is overcome by a STR check with this as the check:
STR check for door bash- a d10 plus your str modifier, so if you had a str of 12 and you were trying to bash a door that had a lock DC of 20 you would need to attack the door and a door bash check would be made. This doorbash check would equal a roll od 1d10 plus your STR modifier ((12= plus 1))
IF you rolled an 8 on your roll plus your STR modifier of plus 1 you would be knocked to your ass for 5 seconds.
If you need further explanation, let me know via PM and I'll help ya out
