NOTE: 1 report by a user that said he
could get neither of these scripts to work (and put them in the correct
event slots).
Dynamic XP on Trap Disarm / Lock Unlocking
I wish I could go back and edit my original post to keep the thread
clean. Ah well. I cleaned things up again, as well as decreasing the
complexity of the test. Same gimmick as before, dynamically award XP
based upon the rogue's level and skill versus the difficulty.
For traps, in OnDisarm:
NWScript:
object oThief = GetLastDisarmed();
void main()
{
string sThiefLevel;
int nPosition;
int nRogueTrue;
for (nPosition= 1; nPosition <= 3; nPosition ++)
{
nRogueTrue = GetLocalInt(oThief, IntToString(GetClassByPosition (nPosition, oThief) ));
};
if (nRogueTrue = CLASS_TYPE_ROGUE)
{
sThiefLevel = IntToString(GetLevelByClass (CLASS_TYPE_ROGUE, oThief));
int nDisarmSkill = GetSkillRank(SKILL_DISABLE_TRAP, oThief);
int nTrapDC = GetTrapDisarmDC(OBJECT_SELF);
float fXPMod = 1.2;
int nXPAward = FloatToInt((nTrapDC * fXPMod) - (StringToInt(sThiefLevel) * nDisarmSkill));
GiveXPToCreature (oThief, nXPAward);
}
}
For locks, in OnUnlock:
NWScript:
object oThief = GetLastUnlocked();
void main()
{
string sThiefLevel;
int nPosition;
int nRogueTrue;
for (nPosition = 1; nPosition <= 3; nPosition ++)
{
nRogueTrue = GetLocalInt(oThief, IntToString (GetClassByPosition (nPosition, oThief) ));
};
if (nRogueTrue = CLASS_TYPE_ROGUE)
{
sThiefLevel = IntToString(GetLevelByClass (CLASS_TYPE_ROGUE, oThief) );
int nUnlockSkill = GetSkillRank(SKILL_OPEN_LOCK, oThief);
int nLockDC = GetLockUnlockDC(OBJECT_SELF);
float fXPMod = 1.2;
int nXPAward = FloatToInt((nLockDC * fXPMod) - (StringToInt(sThiefLevel) * nUnlockSkill) );
GiveXPToCreature( oThief, nXPAward);
}
}
As always, drop me a line if you have any trouble with these. Now if
only I can get traps to respawn...
Grrr.. too many characters notification again.
-Tod
|