Here's what I ended up with, seems to work for me.
void main()
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
if (GetLocalInt(OBJECT_SELF,"TRAPS")== 1) return;
SetLocalInt(OBJECT_SELF,"TRAPS",1);
object oTarget = GetNearestObjectByTag("WP_TRAP" + IntToString(d4()));
location lLocation = GetLocation(oTarget);
float fSize;
int nTrapType;
switch(Random()
{
case 0: fSize = 1.0f; break;
case 1: fSize = 1.25f; break;
case 2: fSize = 1.75f; break;
case 3: fSize = 1.00f; break;
case 4: fSize = 1.25f; break;
case 5: fSize = 1.50f; break;
case 6: fSize = 1.75f; break;
case 7: fSize = 2.0f; break;
}
switch(Random(6))
{
case 0: nTrapType = TRAP_BASE_TYPE_MINOR_ACID_SPLASH; break;
case 1: nTrapType = TRAP_BASE_TYPE_MINOR_FROST; break;
case 2: nTrapType = TRAP_BASE_TYPE_MINOR_HOLY; break;
case 3: nTrapType = TRAP_BASE_TYPE_MINOR_NEGATIVE; break;
case 4: nTrapType = TRAP_BASE_TYPE_MINOR_SPIKE; break;
case 5: nTrapType = TRAP_BASE_TYPE_MINOR_TANGLE; break;
}
object oTrap = CreateTrapAtLocation(nTrapType, lLocation, fSize,"", STANDARD_FACTION_HOSTILE, "", "");
SetTrapDetectDC(oTrap, 6+d6());
SetTrapDisarmDC(oTrap, 12+d12());
}
Modifié par kalbaern, 20 juillet 2012 - 01:23 .