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

Panneau de contrôle

Recherche | Retour aux forums

JOL Archives

[Script] Drops selectif , besoin d aide.

Par Tatouine le 6/12/2002 à 14:20:49 (#2724494)

Bonjour a tous ;)
Voila un ami a moi cree un module et voudrait mettre des chambres fermées a clef .
Dans ce module lorsque l'on meurt on drop toutes ses items .
Le probleme c'est que le clefs se fait droper aussi ....
Comment peut on regler le probleme ...
2 solutions nous semblerais faisable mais nous ne savons pas comment :

Solution 1:
Le PNJ de l auberge (ou il y a les chambre) Doit recuperer la clef avant que le PJ ne puisse sortir .


Solution 2 :
Droper tous sauf la clef ....


Pourriez vous nous donner 1 script permettant de faire cela ?


Merci bien d avance .


:ange:

Par Critias le 6/12/2002 à 14:31:41 (#2724612)

Il n'y a pas la possibilité de rendre indroppable la clef par ses propres caractéristiques ?

Désolé de l'imprécision de ce que je te dis, je n'ai pas Aurora sous les yeux au boulot. (DOmmage :doute: )

Par eMRaistlin le 6/12/2002 à 14:33:05 (#2724626)

Bein, facile : tu met les clef en plot, et elle ne seront plus destructible ^^

Si le drop pose tout au sol, alors tu affecte a toute les clefs le meme tag (ou alors, tu les prefixes toutes avec le meme nom, si tu veux garder les tag, dans ce cas,redemande moi)


et dans le OnPcRespawn, tu insere ceci dans la boucle de vidage de l'inventaire :



//ici et au dessus, c'est la partie de la gestion de la boucle de verif d'inventaire
//genre while (GetIsObjectValid(oInventory...)), suivant le code de ton pote
if (!GetTag(oClef) == "TAG_DE_LA_CLEF")
{
//la partie du drop, comme avant
}
//ici, tu met la partie de la boucle qui incremente l'objet verfié
//(avec getNextItemInInventory, normalement)


voila, ca devrait faire l'affaire

Par Tatouine le 6/12/2002 à 14:59:37 (#2724895)

Provient du message de eMRaistlin


//ici et au dessus, c'est la partie de la gestion de la boucle de verif d'inventaire
//genre while (GetIsObjectValid(oInventory...)), suivant le code de ton pote
if (!GetTag(oClef) == "TAG_DE_LA_CLEF")
{
//la partie du drop, comme avant
}
//ici, tu met la partie de la boucle qui incremente l'objet verfié
//(avec getNextItemInInventory, normalement)


voila, ca devrait faire l'affaire

Wahou merci pour cette reponse rapide :merci:
C'est ce code la car le script k il a mettez les items dans un corp
Merci encor .
ON testera sa ce soir . si jamais on a d autre pbs (un peu NB en prog) on hesitera pas a repasser :bouffon:

Par fauxninja le 6/12/2002 à 16:58:48 (#2725819)

voila le code ke j ai ....



/************************************************************/
/* OnPlayerRespawn script. It takes all of all your current */
/* equipped and inventory items and transfers them into */
/* a corpse on the location which you died in. */
/************************************************************/
/* Created by: Osthman */
/* Date: Saturday, 9/14/02 */
/************************************************************/

#include "nw_i0_plot"

void main()
{
object oRespawner = GetLastRespawnButtonPresser();
object oItem = GetFirstItemInInventory(oRespawner);
// Items currently equiped of the PC.
object oSlot1 = GetItemInSlot(INVENTORY_SLOT_ARMS,oRespawner);
object oSlot2 = GetItemInSlot(INVENTORY_SLOT_ARROWS,oRespawner);
object oSlot3 = GetItemInSlot(INVENTORY_SLOT_BELT,oRespawner);
object oSlot4 = GetItemInSlot(INVENTORY_SLOT_BOLTS,oRespawner);
object oSlot5 = GetItemInSlot(INVENTORY_SLOT_BOOTS,oRespawner);
object oSlot6 = GetItemInSlot(INVENTORY_SLOT_BULLETS,oRespawner);
object oSlot7 = GetItemInSlot(INVENTORY_SLOT_CARMOUR,oRespawner);
object oSlot8 = GetItemInSlot(INVENTORY_SLOT_CHEST,oRespawner);
object oSlot9 = GetItemInSlot(INVENTORY_SLOT_CLOAK,oRespawner);
object oSlot10 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B,oRespawner);
object oSlot11 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L,oRespawner);
object oSlot12 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R,oRespawner);
object oSlot13 = GetItemInSlot(INVENTORY_SLOT_HEAD,oRespawner);
object oSlot14 = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oRespawner);
object oSlot15 = GetItemInSlot(INVENTORY_SLOT_LEFTRING,oRespawner);
object oSlot16 = GetItemInSlot(INVENTORY_SLOT_NECK,oRespawner);
object oSlot17 = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oRespawner);
object oSlot18 = GetItemInSlot(INVENTORY_SLOT_RIGHTRING,oRespawner);


