Author Topic: Placeable wont move  (Read 430 times)

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
Placeable wont move
« on: September 24, 2010, 11:15:05 am »


               My problem is the placeable wont move to my new .x vector  "float fNew_vPLx = vPLx + fMovincrament;"

I can get a placeable to rotate, but I cant seem to get it to move on the x axis or the y axis.  At the bottom of the script you can see I tried various commands to get it to move they all seemed to fail.  I unsure why very frustrating.  Any help would be great.


//:://////////////////////////////////////////////////////////////
//:: Title : gwplc_movxp
//:: Author: Unknown
//:: Altered by: Greyfort
//:: Module: any who need
//:: Date  : Sep 17, 2010
//:: Vers  : 1.0
//:: notes : thankyou lexicon
//:://////////////////////////////////////////////////////////////

#include "x0_i0_position"

void main()
{

object oPC          = GetPCSpeaker();

object oTarget      = OBJECT_SELF;// this is a placeable

object oArea        = GetArea(oTarget);
location loTarget   = GetLocation(oTarget);
vector vPosLoc =GetPositionFromLocation(loTarget);
    float vPLx =vPosLoc.x;
    float vPLy =vPosLoc.y;
    float vPLz =vPosLoc.z;

string sTarget      = GetTag(oTarget);
//debug statement
SendMessageToPC(oPC,"oTarget Tag.. "+ sTarget+"..");

float fMovincrament = GetLocalFloat(oPC,"fplctmovinc");
//debug statement
SendMessageToPC(oPC,"incrament.. "+ FloatToString(fMovincrament)+"..");

// SendMessageToPC(oPC,""+ FloatToString("")+"");
/////////////////////////
//debug statement
SendMessageToPC(oPC,"origanl x axis ="+ FloatToString(vPLx)+"");


     // this is where make new position for location
     ClearAllActions();

    float fNew_vPLx = vPLx + fMovincrament;
//debug statement
SendMessageToPC(oPC,"new x axis ="+ FloatToString(fNew_vPLx )+"");

    float fOrientation  = GetFacing(oTarget);
    vector vNewPos = Vector(fNew_vPLx, vPLy, vPLz);
     // move to new location
     //ActionMoveToLocation(Location(oArea, vNewPos, fOrientation) ) ;
     ActionForceMoveToLocation(Location(oArea, vNewPos, fOrientation) );
//location lNewLoc = Location(oArea, vNewPos, fOrientation);
//SendMessageToPC(oPC,"new_loc ="+ LocationToString(lNewLoc )+"");
//MoveToNewLocation(lNewLoc,OBJECT_SELF);

//////////////////////
//end of script
}
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Placeable wont move
« Reply #1 on: September 24, 2010, 02:28:56 pm »


               You are correct. You can not move a placeable.  The only way to move one is to destroy it and create a new one.
               
               

               
            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
Placeable wont move
« Reply #2 on: September 24, 2010, 02:40:34 pm »


               Thanks Lightfoot
               
               

               
            

Legacy_420

  • Sr. Member
  • ****
  • Posts: 370
  • Karma: +0/-0
Placeable wont move
« Reply #3 on: September 25, 2010, 01:26:12 am »


               

Lightfoot8 wrote...

 The only way to move one is to destroy it and create a new one.

Or you can place a bunch of placeables and use multiple cutscene invisibility effects to make it seem as if
it is moving around.

The alternate method cuts down on FPS buildup due to a memory leak in NWN which requires the PC to leave
and reenter the area to fix.

-420
               
               

               


                     Modifié par 420, 25 septembre 2010 - 12:26 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Placeable wont move
« Reply #4 on: September 25, 2010, 02:41:42 am »


               Interesting 420,  



Do you know if the memory leak is still there after the 1.69 update?  



I know the NWNv169.text states:

- Fixed some memory leaks.



could this have been one of them?



@OP still 420 is correct and if you placables are not going to random locations the cutscene invisibility  is a better option.

               
               

               
            

Legacy_Blasco-Yang

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
Placeable wont move
« Reply #5 on: September 26, 2010, 02:25:16 am »


               Sunjammer has a library of custom functions for easily moving placeables around (or at least making placeables "appear" to be moving around).



If I recall correctly, it works much as 420 describes.  It was scripted with NWN 2 in mind, but it is easily modified to be compatible with NWN 1.  (One of the bioware functions he uses is only available in NWN 2, but you can replace it with little trouble)



You can find it on his site:

http://www.sunjammer.co.uk/



Kind of curious about that memory leak myself.  



Before I found SJ's placeable movement library of functions I had created my own elevator that visually moves up and down to those who are outside it.  I did it with the destroy / create method on the 5 placeables that formed the structure of my elevator.  



I've had no trouble with it and it at least "looks" quite good when it is in "motion", but I've not really put my module up online for any extended amount of time (yet) so don't know how well things will go in an active run of the module.