Jump to content

Home

Problem with scripting...


J_Slash

Recommended Posts

OK, i used one of TK102's scripts to prevent items from respawning when re-entering a module, the problem is they still respawn...i'm using beancounter's method to inject the script on entering...can somebody pleaz tell me what's wrong with the damn thing!! I'm going crasy!!

here's the script:

 

void main ()
{  
  float x=7.09929f;  
  float y=12.36148f;  
  float z=-0.03665f;  
  float r=0.0f;   
  vector vecCont=Vector(x,y,z);
  location locCont=Location(vecCont, r);

  int nBoolSlot=6; //any number 0-7 can be used here

  object oContainer=GetNearestObjectToLocation (OBJECT_TYPE_PLACEABLE, locCont);

  int nCheck=GetLocalBoolean(GetFirstPC(), nBoolSlot);
  if (nCheck) { return; }

  CreateItemOnObject("pc_lghtsbr", oContainer, 2);

  SetLocalBoolean(oContainer, nBoolSlot, TRUE);
}

Link to comment
Share on other sites

I personally used The tutorial

 

It suggests using the OnEnter script like this:

void main()
{

    object oEntering = GetEnteringObject();
    object npctest = GetObjectByTag("npc_vash");

    if (GetIsPC(oEntering))
    {


         if (GetIsObjectValid(npctest) == FALSE)
         {
              ExecuteScript("my_spawn_script", OBJECT_SELF);
         }     
    }


    ExecuteScript("normal_script", OBJECT_SELF);
}

 

This is from K1, so it may be outdated, but I think it can be modified to work

Link to comment
Share on other sites

Originally posted by J_Slash

OK, i used one of TK102's scripts to prevent items from respawning when re-entering a module, the problem is they still respawn...i'm using beancounter's method to inject the script on entering...can somebody pleaz tell me what's wrong with the damn thing!! I'm going crasy!!

here's the script:

 

Well, at a quick glance I see one bug that might cause your problem. You check for the boolean value on the Player but set it on the container.

 

Try this instead:

void main () {  
   location locCont = Location(Vector(7.09929, 12.36148, -0.03665), 0.0);  
   object oContainer = GetNearestObjectToLocation( OBJECT_TYPE_PLACEABLE, locCont );

   if (!GetLocalBoolean(oContainer, 6)) {  
       CreateItemOnObject("pc_lghtsbr", oContainer, 2);            
       SetLocalBoolean(oContainer, 6, TRUE);
   }
}

Link to comment
Share on other sites

Actually, the problem isn't in the On-Enter script, this one works fine, the problem is with the respawning items!! the script that i posted is supposed to prevent them from respawning, but for some reason it doesn't work!!!!:(

Thanx for the reply though :)

Oh hey Stoffe!!

thanx man, i'll try it and get back to u!!:)

 

EDIT:

 

It seems to work just fine now!!!Thanx Stoffe, you're a life saver!!

Link to comment
Share on other sites

That's ok TK102, actually because of this, i now actually understan how the script works!!yay!:D

but u should correct it though, it's in the scripting tutorials, under spawning items, placeables,...

Thanx TK102.:)

 

 

Edit tk102: Fixed. I'm going to plead innocent on this since I wasn't the last one to edit that tutorial... right Darth333?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...