Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.77 KB | None | 0 0
  1. /* Item: Blood Syringe
  2. Created by: Laughing Octopus
  3. Script that executes on activate(touch).
  4. Creates a second item in the user's inventory representing the target's blood. */
  5.  
  6. #include "x0_i0_match"
  7.  
  8. void main()
  9. {
  10.     //Define Varibles
  11.     object oItem = GetItemActivated();
  12.     object oPC = GetItemActivator();
  13.     object oTarget = GetItemActivatedTarget();
  14.     string sBlood = GetName(oTarget);
  15.     string sTrueBlood = GetName(oTarget, TRUE);
  16.     string sNoBlood = "The target has no blood to draw.";
  17.  
  18.     //Determine if target is a creature
  19.     if(GetObjectType(oTarget) == OBJECT_TYPE_CREATURE) {
  20.  
  21.         //Determine if creature is a valid type
  22.         switch(GetRacialType(oTarget)) {
  23.             case RACIAL_TYPE_CONSTRUCT: SendMessageToPC(oPC, sNoBlood); break;
  24.             case RACIAL_TYPE_UNDEAD: SendMessageToPC(oPC, sNoBlood); break;
  25.             case RACIAL_TYPE_ELEMENTAL: SendMessageToPC(oPC, sNoBlood); break;
  26.             case RACIAL_TYPE_INVALID: SendMessageToPC(oPC, sNoBlood); break;
  27.             default:
  28.                
  29.                 //Petrified people have petrified blood
  30.                 if(GetHasEffect(EFFECT_TYPE_PETRIFY, oTarget) != TRUE) {
  31.                    
  32.                     //Determine if target is willing or helpless
  33.                     if((oTarget == oPC)  //willing
  34.                     || GetHasEffect(EFFECT_TYPE_CHARMED, oTarget)  //willing
  35.                     || GetHasEffect(EFFECT_TYPE_SLEEP, oTarget)  //helpless
  36.                     || GetHasEffect(EFFECT_TYPE_PARALYZE, oTarget)  //helpless
  37.                     ) {
  38.  
  39.                         //Create sample and apply name variable
  40.                         object oBlood = CreateItemOnObject("emb_itm_blood", oPC);
  41.                         SetName(oBlood, sBlood+"'s Blood");
  42.                         SetLocalString(oBlood, "BloodOwner", sTrueBlood);
  43.  
  44.                     } else {SendMessageToPC(oPC, "The target is not willing or helpless.");}
  45.                 } else {SendMessageToPC(oPC, sNoBlood);}
  46.         }
  47.     } else {SendMessageToPC(oPC, "The target is not a creature.");}
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement