62 lines
2.0 KiB
Plaintext
62 lines
2.0 KiB
Plaintext
void Treasure(location lTarget)
|
|
{
|
|
effect eVis = EffectVisualEffect(VFX_COM_CHUNK_STONE_SMALL);
|
|
object oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "x2_plc_hole_s", lTarget);
|
|
object oSpawn2 = CreateObject(OBJECT_TYPE_PLACEABLE, "lost_gold", lTarget);
|
|
DelayCommand(0.5, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis,lTarget));
|
|
DestroyObject(oSpawn2, 120.0);
|
|
DestroyObject(oSpawn, 125.0);
|
|
}
|
|
|
|
void MakeHole(location lTarget)
|
|
{
|
|
|
|
effect eVis = EffectVisualEffect(VFX_COM_CHUNK_STONE_SMALL);
|
|
object oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "x2_plc_hole_s", lTarget);
|
|
DelayCommand(0.5, ApplyEffectAtLocation(DURATION_TYPE_INSTANT, eVis,lTarget));
|
|
DestroyObject(oSpawn, 120.0);
|
|
}
|
|
|
|
void main()
|
|
{
|
|
if (GetTag(GetItemActivated()) == "spade")
|
|
{
|
|
object oPC = GetItemActivator();
|
|
location lTarget = GetItemActivatedTargetLocation();
|
|
object oArea = GetArea(oPC);
|
|
int DoOnce = GetCampaignInt("spade",GetTag(OBJECT_SELF),oPC);
|
|
int nOutside = GetIsAreaNatural(oArea);
|
|
|
|
if (DoOnce==1) return;
|
|
|
|
if (nOutside != AREA_NATURAL)
|
|
{
|
|
FloatingTextStringOnCreature("You can't use the Spade here", oPC, FALSE);
|
|
return;
|
|
}
|
|
|
|
object oWP = GetObjectByTag("WP_treasure");
|
|
float fDist = GetDistanceBetweenLocations(GetLocation(oWP),lTarget);
|
|
if(fDist >= 0.1 && fDist <= 8.0)
|
|
{
|
|
AssignCommand(oPC,ActionMoveToLocation(lTarget, TRUE));
|
|
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW));
|
|
DelayCommand(3.0,Treasure(lTarget));
|
|
DelayCommand(4.0,PlayVoiceChat(VOICE_CHAT_CHEER, oPC));
|
|
DelayCommand(5.5,AssignCommand(oPC, ActionSpeakString("Gold!")));
|
|
SetCampaignInt("spade",GetTag(OBJECT_SELF),1,oPC);
|
|
AddJournalQuestEntry("pirate_treasure",2,oPC, FALSE, FALSE, FALSE);
|
|
}
|
|
else
|
|
{
|
|
AssignCommand(oPC,ActionMoveToLocation(lTarget, FALSE));
|
|
AssignCommand(oPC,ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW));
|
|
DelayCommand(3.0,MakeHole(lTarget));
|
|
DelayCommand(4.0,PlayVoiceChat(VOICE_CHAT_CUSS, oPC));
|
|
DelayCommand(5.5,AssignCommand(oPC, ActionSpeakString("Empty!")));
|
|
}
|
|
|
|
}
|
|
}
|
|
|