Bienvenue sur JeuxOnLine - MMO, MMORPG et MOBA !
Les sites de JeuxOnLine...
 

Panneau de contrôle

Recherche | Retour aux forums

JOL Archives

[Script] Protection d'un coffre

Par Daynos le 14/10/2002 à 11:49:24 (#2332449)

Posté par Aelthys :

Un petit script à mettre dans le OnDisturbed d'un objet style Coffre, Armoire... Son proprio réagira si un PJ tente d'y prendre quelque chose.


void main()
{
object oCoffre = OBJECT_SELF;
object oJoueur = GetLastDisturbed();
object oProprio = GetNearestObjectByTag ("TAG_DU_PROPRIO");//Indiquer le tag du propri
// On peut aussi faire: object oProprio = GetNearestCreature (CREATURE_TYPE_IS_ALIVE, TRUE); pour avoir un script non générique.
// Jet de pickpocket du joueur.
int iPPSkillCheck = d20(1) + 1 + GetSkillRank (SKILL_PICK_POCKET, oJoueur);
// Jet de reperer du marchand.
int iSpotCheck = d20(1) + 3 + GetSkillRank (SKILL_SPOT, oProprio);
// Affichage du résultat du jet.
string sSkillCheck = "Pickpocket " + IntToString(iPPSkillCheck) + " vs Reperer " + IntToString(iSpotCheck);
if (iPPSkillCheck > iSpotCheck)
{
// Personne ne remarque le vol.
FloatingTextStringOnCreature (sSkillCheck + " - Personne n'a remarque votre chapardage...", oJoueur);
// Legere baisse de la reputation du joueur. La où il passe, les objets disparaissent...
AdjustReputation (oJoueur, oProprio, -5);
return;
}
else
{
// Vol remarque!
FloatingTextStringOnCreature (sSkillCheck + " - Oups, on vous a vu!", oJoueur);
// Grosse baisse de la reputation
AdjustReputation (oJoueur, oProprio, -20);
//Premiere fois avertissement...
if (GetLocalInt (OBJECT_SELF,"Reac_Marchand") == 0)
{
AssignCommand (oProprio, ActionMoveToObject (oCoffre, TRUE));
AssignCommand (oProprio, ActionSpeakString ("He la! Que je ne vous y reprenne pas!"));
SetLocalInt (OBJECT_SELF, "Reac_Marchand", 1);
}
else
{
//Deuxieme fois attaque...
AssignCommand (oProprio, ActionEquipMostDamagingMelee ());
AssignCommand (oProprio, ActionAttack (oJoueur));
}
}
}


Merci à ZeDuckMaster sans qui rien n'aurait été possible. Une amélioration possible: Que le PJ doive rendre l'objet qu'il vient juste de prendre... Un autre jour peut-être.

JOL Archives 1.0.1
@ JOL / JeuxOnLine