// Gets the location that was set on the module when he/she died.
location lDeathSpot = GetLocalLocation(GetModule(),"+GetName(oRespawner)+" Death");

// Checks to see if the PC has alteast 1 valid object in their inventory, if not,
// don't create another body.
if (GetFirstItemInInventory(oRespawner) == OBJECT_INVALID && oSlot1 == OBJECT_INVALID
&& oSlot2 == OBJECT_INVALID && oSlot3 == OBJECT_INVALID && oSlot4 == OBJECT_INVALID
&& oSlot5 == OBJECT_INVALID && oSlot6 == OBJECT_INVALID && oSlot7 == OBJECT_INVALID
&& oSlot8 == OBJECT_INVALID && oSlot9 == OBJECT_INVALID && oSlot10 == OBJECT_INVALID
&& oSlot11 == OBJECT_INVALID && oSlot12 == OBJECT_INVALID && oSlot13 == OBJECT_INVALID
&& oSlot14 == OBJECT_INVALID && oSlot15 == OBJECT_INVALID && oSlot16 == OBJECT_INVALID
&& oSlot17 == OBJECT_INVALID && oSlot18 == OBJECT_INVALID && GetGold(oRespawner) == 0)
{
// Jumps the PC immediately to the place(s) you want them to respawn,
// instead of having a delay of 2 seconds.

ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
RemoveEffects(oRespawner);

// Location(s) of were the player respawns
AssignCommand(oRespawner,JumpToLocation(GetLocation(GetObjectByTag("TEST_WAYPOINT"))));
}
else
{
DelayCommand(2.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner));
DelayCommand(2.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner));
DelayCommand(2.0,RemoveEffects(oRespawner));

// Make sure you have a created a custom placeable object with the apperance
// of a body, has the boxes checked in plot item, useable, has inventory
// and it has the script posted above attached on the "OnClosed" event of the placeable.
// Change the resref tag here if you have a different one on it.
object oCorpse = CreateObject(OBJECT_TYPE_PLACEABLE,"corpse",lDeathSpot);

// Takes all currently equiped weapons from the PC.
AssignCommand(oCorpse,ActionTakeItem(oSlot1,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot2,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot3,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot4,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot5,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot6,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot7,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot8,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot9,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot10,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot11,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot12,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot13,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot14,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot15,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot16,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot17,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot18,oRespawner));

// Takes all items on the PC's inventory.

while (GetIsObjectValid(oItem))
{
AssignCommand(oCorpse,ActionTakeItem(oItem,oRespawner));
oItem = GetNextItemInInventory(oRespawner);
}

// Takes gold also.
AssignCommand(oCorpse,TakeGoldFromCreature(GetGold(oRespawner),oRespawner));

// Here make them respawn to the place(s) you want the PC to respawn, but make
// sure that the "jumping" is delayed for 2 seconds since the other effects
// are delayed for 2 seconds also, so if you change that you need to change this.
DelayCommand(2.0,AssignCommand(oRespawner,ActionJumpToLocation(GetLocation(GetObjectByTag("TEST_WAYPOINT")))));
}


}





