53 lines
1.8 KiB
Plaintext
53 lines
1.8 KiB
Plaintext
|
//::///////////////////////////////////////////////
|
||
|
//:: Name: waterbucket
|
||
|
//:: Copyright (c) 2001 Bioware Corp.
|
||
|
//:://////////////////////////////////////////////
|
||
|
/*
|
||
|
This script is executed everytime a water
|
||
|
bucket is used.
|
||
|
*/
|
||
|
//:://////////////////////////////////////////////
|
||
|
//:: Created By: Adam Walenga
|
||
|
//:: Created On: September 4th, 2004
|
||
|
//:://////////////////////////////////////////////
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
float fPercent = GetLocalFloat (GetLocalObject (OBJECT_SELF, "Item_Used"),
|
||
|
"Water_Percent_Full");
|
||
|
|
||
|
//If in a water source, fill bucket.
|
||
|
if (GetLocalInt (OBJECT_SELF, "In_Water_Source"))
|
||
|
{
|
||
|
if (fPercent == 100.0f)
|
||
|
{
|
||
|
SendMessageToPC (OBJECT_SELF, "This water bucket is already " +
|
||
|
"full.");
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
//Now fill the water bucket.
|
||
|
PlayAnimation (ANIMATION_LOOPING_GET_LOW, 1.0f, 3.0f);
|
||
|
SetLocalFloat (GetLocalObject (OBJECT_SELF, "Item_Used"),
|
||
|
"Water_Percent_Full", 100.0f);
|
||
|
DelayCommand (0.1f, SetCommandable (FALSE, OBJECT_SELF));
|
||
|
DelayCommand (3.0f, SetCommandable (TRUE, OBJECT_SELF));
|
||
|
DelayCommand (3.1f, SendMessageToPC (OBJECT_SELF, "Water bucket has " +
|
||
|
"been filled."));
|
||
|
|
||
|
}
|
||
|
else //Display amount remaining in bucket to user.
|
||
|
{
|
||
|
SendMessageToPC (OBJECT_SELF, "Percent of water remaining: " + FloatToString
|
||
|
(fPercent, 3, 1) + "%");
|
||
|
|
||
|
if (fPercent != 100.0f) //If not 100%, display filling instructions.
|
||
|
SendMessageToPC (OBJECT_SELF, "To fill this bucket, you must locate " +
|
||
|
"a source of water.");
|
||
|
}
|
||
|
|
||
|
//Clear variables no longer needed.
|
||
|
DeleteLocalObject (OBJECT_SELF, "Item_Used");
|
||
|
DeleteLocalObject (OBJECT_SELF, "Item_Target");
|
||
|
}
|