The animation was amazing and the script works fine. I just made a change into the time of receiving the item that has been increased from 3 seconds.
I have a note: You can click on the object and escape from mining - do not lose the item.
Maybe it's because the character is not stuck, he is free to walk out while the mining process is happening.
----------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------Edited--------------------------------------------------------------------------
----------------------------------------------------------------------------------------------------------------------------------------------
1. At line DelayCommand(3.0, CreateMinedLoot(oPC,sLoot)); we need eraser oPC, sLoot because the declaration does not parameters. If we delete it, we should also delete the command line string sLoot = GetLocalString(OBJECT_SELF, "MinedLootRESREF"); having this, only: DelayCommand(6.0, CreateMinedLoot());
OBS: I have increased 3 secs to better minning performance.
2. It's a great idea use DelayCommand to start the CreateMinedLoot void, perhaps we can do some changes to simplify this void:
void CreateMinedLoot()
{
object oPC = GetLastUsedBy();
CreateItemOnObject("ItemResRef", oPC, 1);
}
3. I don't understand why if (GetLocalInt(OBJECT_SELF, "IsMineable") == 1) {...}, I have changed this to:
string sPlacable = GetTag(OBJECT_SELF);
if (sPlacable == "MyPlaceableMinerableTAG")
{...}
Everything worked fine, so (OnUsed Script):
void CreateMinedLoot()
{
CreateItemOnObject("ItemReceivedTAG", GetLastUsedBy(), 1);
}
void main()
{
object oPC = GetLastUsedBy();
if (!GetIsPC(oPC)) return;
string sPlacable = GetTag(OBJECT_SELF);
if (sPlacable == "PlaceableTAG")
{
AssignCommand(oPC, ClearAllActions());
DelayCommand(1.0, AssignCommand(oPC, PlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0, 6.0)));
DelayCommand(2.0, FloatingTextStringOnCreature ("Minning...", oPC));
DelayCommand(6.0, CreateMinedLoot());
DestroyObject(OBJECT_SELF, 7.0);
}
}
Modifié par WhiteTiger, 05 mars 2014 - 04:36 .