No Drop items : Ouinnnnnnnnn :'(

Répondre
Partager Rechercher
on veut faire un objet indropable/invendable/involable/ et inechangeable

les objets ont POB dans leur tags
voila le code

Code PHP:


void main
()

object oJoueur=GetModuleItemLostBy(); 
object oItem=GetModuleItemLost(); 
if ((
FindSubString(GetTag(oItem),"POB")>=0)||(FindSubString(GetTag(oItem),"Emote")>=0)) 

   
object oItemPossessor GetItemPossessor(oItem);
   
vector vItemPos GetPositionFromLocation(GetLocation(oItem));
      if( 
vItemPos == Vector() && GetIsObjectValid(oItemPossessor) == FALSE){
         
//fenetre de trade.. ca craint
         
FloatingTextStringOnCreature("On t'as dit de pas trader ca !!! Annule de suite sinon je t'enleve 1000 xp !!",oJoueur,FALSE);
         
CopyObject(oItem,GetLocation(oJoueur),oJoueur,GetTag(oItem));
         
DestroyObject(oItem,30.0);

      }
      else {
       
// on desactive le pj comme ca il pourra pas la rammasser.. et si qq d'autre le rammasse elle sera detruite de toute facon
        
AssignCommand(oJoueurActionDoCommand(SetCommandable(FALSEoJoueur)));
        
AssignCommand(oJoueurActionDoCommand(DelayCommand(2.0SetCommandable(TRUEoJoueur))));
        
CopyObject(oItem,GetLocation(oJoueur),oJoueur,GetTag(oItem));
        
DestroyObject(oItem,1.0);
        
FloatingTextStringOnCreature("Nan on s'en debarrasse pas comme ca",oJoueur,FALSE);
     }
 }

bon le gros pb.. c'est qd on trade
j'ai pris le if pour savoir si on est en trade dans un script ats
mais de tte facon , il passe jamais dedans
or un destroyobjet sur un item en trade ca fais planter le serveur
comment savoir si le perso trade ?? si l'item est en trade

Aidez moi !!! :'( :'(


A mon avis le plus pratique serait d'utiliser l'évènement OnAcquireItem pour gérer le cas de l'échange et du vol (car le vol aussi ça duplique les objets non droppables avec un code habituel).
Comme ça ça devrais pas être trop difficile
Une structure dans ce goût là peut t'apporter un peu de lumière ?

Code PHP:

  /**************************************************
  * Start of Scott Thorne's "No Drop Items" script
  * This script makes the PC pick "undroppable"
  * items back up and take items back
  * from placeables and other PC's
  * if they decide to drop it or barter it.
  *
  * We will be using this for the subrace spell-like
  * ability items.
  *
  *  - Panduh
  **************************************************/
if (GetIsNoDrop(oDropped) || GetTag(GetArea(oPC))=="FuguePlane")
{

    
object oLostBy GetLocalObject(oDropped"ND_OWNER");
    if (
oLostBy == OBJECT_INVALID)
        {
            
oLostBy oPC;
            
SetLocalObject(oDropped"ND_OWNER",oPC);
        }


    if (
GetIsPC(oLostBy))
    {

        
string sItemName GetName(oDropped);
        
object oPossessor GetItemPossessor(oDropped);

//Debug("Item = " + sItemName);
//Debug("LostBy = " + GetName(oLostBy));
//Debug("Possesor = " + GetName(oPossessor));

        
switch (GetObjectType(oPossessor))
        {

        case 
OBJECT_TYPE_CREATURE:

//Debug("Bartered with a PC or taken by an NPC");
            
break;  /* no action, PC will give it back in OnAcquireItem */


        
case OBJECT_TYPE_STORE:

//Debug("Sold to a merchant");
            
AssignCommand(oLostByActionTakeItem(oDroppedoPossessor));
            
SendMessageToPC(oLostBy"The "sItemName " mysteriously reappears in your pack!");
            break;


        case 
OBJECT_TYPE_PLACEABLE:

//Debug("Placed into a container");
            
AssignCommand(oLostByActionTakeItem(oDroppedoPossessor));
            
SendMessageToPC(oLostBy"The "sItemName " mysteriously reappears in your pack!");
            break;


        default:

            if (
GetIsObjectValid(GetAreaFromLocation(GetLocation(oDropped))))
            {

//Debug("Dropped on the ground");
                
AssignCommand(oLostByActionDoCommand(SetCommandable(FALSEoLostBy)));
                
AssignCommand(oLostByActionSpeakString("Oops, I dropped something!"));
                
AssignCommand(oLostByActionMoveToObject(oDroppedTRUE));
                
AssignCommand(oLostByActionPickUpItem(oDropped));
                
AssignCommand(oLostByActionDoCommand(SetCommandable(TRUEoLostBy)));

            }
            else
            {

                
/* no action, PC will give it back in OnAcquireItem */

            
}

        }  
/* switch */

    
}  /* if GetIsPC() */

}  /* if GetIsNoDrop() */
/**********************************
* End Scott Thorne's No-Drop Script
**********************************/ 
Répondre

Connectés sur ce fil

 
1 connecté (0 membre et 1 invité) Afficher la liste détaillée des connectés