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

49 lines
1.5 KiB
Plaintext

//::///////////////////////////////////////////////
//:: Name: water_pump_ou
//:: Copyright (c) 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
OnUsed script for water pumps.
Fill ALL buckets in PC's inventory full of
water.
*/
//:://////////////////////////////////////////////
//:: Created By: Adam Walenga
//:: Created On: September 3rd, 2004
//:://////////////////////////////////////////////
void main()
{
object oPlayer = GetLastUsedBy();
object oItem = GetFirstItemInInventory (oPlayer);
int iCount = 0;
//Loop through inventory in search of water buckets.
while (GetIsObjectValid (oItem))
{
if ((GetResRef (oItem) == "waterbucket") && (GetLocalFloat (oItem, "Water_Percent_Full") != 100.0f))
{
iCount++;
SetLocalFloat (oItem, "Water_Percent_Full", 100.0f);
}
oItem = GetNextItemInInventory (oPlayer);
}
if (iCount < 1)
SendMessageToPC (oPlayer, "You don't have any water buckets that need " +
"to be filled.");
else //Perform pumping animation(s), and play sound effect.
{
PlaySound ("as_na_splash2");
DelayCommand (0.1f, AssignCommand (oPlayer, PlayAnimation
(ANIMATION_LOOPING_GET_MID, 1.0f, 3.0f)));
DelayCommand (0.2f, SetCommandable (FALSE, oPlayer));
DelayCommand (3.0f, SetCommandable (TRUE, oPlayer));
DelayCommand (3.1f, SendMessageToPC (oPlayer, "All water buckets have " +
"been filled."));
}
}