mirror of
https://bitbucket.org/seefoe/dsrc.git
synced 2026-07-31 01:15:55 -04:00
79 lines
1.8 KiB
Plaintext
79 lines
1.8 KiB
Plaintext
/**
|
|
|
|
*
|
|
* Title: stimpack script
|
|
* Description: script for handling stimpacks
|
|
|
|
*/
|
|
|
|
include library.buff;
|
|
include library.groundquests;
|
|
include library.sui;
|
|
include library.utils;
|
|
include library.healing;
|
|
|
|
const string_id SID_ITEM_YOU_MUST_TARGET = new string_id("healing", "item_must_target");
|
|
const string_id SID_ITEM_ONLY_OTHERS = new string_id("healing", "item_only_on_others");
|
|
const string_id SID_ITEM_NO_NEED = new string_id("healing", "item_no_need");
|
|
|
|
const String ACTION_NAME = "bactaShot";
|
|
|
|
trigger OnObjectMenuRequest(obj_id player, menu_info mi)
|
|
{
|
|
if (canManipulate(player, self, true, true, 15, true))
|
|
{
|
|
menu_info_data mid = mi.getMenuItemByType(menu_info_types.ITEM_USE);
|
|
if ( mid != null )
|
|
{
|
|
mid.setServerNotify(true);
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
trigger OnObjectMenuSelect(obj_id player, int item)
|
|
{
|
|
if(isDead(player) || isIncapacitated(player))
|
|
return SCRIPT_CONTINUE;
|
|
|
|
if ( item == menu_info_types.ITEM_USE)
|
|
{
|
|
const obj_id target = getLookAtTarget(player);
|
|
|
|
if(target == null)
|
|
{
|
|
sendSystemMessage(player, SID_ITEM_YOU_MUST_TARGET);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(target == player)
|
|
{
|
|
sendSystemMessage(player, SID_ITEM_ONLY_OTHERS);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if(!hasObjVar(target, "quest.questName"))
|
|
{
|
|
sendSystemMessage(player, SID_ITEM_NO_NEED);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
string questName = getStringObjVar(target, "quest.questName");
|
|
|
|
if(!questName.equals("npe_medic") && !questName.equals("npe_medic2"))
|
|
{
|
|
sendSystemMessage(player, SID_ITEM_NO_NEED);
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
if (groundquests.questActionCompleted(player, target, ACTION_NAME))
|
|
{
|
|
decrementCount(self);
|
|
healing.doHealingAnimationAndEffect(player, target);
|
|
}
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|