Author Topic: Looking For Digging script  (Read 320 times)

Legacy_PerrinAybarah

  • Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
Looking For Digging script
« on: January 13, 2015, 01:13:12 pm »


               

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.


 



               
               

               
            

Legacy_ehye_khandee

  • Hero Member
  • *****
  • Posts: 1415
  • Karma: +0/-0
Looking For Digging script
« Reply #1 on: January 13, 2015, 03:59:05 pm »


               

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.


               
               

               
            

Legacy_PerrinAybarah

  • Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
Looking For Digging script
« Reply #2 on: January 13, 2015, 07:42:52 pm »


               


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.


               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Looking For Digging script
« Reply #3 on: January 14, 2015, 12:52:06 am »


               

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.



               
               

               
            

Legacy_PerrinAybarah

  • Newbie
  • *
  • Posts: 24
  • Karma: +0/-0
Looking For Digging script
« Reply #4 on: January 14, 2015, 10:34:24 pm »


               

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



               
               

               
            

Legacy_Tchos

  • Sr. Member
  • ****
  • Posts: 454
  • Karma: +0/-0
Looking For Digging script
« Reply #5 on: January 14, 2015, 10:59:20 pm »


               

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



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



               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
Looking For Digging script
« Reply #6 on: January 15, 2015, 12:21:57 am »


               


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. '<img'>


               
               

               
            

Legacy_Tchos

  • Sr. Member
  • ****
  • Posts: 454
  • Karma: +0/-0
Looking For Digging script
« Reply #7 on: January 15, 2015, 01:00:22 am »


               

Just making sure the proofreading is the same quality as your script itself, Ghost.  '<img'>