Aller au contenu

Photo

Looking For Digging script


  • Veuillez vous connecter pour répondre
7 réponses à ce sujet

#1
PerrinAybarah

PerrinAybarah
  • Members
  • 14 messages

Hey guys,

Apologies if this has been posted or is rather easy to come across but i cant for the life of me find it anywhere.... Im after a digging system that doesnt use a HAK. Ive tried to play around with Worms Dig/Burial System. After playing around with it for a while i cant get it to work without the HAK. Originally it works with an Equipped Item in the right hand which i changed to just be a regular shovel and be in the PC's inventory. Worms system comes with a storage system as well which i really dont need. I was wondering if anyone knew of a system or even how to edit this one so its a more simplified version without the storage. and the HAK files.

 

Sorry if this is rather obvious.

 



#2
ehye_khandee

ehye_khandee
  • Members
  • 855 messages

Friend Perrin,

To make a 'hak based system' work without the hak, export all the hak's content to a folder, then import all that content directly into your module. This will put all the scripts and objects in the toolset so you can edit and adjust them as needed.

 

Best wishes.



#3
PerrinAybarah

PerrinAybarah
  • Members
  • 14 messages

Friend Perrin,

To make a 'hak based system' work without the hak, export all the hak's content to a folder, then import all that content directly into your module. This will put all the scripts and objects in the toolset so you can edit and adjust them as needed.

 

Best wishes.

 

Yes im happy with how to make it so no hak is required what im struggling with is how to do away with the Persistant storage system that is in that Module..So its more simplified.

E.G

 

Does PC possess Shovel? YES

Does PC possess Treasure Map? YES

Are they in the correct area? YES

Are they within 1/2 tile of the Waypoint to dig at? Yes

 

If so then play animations, Open container>Loot, Close container, Delete Map and Container.



#4
GhostOfGod

GhostOfGod
  • Members
  • 863 messages

Could do something like this which has pretty much everything you do want:

 

#include "x2_inc_switches"
void MakeDirt(object oPC, location lLoc)
{
    object oDirt = CreateObject(OBJECT_TYPE_PLACEABLE, "x3_plc_sand004", lLoc);
    DelayCommand(2.0, FloatingTextStringOnCreature("I've found nothing here.", oPC));
    DestroyObject(oDirt, 10.0);
}
void MakeTreasure(object oPC, location lLoc, string sTag)
{
    object oTreasure = CreateObject(OBJECT_TYPE_PLACEABLE, sTag, lLoc);
    DelayCommand(2.0, FloatingTextStringOnCreature("Eureeka! A treasure chest!", oPC));
    //DestroyObject(oTreasure, 60.0);
}

void main()
{
    int nEvent = GetUserDefinedItemEventNumber();
    if (nEvent != X2_ITEM_EVENT_ACTIVATE) return;

    object oPC = GetItemActivator();
    location lLoc = GetLocation(oPC);
    string sArea = GetName(GetArea(oPC));
    AssignCommand(oPC, PlaySound("as_cv_mineshovl1"));
    AssignCommand(oPC, ActionPlayAnimation(ANIMATION_LOOPING_GET_LOW, 1.0, 5.0));

    if (GetItemPossessedBy(oPC, "TREASURE_MAP_1") != OBJECT_INVALID &&
        GetDistanceBetween(oPC, GetWaypointByTag("TREASURE_WP_1")) <= 1.0)
    {
        DelayCommand(6.0, MakeTreasure(oPC, lLoc, "nw_plc_chestburd"));
        DestroyObject(GetItemPossessedBy(oPC, "TREASURE_MAP_1"));
        return;
    }

    if (GetItemPossessedBy(oPC, "TAG OF MAP2") != OBJECT_INVALID &&
        GetDistanceBetween(oPC, GetWaypointByTag("TAG OF WAYPOINT2")) <= 1.0)
    {
        DelayCommand(6.0, MakeTreasure(oPC, lLoc, "TAG OF TREASURE CHEST HERE"));
        DestroyObject(GetItemPossessedBy(oPC, "TAG OF MAP2"));
        return;
    }

    //if (etc...

    else
    {
        DelayCommand(6.0, MakeDirt(oPC, lLoc));
    }
}

 

 

This runs off the activated item event/tag based script (you use the shovel, unlimited uses).

 

Can change it up though depending on how you want the treasures laid out in your world though. One in each area? Several in each area? One area with several? etc...

 

The one other thing you might need is a custom "OnClosed" script for the treasure chest to destroy itself. Or could uncomment the line in the MakeTreasure function to destroy it after a delay too, but then the player might not have looted it before it disappears.

 

Just a simple, working example. Hope it helps.



#5
PerrinAybarah

PerrinAybarah
  • Members
  • 14 messages

Thanks Ghost yea that pretty much looks like what im after, Not on a PC with the Toolset on ATM though which sucks, Ill try it out later and let you know how it goes. And yea ill probably just comment out the

 

//DestroyObject(oTreasure, 60.0);

 

I asumme the 60.0 is seconds the Container will remain before the delete ?

Thanks again man



#6
Tchos

Tchos
  • Members
  • 5 083 messages

DelayCommand(2.0, FloatingTextStringOnCreature("Eureeka! A treasure chest!", oPC));

PerrinAybarah: If you use this line, I'd recommend spelling it "Eureka!"


  • GhostOfGod aime ceci

#7
GhostOfGod

GhostOfGod
  • Members
  • 863 messages

Thanks Ghost yea that pretty much looks like what im after, Not on a PC with the Toolset on ATM though which sucks, Ill try it out later and let you know how it goes. And yea ill probably just comment out the

 

I asumme the 60.0 is seconds the Container will remain before the delete ?

Thanks again man

Yep. Which you can change to whatever you like of course.

 

PerrinAybarah: If you use this line, I'd recommend spelling it "Eureka!"

Ok so I can't spell. :P



#8
Tchos

Tchos
  • Members
  • 5 083 messages

Just making sure the proofreading is the same quality as your script itself, Ghost.  ;)