Apparently my script traps the door but the trap then seems to disappear off the door when a PC tries to open the door.
Here is my first script:
void createDoorTrap(object oDoor, object oPC ){
FloatingTextStringOnCreature(" trap door", oPC, FALSE);
if (GetIsTrapped(oDoor)!=TRUE){
CreateTrapOnObject(TRAP_BASE_TYPE_AVERAGE_ACID, oDoor, STANDARD_FACTION_HOSTILE, "empty_trap", "empty_trap");
}
if (GetIsTrapped(oDoor)==TRUE){
FloatingTextStringOnCreature(" trap IS on door", oPC, FALSE);
}else{
FloatingTextStringOnCreature(" trap ISNOT door", oPC, FALSE);
}
SetTrapDisabled(oDoor);
if (GetIsTrapped(oDoor)==TRUE){
FloatingTextStringOnCreature(" trap IS STILL on door", oPC, FALSE);
}else{
FloatingTextStringOnCreature(" trap IS NO LONGER on door", oPC, FALSE);
}
SetTrapDetectable(oDoor, FALSE);
SetTrapDetectedBy(oDoor, oPC, FALSE);
SetTrapDetectDC(oDoor, 250);
SetTrapDisarmable(oDoor, FALSE);
}
and here is the script that fires when the PC tries to open a locked door:
void main(){
oPC = GetClickingObject();
oArea = GetArea(oPC);
//FloatingTextStringOnCreature("Your turn is over.", oPC, FALSE);
endTurn();
//
if( GetLocalInt(oArea, "REMINDER") == TRUE && GetLocalInt(oArea, "DOORS") == TRUE){
FloatingTextStringOnCreature(" door should be trapped", oPC, FALSE);
if (GetIsTrapped(OBJECT_SELF)==TRUE){
FloatingTextStringOnCreature(" door is trapped", oPC, FALSE);
}else{
FloatingTextStringOnCreature(" door is NOT trapped", oPC, FALSE);
}
//set trap on door detected by oPC
SetTrapDetectable(OBJECT_SELF, TRUE);
SetTrapDetectedBy(OBJECT_SELF, oPC, TRUE);
// SetTrapDetectable(OBJECT_SELF, FALSE);
}
//
SoundObjectPlay(GetObjectByTag(GetLocalString(oArea, snd_HITWALL)));
DragonsTurn();
}
The following messages get output:
trap IS on door
trap IS STILL on door
....and later.....
door should be trapped
door is NOT trapped
So is there something wrong with these scripts? Maybe the trap is getting removed elsewhere but this part of my script is very new so I doubt I've had a chance yet to include some such code - how would I have removed a trap from a door anyway?
BTW, i am only useing the trap on the door to cause the door to glow red after someone tries and fails to open it to serve as a reminder that they already tried to open that door.
Thanks.