Aller au contenu

Photo

[Help] Moving an object between 2 areas


  • Veuillez vous connecter pour répondre
Aucune réponse à ce sujet

#1
Quildra

Quildra
  • Members
  • 45 messages
 I am trying to create a portable chest so you can free up inventory space while killing.
I have my chest summonable from an item and I have a single chest moving about when its summoned so it keeps your items in it when it is summoned again. 
But of course the chest wont move between areas. so I tried this:

//edit removed code for 2 minutes 


// All module events
#include "utility_h"
#include "wrappers_h"
#include "events_h"

const string QUIL_TAG_LUGGAGE_WHISTLE = "quil_luggage_whistle";
const resource QUIL_RESOURCE_LUGGAGE_WHISTLE = R"quil_luggage_whistle.uti";

const string QUIL_TAG_LUGGAGE_CHEST = "quil_luggage_chest";
const resource QUIL_RESOURCE_LUGGAGE_CHEST = R"quil_luggage_chest2.utp";

void main()
{
    event ev   = GetCurrentEvent();
    int nEvent = GetEventType(ev);
    Log_Events("", ev);
    switch (nEvent)
    { 
       //////////////////////////////////////////////////////////////////////// 
       // Sent by: The engine
        // When: The module loads from a save game, or for the first time. This event can fire more than
        //       once for a single module or game instance.
        ////////////////////////////////////////////////////////////////////////
        case EVENT_TYPE_MODULE_LOAD:
        {
            object oPlayer = GetHero();
            object oWhistle = GetObjectByTag(QUIL_TAG_LUGGAGE_WHISTLE);

            if (!IsObjectValid(oWhistle))
                UT_AddItemToInventory(QUIL_RESOURCE_LUGGAGE_WHISTLE,1);


            break;
        } 
       case EVENT_TYPE_BEGIN_TRAVEL:
        {
            int nSourceTerrain = GetEventInteger(ev, 0);    // [Undocumented]
            int nTargetTerrain = GetEventInteger(ev, 1);    // [Undocumented]
            int nWorldMap = GetEventInteger(ev, 2);         // [Undocumented]
            string sSource = GetEventString(ev, 0);         // area tag source location
            string sTarget = GetEventString(ev, 1);         // area tag target location
            string sWPOverride = GetEventString(ev, 2);     // waypoint tag override
            object oSourceLocation = GetEventObject(ev, 0); // source location object

            object oChest = GetObjectByTag(QUIL_TAG_LUGGAGE_CHEST);
            object oAreaTarget = GetObjectByTag(sTarget);

            if (!IsObjectValid(oChest) && IsObjectValid(oAreaTarget))
            {
                object oWaypoint = GetObjectByTag(sWPOverride);
                if(IsObjectValid(oWaypoint))
                {
                    location lnewSpawn = GetLocation(oWaypoint);
                    SetLocation(oChest, lnewSpawn); 
               }
            }
            break;
        }
        default:
        {
            break;
        }
    }
}

But its doesn't appear to help and it is obviously very difficult to debug seen as its a script that should be called just before a loading screen. 

Also if any one knows where the complier options are so i can turn on .ndb generation that would be a god send. 

If the worst comes to the worst and it turns you this is impossible i think i'll try a summonable merchant so you can at least sell your excess wares. 

Modifié par Quildra, 19 novembre 2009 - 09:34 .