SHARE
TWEET

OnActivate TD

a guest Apr 2nd, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //::///////////////////////////////////////////////
  2. //:: DMFI - widget activation processor
  3. //:: dmfi_activate
  4. //:://////////////////////////////////////////////
  5. /*
  6.   Functions to respond and process DMFI item activations.
  7. */
  8. //:://////////////////////////////////////////////
  9. //:: Created By: The DMFI Team
  10. //:: Created On:
  11. //:://////////////////////////////////////////////
  12. //:: 2008.05.25 tsunami282 - changes to invisible listeners to work with
  13. //::                         OnPlayerChat methods.
  14. //:: 2008.07.10 tsunami282 - add Naming Wand to the exploder.
  15. //:: 2008.08.15 tsunami282 - move init logic to new include.
  16.  
  17. #include "dmfi_init_inc"
  18. #include "x2_inc_switches"
  19.  
  20. ////////////////////////////////////////////////////////////////////////
  21. void dmw_CleanUp(object oMySpeaker)
  22. {
  23.    int nCount;
  24.    int nCache;
  25.    DeleteLocalObject(oMySpeaker, "dmfi_univ_target");
  26.    DeleteLocalLocation(oMySpeaker, "dmfi_univ_location");
  27.    DeleteLocalObject(oMySpeaker, "dmw_item");
  28.    DeleteLocalString(oMySpeaker, "dmw_repamt");
  29.    DeleteLocalString(oMySpeaker, "dmw_repargs");
  30.    nCache = GetLocalInt(oMySpeaker, "dmw_playercache");
  31.    for(nCount = 1; nCount <= nCache; nCount++)
  32.    {
  33.       DeleteLocalObject(oMySpeaker, "dmw_playercache" + IntToString(nCount));
  34.    }
  35.    DeleteLocalInt(oMySpeaker, "dmw_playercache");
  36.    nCache = GetLocalInt(oMySpeaker, "dmw_itemcache");
  37.    for(nCount = 1; nCount <= nCache; nCount++)
  38.    {
  39.       DeleteLocalObject(oMySpeaker, "dmw_itemcache" + IntToString(nCount));
  40.    }
  41.    DeleteLocalInt(oMySpeaker, "dmw_itemcache");
  42.    for(nCount = 1; nCount <= 10; nCount++)
  43.    {
  44.       DeleteLocalString(oMySpeaker, "dmw_dialog" + IntToString(nCount));
  45.       DeleteLocalString(oMySpeaker, "dmw_function" + IntToString(nCount));
  46.       DeleteLocalString(oMySpeaker, "dmw_params" + IntToString(nCount));
  47.    }
  48.    DeleteLocalString(oMySpeaker, "dmw_playerfunc");
  49.    DeleteLocalInt(oMySpeaker, "dmw_started");
  50. }
  51.  
  52. ////////////////////////////////////////////////////////////////////////
  53. void main()
  54. {
  55.  
  56.     object oUser = OBJECT_SELF;
  57.     object oItem = GetLocalObject(oUser, "dmfi_item");
  58.     object oOther = GetLocalObject(oUser, "dmfi_target");
  59.     location lLocation = GetLocalLocation(oUser, "dmfi_location");
  60.     string sItemTag = GetTag(oItem);
  61.  
  62.     // listening system initialization moved to new function
  63.     dmfiInitialize(oUser);
  64.  
  65.     dmw_CleanUp(oUser);
  66.  
  67.     if (GetStringLeft(sItemTag,8) == "hlslang_")
  68.     {
  69.         // Remove voice stuff
  70.         string ssLanguage = GetStringRight(sItemTag, GetStringLength(sItemTag) - 8);
  71.         SetLocalInt(oUser, "hls_MyLanguage", StringToInt(ssLanguage));
  72.         SetLocalString(oUser, "hls_MyLanguageName", GetName(oItem));
  73.         DelayCommand(1.0f, FloatingTextStringOnCreature("You are speaking " + GetName(oItem) + ". Type [(what you want to say in brackets)]", oUser, FALSE));
  74.         return;
  75.     }
  76.  
  77.     if (GetStringLeft(sItemTag, 8) == "dmfi_pc_")
  78.     {
  79.         if (GetStringLeft(sItemTag, 12) == "dmfi_pc_rest")
  80.         {
  81.             CreateObject(OBJECT_TYPE_PLACEABLE, "dmfi_rest" + GetStringRight(sItemTag, 3), GetLocation(oUser));
  82.             return;
  83.         }
  84.         if (sItemTag == "dmfi_pc_follow")
  85.         {
  86.             if (GetIsObjectValid(oOther))
  87.             {
  88.                 FloatingTextStringOnCreature("Now following "+ GetName(oOther),oUser, FALSE);
  89.                 DelayCommand(2.0f, AssignCommand(oUser, ActionForceFollowObject(oOther, 2.0f)));
  90.             }
  91.             return;
  92.         }
  93.         SetLocalObject(oUser, "dmfi_univ_target", oUser);
  94.         SetLocalLocation(oUser, "dmfi_univ_location", lLocation);
  95.         SetLocalString(oUser, "dmfi_univ_conv", GetStringRight(sItemTag, GetStringLength(sItemTag) - 5));
  96.         AssignCommand(oUser, ClearAllActions());
  97.         AssignCommand(oUser, ActionStartConversation(OBJECT_SELF, "dmfi_universal", TRUE));
  98.         return;
  99.     }
  100.  
  101.     if (GetStringLeft(sItemTag, 5) == "dmfi_")
  102.     {
  103.         int iPass = FALSE;
  104.  
  105.         if (GetIsDM(oUser) || GetIsDMPossessed(oUser))
  106.             iPass = TRUE;
  107.  
  108.         if (!GetIsPC(oUser))
  109.             iPass = TRUE;
  110.  
  111.         if (!iPass)
  112.         {
  113.             FloatingTextStringOnCreature("You cannot use this item." ,oUser, FALSE);
  114.             SendMessageToAllDMs(GetName(oUser)+ " is attempting to use a DM item.");
  115.             return;
  116.         }
  117.  
  118.         if (sItemTag == "dmfi_exploder")
  119.         {
  120.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_afflict"))) CreateItemOnObject("dmfi_afflict", oOther);
  121.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_dicebag"))) CreateItemOnObject("dmfi_dicebag", oOther);
  122.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_pc_dicebag"))) CreateItemOnObject("dmfi_pc_dicebag", oOther);
  123.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_pc_follow"))) CreateItemOnObject("dmfi_pc_follow", oOther);
  124.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_pc_emote"))) CreateItemOnObject("dmfi_pc_emote", oOther);
  125.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_server"))) CreateItemOnObject("dmfi_server", oOther);
  126.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_emote"))) CreateItemOnObject("dmfi_emote", oOther);
  127.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_encounter"))) CreateItemOnObject("dmfi_encounte", oOther);
  128.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_faction"))) CreateItemOnObject("dmfi_faction", oOther);
  129.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_fx"))) CreateItemOnObject("dmfi_fx", oOther);
  130.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_music"))) CreateItemOnObject("dmfi_music", oOther);
  131.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_sound"))) CreateItemOnObject("dmfi_sound", oOther);
  132.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_voice"))) CreateItemOnObject("dmfi_voice", oOther);
  133.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_xp"))) CreateItemOnObject("dmfi_xp", oOther);
  134.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_500xp"))) CreateItemOnObject("dmfi_500xp", oOther);
  135.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_en_ditto"))) CreateItemOnObject("dmfi_en_ditto", oOther);
  136.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_mute"))) CreateItemOnObject("dmfi_mute", oOther);
  137.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_peace"))) CreateItemOnObject("dmfi_peace", oOther);
  138.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_voicewidget"))) CreateItemOnObject("dmfi_voicewidget", oOther);
  139.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_remove"))) CreateItemOnObject("dmfi_remove", oOther);
  140.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_dmw"))) CreateItemOnObject("dmfi_dmw", oOther);
  141.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_target"))) CreateItemOnObject("dmfi_target", oOther);
  142.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_buff"))) CreateItemOnObject("dmfi_buff", oOther);
  143.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_dmbook"))) CreateItemOnObject("dmfi_dmbook", oOther);
  144.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_playerbook"))) CreateItemOnObject("dmfi_playerbook", oOther);
  145.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_jail_widget"))) CreateItemOnObject("dmfi_jail_widget", oOther);
  146.             // 2008.07.10 tsunami282 - add naming wand to the exploder
  147.             if(!GetIsObjectValid(GetItemPossessedBy(oOther, "dmfi_naming"))) CreateItemOnObject("dmfi_naming", oOther);
  148.             return;
  149.         }
  150.         if (sItemTag == "dmfi_peace")
  151.         {   //This widget sets all creatures in the area to a neutral stance and clears combat.
  152.             object oArea = GetFirstObjectInArea(GetArea(oUser));
  153.             object oP;
  154.             while (GetIsObjectValid(oArea))
  155.             {
  156.                 if (GetObjectType(oArea) == OBJECT_TYPE_CREATURE && !GetIsPC(oArea))
  157.                 {
  158.                     AssignCommand(oArea, ClearAllActions());
  159.                     oP = GetFirstPC();
  160.                     while (GetIsObjectValid(oP))
  161.                     {
  162.                         if (GetArea(oP) == GetArea(oUser))
  163.                         {
  164.                             ClearPersonalReputation(oArea, oP);
  165.                             SetStandardFactionReputation(STANDARD_FACTION_HOSTILE, 25, oP);
  166.                             SetStandardFactionReputation(STANDARD_FACTION_COMMONER, 91, oP);
  167.                             SetStandardFactionReputation(STANDARD_FACTION_MERCHANT, 91, oP);
  168.                             SetStandardFactionReputation(STANDARD_FACTION_DEFENDER, 91, oP);
  169.                         }
  170.                         oP = GetNextPC();
  171.                     }
  172.                     AssignCommand(oArea, ClearAllActions());
  173.                 }
  174.                 oArea = GetNextObjectInArea(GetArea(oUser));
  175.             }
  176.         }
  177.  
  178.         // update / remove invisible listeners as needed for onplayerchat
  179.         if (sItemTag == "dmfi_voicewidget")
  180.         {
  181.             object oVoice;
  182.             if (GetIsObjectValid(oOther)) // do we have a valid target creature?
  183.             {
  184.                 // 2008.05.29 tsunami282 - we don't use creature listen stuff anymore
  185.                 SetLocalObject(oUser, "dmfi_VoiceTarget", oOther);
  186.  
  187.                 FloatingTextStringOnCreature("You have targeted " + GetName(oOther) + " with the Voice Widget", oUser, FALSE);
  188.  
  189.                 if (GetLocalInt(GetModule(), "dmfi_voice_initial")!=1)
  190.                 {
  191.                     SetLocalInt(GetModule(), "dmfi_voice_initial", 1);
  192.                     SendMessageToAllDMs("Listening Initialized:  .commands, .skill checks, and much more now available.");
  193.                     DelayCommand(4.0, FloatingTextStringOnCreature("Listening Initialized:  .commands, .skill checks, and more available", oUser));
  194.                 }
  195.                 return;
  196.             }
  197.             else // no valid target of voice wand
  198.             {
  199.                 //Jump any existing Voice attached to the user
  200.                 if (GetIsObjectValid(GetLocalObject(oUser, "dmfi_StaticVoice")))
  201.                 {
  202.                     DestroyObject(GetLocalObject(oUser, "dmfi_StaticVoice"));
  203.                 }
  204.                 //Create the StationaryVoice
  205.                 object oStaticVoice = CreateObject(OBJECT_TYPE_CREATURE, "dmfi_voice", GetLocation(oUser));
  206.                 //Set Ownership of the Voice to the User
  207.                 SetLocalObject(oUser, "dmfi_StaticVoice", oVoice);
  208.                 SetLocalObject(oUser, "dmfi_VoiceTarget", oStaticVoice);
  209.                 DelayCommand(1.0f, FloatingTextStringOnCreature("A Stationary Voice has been created.", oUser, FALSE));
  210.                 return;
  211.             }
  212.             return;
  213.         }
  214.         if (sItemTag == "dmfi_mute")
  215.         {
  216.             SetLocalObject(oUser, "dmfi_univ_target", oUser);
  217.             SetLocalString(oUser, "dmfi_univ_conv", "voice");
  218.             SetLocalInt(oUser, "dmfi_univ_int", 8);
  219.             ExecuteScript("dmfi_execute", oUser);
  220.             return;
  221.         }
  222.         //encounter ditto widget
  223.         if (sItemTag == "dmfi_en_ditto")
  224.         {
  225.             SetLocalObject(oUser, "dmfi_univ_target", oOther);
  226.             SetLocalLocation(oUser, "dmfi_univ_location", lLocation);
  227.             SetLocalString(oUser, "dmfi_univ_conv", "encounter");
  228.             SetLocalInt(oUser, "dmfi_univ_int", GetLocalInt(oUser, "EncounterType"));
  229.             ExecuteScript("dmfi_execute", oUser);
  230.             return;
  231.         }
  232.         //Change target widget
  233.         if (sItemTag == "dmfi_target")
  234.         {
  235.             SetLocalObject(oUser, "dmfi_univ_target", oOther);
  236.             FloatingTextStringOnCreature("DMFI Target set to " + GetName(oOther),oUser);
  237.         }
  238.         //Destroy object widget
  239.         if (sItemTag == "dmfi_remove")
  240.         {
  241.             object oKillMe;
  242.             //Targeting Self
  243.             if (oUser == oOther)
  244.             {
  245.                 oKillMe = GetNearestObject(OBJECT_TYPE_PLACEABLE, oUser);
  246.                 FloatingTextStringOnCreature("Destroyed " + GetName(oKillMe) + "(" + GetTag(oKillMe) + ")", oUser, FALSE);
  247.                 DelayCommand(0.1f, DestroyObject(oKillMe));
  248.             }
  249.             else if (GetIsObjectValid(oOther)) //Targeting something else
  250.             {
  251.                 FloatingTextStringOnCreature("Destroyed " + GetName(oOther) + "(" + GetTag(oOther) + ")", oUser, FALSE);
  252.                 DelayCommand(0.1f, DestroyObject(oOther));
  253.             }
  254.             else //Targeting the ground
  255.             {
  256.                 int iReport = 0;
  257.                 oKillMe = GetFirstObjectInShape(SHAPE_SPHERE, 2.0f, lLocation, FALSE, OBJECT_TYPE_ALL);
  258.                 while (GetIsObjectValid(oKillMe))
  259.                 {
  260.                     iReport++;
  261.                     DestroyObject(oKillMe);
  262.                     oKillMe = GetNextObjectInShape(SHAPE_SPHERE, 2.0f, lLocation, FALSE, OBJECT_TYPE_ALL);
  263.                 }
  264.                 FloatingTextStringOnCreature("Destroyed " + IntToString(iReport) + " objects.", oUser, FALSE);
  265.             }
  266.             return;
  267.         }
  268.         if (sItemTag == "dmfi_500xp")
  269.         {
  270.             SetLocalObject(oUser, "dmfi_univ_target", oOther);
  271.             SetLocalLocation(oUser, "dmfi_univ_location", lLocation);
  272.             SetLocalString(oUser, "dmfi_univ_conv", "xp");
  273.             SetLocalInt(oUser, "dmfi_univ_int", 53);
  274.             ExecuteScript("dmfi_execute", oUser);
  275.             return;
  276.         }
  277.         if (sItemTag == "dmfi_jail_widget")
  278.         {
  279.             if (GetIsObjectValid(oOther) && !GetIsDM(oOther) && oOther != oUser)
  280.             {
  281.                 object oJail = GetObjectByTag("dmfi_jail");
  282.                 if (!GetIsObjectValid(oJail))
  283.                     oJail = GetObjectByTag("dmfi_jail_default");
  284.                 AssignCommand(oOther, ClearAllActions());
  285.                 AssignCommand(oOther, JumpToObject(oJail));
  286.                 SendMessageToPC(oUser, GetName(oOther) + " (" + GetPCPublicCDKey(oOther) + ")/IP: " + GetPCIPAddress(oOther) + " - has been sent to Jail.");
  287.             }
  288.             return;
  289.         }
  290.  
  291.         if (sItemTag == "dmfi_encounter")
  292.         {
  293.  
  294.             if (GetIsObjectValid(GetWaypointByTag("DMFI_E1")))
  295.                 SetCustomToken(20771, GetName(GetWaypointByTag("DMFI_E1")));
  296.             else
  297.                 SetCustomToken(20771, "Encounter Invalid");
  298.             if (GetIsObjectValid(GetWaypointByTag("DMFI_E2")))
  299.                 SetCustomToken(20772, GetName(GetWaypointByTag("DMFI_E2")));
  300.             else
  301.                 SetCustomToken(20772, "Encounter Invalid");
  302.             if (GetIsObjectValid(GetWaypointByTag("DMFI_E3")))
  303.                 SetCustomToken(20773, GetName(GetWaypointByTag("DMFI_E3")));
  304.             else
  305.                 SetCustomToken(20773, "Encounter Invalid");
  306.             if (GetIsObjectValid(GetWaypointByTag("DMFI_E4")))
  307.                 SetCustomToken(20774, GetName(GetWaypointByTag("DMFI_E4")));
  308.             else
  309.                 SetCustomToken(20774, "Encounter Invalid");
  310.             if (GetIsObjectValid(GetWaypointByTag("DMFI_E5")))
  311.                 SetCustomToken(20775, GetName(GetWaypointByTag("DMFI_E5")));
  312.             else
  313.                 SetCustomToken(20775, "Encounter Invalid");
  314.             if (GetIsObjectValid(GetWaypointByTag("DMFI_E6")))
  315.                 SetCustomToken(20776, GetName(GetWaypointByTag("DMFI_E6")));
  316.             else
  317.                 SetCustomToken(20776, "Encounter Invalid");
  318.             if (GetIsObjectValid(GetWaypointByTag("DMFI_E7")))
  319.                 SetCustomToken(20777, GetName(GetWaypointByTag("DMFI_E7")));
  320.             else
  321.                 SetCustomToken(20777, "Encounter Invalid");
  322.             if (GetIsObjectValid(GetWaypointByTag("DMFI_E8")))
  323.                 SetCustomToken(20778, GetName(GetWaypointByTag("DMFI_E8")));
  324.             else
  325.                 SetCustomToken(20778, "Encounter Invalid");
  326.             if (GetIsObjectValid(GetWaypointByTag("DMFI_E9")))
  327.                 SetCustomToken(20779, GetName(GetWaypointByTag("DMFI_E9")));
  328.             else
  329.                 SetCustomToken(20779, "Encounter Invalid");
  330.         }
  331.         if (sItemTag == "dmfi_afflict")
  332.         {
  333.             int nDNum;
  334.  
  335.             nDNum = GetLocalInt(oUser, "dmfi_damagemodifier");
  336.             SetCustomToken(20780, IntToString(nDNum));
  337.         }
  338.  
  339.  
  340.         SetLocalObject(oUser, "dmfi_univ_target", oOther);
  341.         SetLocalLocation(oUser, "dmfi_univ_location", lLocation);
  342.         SetLocalString(oUser, "dmfi_univ_conv", GetStringRight(sItemTag, GetStringLength(sItemTag) - 5));
  343.         AssignCommand(oUser, ClearAllActions());
  344.         AssignCommand(oUser, ActionStartConversation(OBJECT_SELF, "dmfi_universal", TRUE, FALSE));
  345.     }
  346.  
  347. /////////////////////////////////////Tierras Desoladas/////////////////////////////////
  348.  
  349.  
  350. {
  351.      object oItem = GetItemActivated();
  352.      object oPC = GetItemActivator();
  353.      object oTarget = GetItemActivatedTarget();
  354.      location locDestino = GetItemActivatedTargetLocation();
  355.      object oJug = GetItemPossessedBy(oTarget,"rh_obj_lvl_pj");
  356.  
  357.  
  358.      // * Generic Item Script Execution Code
  359.      // * If MODULE_SWITCH_EXECUTE_TAGBASED_SCRIPTS is set to TRUE on the module,
  360.      // * it will execute a script that has the same name as the item's tag
  361.      // * inside this script you can manage scripts for all events by checking against
  362.      // * GetUserDefinedItemEventNumber(). See x2_it_example.nss
  363.      if (GetModuleSwitchValue(MODULE_SWITCH_ENABLE_TAGBASED_SCRIPTS) == TRUE)
  364.      {
  365.         SetUserDefinedItemEventNumber(X2_ITEM_EVENT_ACTIVATE);
  366.         int nRet =   ExecuteScriptAndReturnInt(GetUserDefinedItemEventScriptName(oItem),OBJECT_SELF);
  367.         if (nRet == X2_EXECUTE_SCRIPT_END)
  368.         {
  369.            return;
  370.         }
  371.  
  372.      }
  373.  
  374.  
  375. {
  376. }
  377.  
  378.  
  379.  
  380. //--------------------------- HOGUERA -------------------------
  381.  
  382. if(GetTag(oItem) == "ja_pedernal")
  383. {
  384.    //Asignamos la orden de su uso, crear una hoguera.
  385.    CreateObject(OBJECT_TYPE_PLACEABLE, "rh_hoguera", locDestino, TRUE);
  386.    return;
  387. }
  388.  
  389.  
  390.  
  391.  
  392.  
  393. int iSkillRoll;
  394.     iSkillRoll = d20();
  395.     int iHealingKitDifficulty1;
  396.     int iHealingRank = GetSkillRank(SKILL_HEAL, oPC);
  397.     int iHealingRank1 = iHealingRank + iSkillRoll;
  398.     //int iExpertHealerBonus = iHealingRank / 5;
  399.     int iMaxHPTarget1 = GetMaxHitPoints(oTarget);
  400.     int iCurHPTarget1 = GetCurrentHitPoints(oTarget);
  401.     int iHPOfTargetDifference1 = (iHealingRank1 + GetHitDice(oPC));
  402.     int iRoll;
  403.     int iHealedHP;
  404.     iHealedHP = d20()+(iMaxHPTarget1 / 5 );
  405.     effect eEffects;
  406.     effect eHeal;
  407.     eHeal = EffectVisualEffect(VFX_IMP_HEALING_L);
  408.  
  409. if (GetTag(oItem) == "ja_vendas")
  410. {
  411.     if (oTarget == oPC)
  412.     {
  413.         AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_GET_MID, 1.0, 2.0));
  414.         ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectCutsceneImmobilize(), oPC, 2.0);
  415.  
  416.         if (GetCurrentHitPoints(oTarget) < GetMaxHitPoints(oTarget))
  417.         {
  418.  
  419.  
  420.  
  421.  
  422.             iHealingKitDifficulty1 = iHPOfTargetDifference1 + iHealedHP;
  423.             if (iHealingKitDifficulty1 > iMaxHPTarget1)
  424.             {
  425.                 iHealingKitDifficulty1 = iMaxHPTarget1;
  426.             }
  427.             iRoll = 15; //CD curar
  428.             if (iRoll <= iHealingRank1)// && !GetIsInCombat(oTarget))
  429.             {
  430.                 DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget));
  431.                 DelayCommand(1.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(iHealedHP), oTarget));
  432.             }
  433.             else
  434.             {
  435.                 FloatingTextStringOnCreature("No has logrado usar el botiquin de forma adecuada", oPC, FALSE);
  436.             }
  437.  
  438.         }
  439.         else
  440.         {
  441.             FloatingTextStringOnCreature("No tienes heridas que necesiten tratamiento", oPC, FALSE);
  442.         }
  443.     }
  444.     else
  445.         if (oTarget != oPC &&
  446.         GetObjectType(oTarget) == OBJECT_TYPE_CREATURE &&
  447.         !GetIsReactionTypeHostile(oTarget, oPC) &&
  448.         !GetIsReactionTypeHostile(oPC, oTarget))
  449.         {
  450.             AssignCommand(oPC, ActionMoveToObject(oTarget, TRUE, 1.5f));
  451.             DelayCommand(2.0, AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_GET_MID, 1.0, 2.0)));
  452.             DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectCutsceneImmobilize(), oPC, 2.0));
  453.             eEffects = GetFirstEffect(oTarget);
  454.  
  455.             while (GetIsEffectValid(eEffects))
  456.             {
  457.                 if (GetEffectType(eEffects) == EFFECT_TYPE_POISON)
  458.                 {
  459.                     iRoll = 20;
  460.                     if (iRoll <= iHealingRank1) // && !GetIsInCombat(oPC) && !GetIsInCombat(oTarget))
  461.                     {
  462.                         DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectCutsceneImmobilize(), oTarget, 2.0));
  463.                         DelayCommand(4.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget));
  464.                         DelayCommand(4.5, RemoveEffect(oTarget, eEffects));
  465.                     }
  466.                 else
  467.                 {
  468.                     FloatingTextStringOnCreature("Fallaste al intentar eliminar el veneno", oPC, FALSE);
  469.                 }
  470.                 DelayCommand(0.3, SendMessageToPC(oPC, "Tirada de habilidad para eliminar veneno: " +IntToString(iSkillRoll)+ " + " +IntToString(iHealingRank)+ " = " +IntToString(iHealingRank1)+ " vs DC " +IntToString(iRoll)+ "."));
  471.             }
  472.             if (GetEffectType(eEffects) == EFFECT_TYPE_DISEASE)
  473.             {
  474.                 iRoll = 20;
  475.                 if (iRoll <= iHealingRank1) // && !GetIsInCombat(oPC) && !GetIsInCombat(oTarget))
  476.                 {
  477.                     DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectCutsceneImmobilize(), oTarget, 2.0));
  478.                     DelayCommand(4.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget));
  479.                     DelayCommand(4.5, RemoveEffect(oTarget, eEffects));
  480.                 }
  481.                 else
  482.                 {
  483.                     FloatingTextStringOnCreature("Fallaste al intentar eliminar la enfermedad", oPC, FALSE);
  484.                 }
  485.                 DelayCommand(0.3, SendMessageToPC(oPC, "Tirada de habilidad para eliminar enfermedad: " +IntToString(iSkillRoll)+ " + " +IntToString(iHealingRank)+ " = " +IntToString(iHealingRank1)+ " vs DC " +IntToString(iRoll)+ "."));
  486.             }
  487.             eEffects = GetNextEffect(oTarget);
  488.         }
  489.         if (GetCurrentHitPoints(oTarget) < GetMaxHitPoints(oTarget) &&
  490.         GetCurrentHitPoints(oTarget) >= -9)
  491.         {
  492.             iHealingKitDifficulty1 = iHPOfTargetDifference1 + iHealedHP;
  493.             if (iHealingKitDifficulty1 > iMaxHPTarget1)
  494.             {
  495.                 iHealingKitDifficulty1 = iMaxHPTarget1;
  496.             }
  497.             iRoll = 20;
  498.             if (iRoll <= iHealingRank1) // && !GetIsInCombat(oPC) && !GetIsInCombat(oTarget))
  499.             {
  500.                 DelayCommand(2.0, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, EffectCutsceneImmobilize(), oTarget, 2.0));
  501.                 DelayCommand(4.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, eHeal, oTarget));
  502.                 DelayCommand(4.5, ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectHeal(iHealedHP), oTarget));
  503.             }
  504.  
  505.         return;
  506.     }
  507. }
  508. }
  509.  
  510. //desbloqueador
  511.  
  512. //if (GetTag(oItem) == "rh_dm_nivel")
  513. //{
  514.  
  515. //object oJug = GetItemPossessedBy(oTarget,"rh_obj_lvl_pj");
  516.  
  517. //SetLocalInt ( oJug,"NivelLimite",1);
  518.  
  519. //FloatingTextStringOnCreature("Superaste el primer bloqueo de nivel", oTarget, TRUE);
  520.  
  521.  
  522. // }
  523.  if (GetTag(oItem) == "rh_dm_nivel2")
  524. {
  525.  
  526. object oJug = GetItemPossessedBy(oTarget,"rh_obj_lvl_pj");
  527.  
  528. SetLocalInt ( oJug,"NivelLimite",2);
  529.  
  530. FloatingTextStringOnCreature("Superaste el segundo bloqueo de nivel", oTarget, TRUE);
  531.  
  532.  
  533.  }
  534.   if (GetTag(oItem) == "rh_dm_nivel2")
  535. {
  536.  
  537. object oJug = GetItemPossessedBy(oTarget,"rh_obj_lvl_pj");
  538.  
  539. SetLocalInt ( oJug,"NivelLimite",4);
  540.  
  541. FloatingTextStringOnCreature("Superaste el tercer bloqueo de nivel", oTarget, TRUE);
  542.  
  543.  
  544.  }
  545.  
  546.   //descanso
  547.  
  548.  
  549. // if (GetTag(oItem) == "yesca")
  550. //{
  551. //if (GetTag(oTarget) == "maderamuerta")
  552. //{
  553. //CreateObject(OBJECT_TYPE_PLACEABLE,"rh_hoguera",locDestino);
  554. //CreateObject(OBJECT_TYPE_TRIGGER,"rh_descansando",locDestino);
  555. //CreateObject(OBJECT_TYPE_PLACEABLE,"FlameMedium",locDestino);
  556. //}
  557. //DestroyObject(GetNearestObjectByTag("maderamuerta"));
  558. //DelayCommand(120.0,DestroyObject(GetNearestObjectByTag("rh_hoguera",oTarget)));
  559. //DelayCommand(120.0,DestroyObject(GetNearestObjectByTag("rh_descansando",oTarget)));
  560.  
  561. //DelayCommand(120.0,DestroyObject(oTarget));
  562. //}
  563.  
  564. if(GetTag(oItem) == "yesca" && GetTag(oTarget) == "maderamuerta")
  565. {
  566.     location lSitioHoguera = GetLocation(oTarget);
  567.     object   oHoguera      = CreateObject(OBJECT_TYPE_PLACEABLE, "rh_hoguera",     lSitioHoguera);
  568.     object   oDescansando  = CreateObject(OBJECT_TYPE_TRIGGER,   "rh_descansando", lSitioHoguera);
  569.     object   oLlama        = CreateObject(OBJECT_TYPE_PLACEABLE, "FlameMedium",    lSitioHoguera);
  570.     DelayCommand(1800.0, DestroyObject(oHoguera));
  571.     DelayCommand(1800.0, DestroyObject(oDescansando));
  572.     DelayCommand(1800.0, DestroyObject(oLlama));
  573.     DestroyObject(oTarget);
  574. }
  575.  
  576.  if (GetTag(oItem) == "gat_caldero")
  577. {
  578. if (GetTag(oTarget) == "rh_hoguera")
  579. {
  580. CreateObject(OBJECT_TYPE_PLACEABLE,"gat_hoguecal",locDestino);
  581. CreateObject(OBJECT_TYPE_TRIGGER,"rh_descansando",locDestino);
  582. CreateObject(OBJECT_TYPE_PLACEABLE,"FlameMedium",locDestino);
  583. }
  584. DelayCommand(1.0,DestroyObject(GetNearestObjectByTag("rh_hoguera")));
  585. DelayCommand(6000.0,DestroyObject(GetNearestObjectByTag("rh_descansando",oTarget)));
  586. DelayCommand(6000.0,DestroyObject(oTarget));
  587. }
  588.  
  589.  
  590.  if (GetTag(oItem) == "petate" && GetTag(oTarget) == "rh_hoguera")
  591.  {
  592.  
  593. FloatingTextStringOnCreature("Acomodas tu petate cerca del fuego. Ahora puedes descansar.", oPC);
  594.         SetLocalInt(oPC,"descansando",1);
  595.         AssignCommand(oPC,ActionRest());
  596.         DelayCommand(60.0,SetLocalInt(oPC,"descansando",0));
  597. }
  598.  
  599.  
  600. //recompensa npc
  601.  int iBonbylevel = GetHitDice(oPC)-6;
  602.  effect eAC=EffectACIncrease (iBonbylevel/2);
  603.  effect eAT=EffectAttackIncrease (1+iBonbylevel/2);
  604.  effect eDmg=EffectDamageIncrease(1+iBonbylevel/2);
  605.  effect eCon=EffectAbilityIncrease(ABILITY_CONSTITUTION,iBonbylevel*2);
  606.  effect eLinkali=EffectLinkEffects(eAC,eAT);
  607.  effect eLinkali2=EffectLinkEffects(eLinkali,eDmg);
  608.  effect eLinkali3=EffectLinkEffects(eLinkali2,eCon);
  609.  effect eAli=ExtraordinaryEffect(eLinkali3);
  610.  
  611.  if (GetTag(oItem) == "rh_recompensa_1")
  612.  {
  613.  object oDestroy = GetLocalObject(oPC,"hench");
  614.  DestroyObject(oDestroy);
  615.  object oHench = CreateObject(OBJECT_TYPE_CREATURE,"rh_henchman_1",locDestino);
  616.  ApplyEffectToObject( DURATION_TYPE_PERMANENT,eAli,oHench);
  617.  AddHenchman(oPC,oHench);
  618.  FloatingTextStringOnCreature("llamas un aliado", oPC);
  619.  string sNombre = GetLocalString(oJug,"nombrealiado");
  620.  SetName(oHench,sNombre);
  621.  SetLocalObject(oPC,"hench",oHench);
  622.  FloatingTextStringOnCreature(sNombre, oPC);
  623.  
  624.  
  625. }
  626.  
  627. //npc chat
  628.  
  629.  
  630.  if (GetTag(oItem) == "npc_chat" && GetMaster(oTarget) == oPC)
  631.  {
  632.  FloatingTextStringOnCreature("puedes hablar por tu aliado", oPC);
  633.  SetLocalObject(oPC,"habla",oTarget);
  634.  SetLocalInt(oPC,"hablarpornpc",1);
  635.  }
  636.  
  637.  if (GetTag(oItem) == "npc_chat" && oTarget == oPC)
  638.  {
  639.  FloatingTextStringOnCreature("Vuelves al chat normal", oPC);
  640.  SetLocalObject(oPC,"habla",oTarget);
  641.  SetLocalInt(oPC,"hablarpornpc",1);
  642.  }
  643.  
  644.  
  645. //varita nombradora.
  646.  
  647. if (GetTag(oItem) == "rh_varitanombradora")
  648. {
  649. FloatingTextStringOnCreature("Escribe el nuevo nombre", oPC);
  650. SetLocalObject(oPC,"nombradordm",oTarget);
  651.  SetLocalInt(oPC,"dmnombrar",1);
  652.  
  653. }
  654.  
  655. if (GetTag(oItem) == "rh_recall")
  656. {AssignCommand(oPC,ActionStartConversation(OBJECT_SELF,"fu_recall",TRUE,FALSE));
  657. SetLocalLocation(oPC,"npclocation",locDestino);
  658. }
  659. }
  660.  
  661.  
  662.  
  663.  
  664.  
  665. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top