et je voudrais que sa ne drop pas les clefs .... je doit inseret quoi et ou ???
Pour toutes les clef pas seulement par le tag d une clef ....

Par eMRaistlin le 6/12/2002 à 17:04:26 (#2725874)

Je veux bien te gerer ca pour toute les clefs, mais dans ce cas, il va falloir etablir une charte :

genre

- le nom de l'item commence toujours par "clef" ou
- Le nom de l'item fini toujours par "clef"

Sinon, ce ne sera pas possible de grouper.

A moi que je ne le gere par une liste des tags possiblme des clef (ou des noms), mais tu devra te taper le listing...

Par fauxninja le 6/12/2002 à 17:13:49 (#2725957)

c'est du nom ou du tag que tu parle? il fau que les tags commencent pareil ou que les noms commencent pareil?
on va dire que c pour les noms, c facile de les faire commencer pareil, alors si tu peu me faire quelque chose pour eux... clef-- voila ca comencera par clef puis quelque chose. ( on peu mettre un espace apres clef?)

exemple: ya plein de clef du type:
clef de la chambre
clef du salon
clef des enfers

et il fau qu'elles soient toutes indropables...

il fau rajouter quelque chose dans le programme pour faire tout dropper? ou faire un auntre programme?

merci!

Par eMRaistlin le 6/12/2002 à 17:21:57 (#2726037)

Voila.

A noter que le NOM de l'item doit commencer par "Clef" (avec ou sans majuscule)


/************************************************************/
/* OnPlayerRespawn script. It takes all of all your current */
/* equipped and inventory items and transfers them into */
/* a corpse on the location which you died in. */
/************************************************************/
/* Created by: Osthman */
/* Date: Saturday, 9/14/02 */
/************************************************************/

#include "nw_i0_plot"

void main()
{
object oRespawner = GetLastRespawnButtonPresser();
object oItem = GetFirstItemInInventory(oRespawner);
// Items currently equiped of the PC.
object oSlot1 = GetItemInSlot(INVENTORY_SLOT_ARMS,oRespawner);
object oSlot2 = GetItemInSlot(INVENTORY_SLOT_ARROWS,oRespawner);
object oSlot3 = GetItemInSlot(INVENTORY_SLOT_BELT,oRespawner);
object oSlot4 = GetItemInSlot(INVENTORY_SLOT_BOLTS,oRespawner);
object oSlot5 = GetItemInSlot(INVENTORY_SLOT_BOOTS,oRespawner);
object oSlot6 = GetItemInSlot(INVENTORY_SLOT_BULLETS,oRespawner);
object oSlot7 = GetItemInSlot(INVENTORY_SLOT_CARMOUR,oRespawner);
object oSlot8 = GetItemInSlot(INVENTORY_SLOT_CHEST,oRespawner);
object oSlot9 = GetItemInSlot(INVENTORY_SLOT_CLOAK,oRespawner);
object oSlot10 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_B,oRespawner);
object oSlot11 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_L,oRespawner);
object oSlot12 = GetItemInSlot(INVENTORY_SLOT_CWEAPON_R,oRespawner);
object oSlot13 = GetItemInSlot(INVENTORY_SLOT_HEAD,oRespawner);
object oSlot14 = GetItemInSlot(INVENTORY_SLOT_LEFTHAND,oRespawner);
object oSlot15 = GetItemInSlot(INVENTORY_SLOT_LEFTRING,oRespawner);
object oSlot16 = GetItemInSlot(INVENTORY_SLOT_NECK,oRespawner);
object oSlot17 = GetItemInSlot(INVENTORY_SLOT_RIGHTHAND,oRespawner);
object oSlot18 = GetItemInSlot(INVENTORY_SLOT_RIGHTRING,oRespawner);


// Gets the location that was set on the module when he/she died.
location lDeathSpot = GetLocalLocation(GetModule(),"+GetName(oRespawner)+" Death");

// Checks to see if the PC has alteast 1 valid object in their inventory, if not,
// don't create another body.
if (GetFirstItemInInventory(oRespawner) == OBJECT_INVALID && oSlot1 == OBJECT_INVALID
&& oSlot2 == OBJECT_INVALID && oSlot3 == OBJECT_INVALID && oSlot4 == OBJECT_INVALID
&& oSlot5 == OBJECT_INVALID && oSlot6 == OBJECT_INVALID && oSlot7 == OBJECT_INVALID
&& oSlot8 == OBJECT_INVALID && oSlot9 == OBJECT_INVALID && oSlot10 == OBJECT_INVALID
&& oSlot11 == OBJECT_INVALID && oSlot12 == OBJECT_INVALID && oSlot13 == OBJECT_INVALID
&& oSlot14 == OBJECT_INVALID && oSlot15 == OBJECT_INVALID && oSlot16 == OBJECT_INVALID
&& oSlot17 == OBJECT_INVALID && oSlot18 == OBJECT_INVALID && GetGold(oRespawner) == 0)
{
// Jumps the PC immediately to the place(s) you want them to respawn,
// instead of having a delay of 2 seconds.

ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner);
RemoveEffects(oRespawner);

// Location(s) of were the player respawns
AssignCommand(oRespawner,JumpToLocation(GetLocation(GetObjectByTag("TEST_WAYPOINT"))));
}
else
{
DelayCommand(2.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner));
DelayCommand(2.0,ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oRespawner)), oRespawner));
DelayCommand(2.0,RemoveEffects(oRespawner));

