Alangara_PRC8/_module/nss/farm_mod_activ.nss
Jaysyn904 86feb9ca6f Initial commit
Initial commit.
2024-06-05 21:21:06 -04:00

91 lines
2.5 KiB
Plaintext

//:://////////////////////////////////////////////
//:: Name: farm_mod_activ
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
OnItemActivate script for the module.
This script will handle the necessary actions
for seed/item activation.
*/
//:://////////////////////////////////////////////
//:: Created By: Adam Walenga
//:: Created On: August 30th, 2004
//:://////////////////////////////////////////////
#include "x2_inc_switches"
void main()
{
object oPlayer = GetItemActivator();
object oItem = GetItemActivated();
string sResRef = GetResRef (oItem);
/// tara messing around ///
object oActivator = GetItemActivator();
if (GetTag(oItem) == "PCList")
{
AssignCommand(oActivator, ActionStartConversation(oActivator, "c_pcl_activate", TRUE));
}
// *** next special case ***
if(GetTag(oItem) == "SoT")
{
AssignCommand(oActivator, ActionStartConversation(oActivator, "SoTravel", TRUE));
// return;
}
/// tara stops messing ///
if (sResRef == "targetter")
{
object target = GetItemActivatedTarget();
if (target == OBJECT_INVALID)
{
location loc = GetItemActivatedTargetLocation();
SetLocalLocation(oItem, "locationtarget", loc);
DeleteLocalObject(oItem, "objecttarget");
SetName(oItem, "Target: Location in "+GetName(GetArea(oPlayer)));
SetLocalInt(oItem, "target", 2); // Location target
}
else
{
SetLocalLocation(oItem, "locationtarget", GetLocation(target));
SetLocalObject(oItem, "objecttarget", target);
SetName(oItem, "Target: "+GetName(target));
SetLocalInt(oItem, "target", 1); // Object target
}
return;
}
// string sTag = GetTag( GetItemActivated() );
// Lav forgrening - undgaa "double-execution" af scripts: (31/7 2005)
string sFirst5 = GetStringLeft( sResRef, 5 );
if (sFirst5 == "seed_" || sResRef == "shovel" || sResRef == "waterbucket")
{
// Script skal koeres resref-based
//Store information captured here to use with ExecuteScript scripts.
SetLocalObject (oPlayer, "Item_Used", oItem);
SetLocalObject (oPlayer, "Item_Target", GetItemActivatedTarget());
if (GetStringLeft (sResRef, 5) == "seed_")
ExecuteScript ("farm_plant", oPlayer);
else
ExecuteScript (sResRef, oPlayer);
}
else
{
// Script skal koeres tag-based
ExecuteScript(GetTag(GetItemActivated()), OBJECT_SELF);
}
ExecuteScript("dmfi_activate", GetItemActivator());
}