Voilà deux scripts dont je me sers dans mon module "Tristram Nights" (un peu de pub n'a jamais fait de mal ^^).
Ils me permettent de récompenser les roublards dans leur art du crochetage / désamorçage.
Les scripts vérifient le niveau dans la compétence correspondante et allouent de l'expérience en fonction.
//////////////////////////////////////////////////////////////////////////////// //:: script de recompense XP sur event OnDisarm //////////////////////////////////////////////////////////////////////////////// void main() { object oThief = GetLastDisarmed(); if(!GetIsPC(oThief)) return; int nThiefLevel = GetLevelByClass(CLASS_TYPE_ROGUE, oThief); // Vérifier si l'objet a déjà été désamorcé int nAlreadyDisarmed = GetLocalInt(OBJECT_SELF, "AlreadyDisarmed"); if (nAlreadyDisarmed != 0) return; // Niveau en désamorçage int nDisarmSkill = GetSkillRank(SKILL_DISABLE_TRAP, oThief); // DD du piège int nTrapDC = GetTrapDisarmDC(OBJECT_SELF); float fXPMod = 1.2; int nXPAward = FloatToInt((nTrapDC * fXPMod) + (nThiefLevel * nDisarmSkill)); int nPosition; int nRogueTrue; for (nPosition = 1; nPosition <= 3; nPosition ++) { nRogueTrue = GetLocalInt(oThief, IntToString(GetClassByPosition(nPosition, oThief))); } if (nRogueTrue = CLASS_TYPE_ROGUE) { GiveXPToCreature(oThief, nXPAward); } SetLocalInt(OBJECT_SELF, "AlreadyDisarmed", 1); }
//////////////////////////////////////////////////////////////////////////////// //:: script de recompense XP sur event OnUnlock coffres + portes //////////////////////////////////////////////////////////////////////////////// void main() { object oThief = GetLastUnlocked(); if(!GetIsPC(oThief)) return; int nThiefLevel = GetLevelByClass(CLASS_TYPE_ROGUE, oThief); // Vérifier si l'objet a déjà été crocheté int nAlreadyUnlocked = GetLocalInt(OBJECT_SELF, "AlreadyUnlocked"); if (nAlreadyUnlocked != 0) return; // Niveau en crochetage int nUnlockSkill = GetSkillRank(SKILL_OPEN_LOCK, oThief); // DD du crochetage porte/coffre int nLockDC = GetLockUnlockDC(OBJECT_SELF); float fXPMod = 1.2; int nXPAward = FloatToInt((nLockDC * fXPMod) + (nThiefLevel * nUnlockSkill)); int nPosition; int nRogueTrue; for (nPosition = 1; nPosition <= 3; nPosition ++) { nRogueTrue = GetLocalInt(oThief, IntToString(GetClassByPosition(nPosition, oThief))); } if (nRogueTrue = CLASS_TYPE_ROGUE) { GiveXPToCreature(oThief, nXPAward); } else if (nRogueTrue != CLASS_TYPE_ROGUE) { nXPAward = FloatToInt((nLockDC * fXPMod) + nUnlockSkill); GiveXPToCreature(oThief, nXPAward); } SetLocalInt(OBJECT_SELF, "AlreadyUnlocked", 1); }
|