// Make sure you have a created a custom placeable object with the apperance
// of a body, has the boxes checked in plot item, useable, has inventory
// and it has the script posted above attached on the "OnClosed" event of the placeable.
// Change the resref tag here if you have a different one on it.
object oCorpse = CreateObject(OBJECT_TYPE_PLACEABLE,"corpse",lDeathSpot);

// Takes all currently equiped weapons from the PC.
AssignCommand(oCorpse,ActionTakeItem(oSlot1,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot2,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot3,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot4,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot5,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot6,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot7,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot8,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot9,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot10,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot11,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot12,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot13,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot14,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot15,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot16,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot17,oRespawner));
AssignCommand(oCorpse,ActionTakeItem(oSlot18,oRespawner));

// Takes all items on the PC's inventory.

while (GetIsObjectValid(oItem))
{
if (GetStringUpperCase(GetStringLeft(GetName(oItem),4)) != "CLEF") //ICI MODIF eMRaistlin
{ //ICI MODIF eMRaistlin
AssignCommand(oCorpse,ActionTakeItem(oItem,oRespawner));
} //ICI MODIF eMRaistlin
oItem = GetNextItemInInventory(oRespawner);
}

// Takes gold also.
AssignCommand(oCorpse,TakeGoldFromCreature(GetGold(oRespawner),oRespawner));

// Here make them respawn to the place(s) you want the PC to respawn, but make
// sure that the "jumping" is delayed for 2 seconds since the other effects
// are delayed for 2 seconds also, so if you change that you need to change this.
DelayCommand(2.0,AssignCommand(oRespawner,ActionJumpToLocation(GetLocation(GetObjectByTag("TEST_WAYPOINT")))));
}


}

Par fauxninja le 6/12/2002 à 17:39:59 (#2726172)

08/02/00 00:42:14 : Erreur. 'onplayerrespawn2' nest pas compilé.
onplayerrespawn2.nss(96): ERREUR : DECLARATION DOES NOT MATCH PARAMETERS

c cette ligne: if (GetStringUpperCase(GetStringLeft(oItem,4)) != "CLEF") //ICI MODIF eMRaistlin

Par eMRaistlin le 6/12/2002 à 17:41:20 (#2726183)

arfff evidement... chui trop con des fois...


J'edite mon post

JOL Archives 1.0.1
@ JOL / JeuxOnLine