T7nowhere Posted February 21, 2004 Share Posted February 21, 2004 I wrote script that when the PC talks to a certain npc it gives the PC some items.Now my question is what do I need to add to the script that makes it so the npc only give the items once(please keep in mind this is the first script I have made that works,and I am very new to writing program). here is my simple script : void main() { object oPC = GetFirstPC(); CreateItemOnObject("ejmrobe21",oPC); CreateItemOnObject("ejmrobe22",oPC); CreateItemOnObject("ejmrobe23",oPC); CreateItemOnObject("ejmrobe24",oPC); } Link to comment Share on other sites More sharing options...
gameunlimited Posted February 21, 2004 Share Posted February 21, 2004 void main() { int Check = GetGlobalNumber("CHECK_VAR"); // create a variable called Check if (Check != 99) // if the check variable is not 99, then do the following lines. //note: 99 is just an arbitrary number that I pick { object oPC = GetFirstPC(); CreateItemOnObject("ejmrobe21",oPC); CreateItemOnObject("ejmrobe22",oPC); CreateItemOnObject("ejmrobe23",oPC); CreateItemOnObject("ejmrobe24",oPC); SetGlobalNumber("CHECK_VAR", 99); // sets the check variable to 99 to prevent //the items being given again the next time around } } That should do it. Also you have to edit the file globalcat.2da and add this line. This line will initialize the Global Number called "CHECK_VAR". Global Numbers, unlike local variable such as oPC and Check, will stay in the game even after you quit the game and come back in. 1185 CHECK_VAR Number Link to comment Share on other sites More sharing options...
T7nowhere Posted February 21, 2004 Author Share Posted February 21, 2004 Thanks for the quik reply gameunlimited, That worked perfectly. Accept is there a way to do it without editing globalcat.2da as in useing one of the others that are there or are they script specific. Don't go to any trouble though, just asking if you know off the top of your head. That script did the trick. Thanks Link to comment Share on other sites More sharing options...
gameunlimited Posted February 21, 2004 Share Posted February 21, 2004 You certainly can use the ones already there. They are not script specific. However, they might be used for some other part of the game, and playing around with them might screw up the story. Maybe you can use the ones that are for certain not gonna be used again like those variables used in Taris or Endar Spire. Link to comment Share on other sites More sharing options...
T7nowhere Posted February 21, 2004 Author Share Posted February 21, 2004 ok i'll look into that. Link to comment Share on other sites More sharing options...
buhallin Posted May 20, 2004 Share Posted May 20, 2004 Im bit late, but i got the game "late" *g Its very easy to plant Items in the Game in exsisting Boxes/Footlookers. All u have to do is to edit the .UTP Files. I want myself to get my selfmade clothes g_a_clothes10.uti in a box on the endire spire. Use Kotor Tool open RIMS-->Modules and search for the Node in our case i found this end-m01aa_s.rim Blueprint, Placeables Here is a list of placable objects/items in the game. footlker003.utp is the footlooker in the room on the endire spire where u have left a box and right these footloker. There also two Siths and this dead republic soldier to the right when u enter. Wenn u open the .utp file with GFF Editor u simple need to add your .uti files under "itemlist" and not forget to set the reposposXsetting Im sure here u can can add also more opponents with this things.. Well im late with this, but maybe for kotor2 we can use the same tools so we have this thing. There is no need for a script to add static objects. Link to comment Share on other sites More sharing options...
Jackel Posted May 20, 2004 Share Posted May 20, 2004 the problem with changing th utp file is it changes ALL files with that name i changed the footlocker1 utp , tyhats the one trask tells you to open , i then forgot to remove it fromt he override folder and stuffed up a couple of bits later one the lockers in the lower city or taris in particular , the one with the holograms and the one with the letter from home in particular , they had the items i put in the ender spire footlocker because those footlockers also used the footlocker1 utp file Link to comment Share on other sites More sharing options...
Lorden Darkblade Posted July 1, 2004 Share Posted July 1, 2004 Sorry for reviving this post but I have to ask something, the "CHECK_VAR" name can be changed? And the number "99" has to be changed or what? I'm trying to make the NPC give me something only once aswell. Thanks in advance, ReLoaD2K Link to comment Share on other sites More sharing options...
Darth333 Posted July 1, 2004 Share Posted July 1, 2004 Originally posted by ReLoaD2K Sorry for reviving this post but I have to ask something, the "CHECK_VAR" name can be changed? And the number "99" has to be changed or what? I'm trying to make the NPC give me something only once aswell. Thanks in advance, ReLoaD2K Yes, it can be changed for whatever you want. Could be "BLAH_BLAH" if you wish. The number at the end has no importance except if you use a variable that is already being used by the game. If you use an existing GLobal Variable, be sure to use a number that is not used by the game and know what you are doing because you could screw up a plot. If you do so, use TK102's Global Variable Comparison tool. Check the Newbie guide to get the link. Link to comment Share on other sites More sharing options...
Lorden Darkblade Posted July 1, 2004 Share Posted July 1, 2004 So, what number should I use ther to dont screw up the game? Is there a limit to what numbers the game use? Like this, example, the game use 1 to 50. Thanks in advance, ReLoaD2K Link to comment Share on other sites More sharing options...
Darth333 Posted July 1, 2004 Share Posted July 1, 2004 Use what ever number you want as long as the variable is a new one (per example CHECK_VAR or BLAH_BALH). It's just if you are using existing variables that are already used by the game, such as KOR_DANEL or K_STAR_MAP per example that you have to check the number. (BTW, never play with K_STAR_MAP: it checks how many star maps have discovered) Link to comment Share on other sites More sharing options...
Lorden Darkblade Posted July 1, 2004 Share Posted July 1, 2004 Ahhhh! Ok then Thanks for your explanation. Link to comment Share on other sites More sharing options...
Lorden Darkblade Posted July 1, 2004 Share Posted July 1, 2004 Like I said sorry for the double post but I have to ask this. This is the script that I wrote: void main() { object oPC = GetFirstPC(); CreateItemOnObject("star_lghtsbr87",oPC); SetGlobalNumber("CHECK_STAR", 99); } I want that, after I have the right conversation with the right NPC he'll give me that saber. Will it work? Now I have to create the entry in the globalcat.2da and attach that scritp to a dialog right? Thanks in advance, ReLoaD2K Link to comment Share on other sites More sharing options...
tk102 Posted July 1, 2004 Share Posted July 1, 2004 Reload2k, You can use the Set/Get GlobalNumber and GlobalBoolean to accomplish this, but it is overkill. My suggestion is to use Set/Get LocalBoolean to get the NPC to do the script one time. Take a look at this thread in which Darth333 wanted to spawn DeadEye Duncan only once. It's the same idea. Also, if you download the Darkside Choker mod from pcgamemods.com, the dialog with Zaalbar does exactly what you want (well it puts the item in a container instead of on the PC, but that's pretty close.) Link to comment Share on other sites More sharing options...
Darth333 Posted July 1, 2004 Share Posted July 1, 2004 Originally posted by tk102 Take a look at this thread in which Darth333 wanted to spawn DeadEye Duncan only once. It's the same idea. Hehehe I have learned much since then (thanks to you TK). Other solution is to attach the script to an existing dialog that is only repeated once Link to comment Share on other sites More sharing options...
Lorden Darkblade Posted July 1, 2004 Share Posted July 1, 2004 Well, to be honest that thing you told me to use it's complicated to me right now.... I dont even know if what I'm trying to do will work. You think that what I did will work? Thanks in advance, ReLoaD2K Link to comment Share on other sites More sharing options...
tk102 Posted July 1, 2004 Share Posted July 1, 2004 Reload2k -- take a look at Zaalbar's dialog in the Darkside Choker mod. Link to comment Share on other sites More sharing options...
Lorden Darkblade Posted July 2, 2004 Share Posted July 2, 2004 I looked. I dont know how to use those SetLocalBoolean or something... Will my script work? Cuz If I have to use those SetLocalBoolean or GetLocalBoolean or something I dont think I'll be able to do it. Link to comment Share on other sites More sharing options...
tk102 Posted July 2, 2004 Share Posted July 2, 2004 Your script will compile. If you modify globalcat.2da to include "CHECK_STAR" as a global numeric and place it in the override, then your script will set that value to 99. You will also need to write another script that checks the value of "CHECK_STAR" to see if it is 99. Now, back to Local variables. The only difference between them and Global variables is that Local variables are stored on an Object, whereas Global variables are stored within the game itself. Every Object can hold Local variables, both Boolean and Number variables. Local variables do not require modification of the globalcat.2da file. They are therefore easier to distribute. They are also faster to compute than global variables. Please consider using them -- they are not more complicated than what you are doing. Link to comment Share on other sites More sharing options...
Lorden Darkblade Posted July 2, 2004 Share Posted July 2, 2004 Well if it is easyer could you please post here how would it look like my script with those things? Link to comment Share on other sites More sharing options...
Darth333 Posted July 2, 2004 Share Posted July 2, 2004 Exactly like Zaalbar's dialog in the Darkside choker mod. Just replace " PlstcCrt" by the object on which you want the item to be created and "g_i_frarmbnds51" by the item you want. ARGH!!!! 600 POSTS and I'm still a RANCOR!!!! Where can I file a complaint? Link to comment Share on other sites More sharing options...
Lorden Darkblade Posted July 2, 2004 Share Posted July 2, 2004 Hmmmm. It's not helping. I'll not use a Container. It will give the item directly to me. And what about the numbers on those Chokers? There is not an obejct by tag. It will not be an object it will gibe to me. I want to start from scratch so I can learn something. Thanks in advance, ReLoaD2K Link to comment Share on other sites More sharing options...
Darth333 Posted July 2, 2004 Share Posted July 2, 2004 void main () { object oObject = GetObjectByTag("npc_tag"); if (GetLocalBoolean(oObject,0)) { return; } CreateItemOnObject("star_lghtsbr87",oObject); SetLocalBoolean(oObject,0,TRUE); } Link to comment Share on other sites More sharing options...
Lorden Darkblade Posted July 2, 2004 Share Posted July 2, 2004 And I'll need another one right? Saying something with that Boolean thing? Link to comment Share on other sites More sharing options...
Darth333 Posted July 2, 2004 Share Posted July 2, 2004 That one should do it. It's all in there: GetLocalBolean and SetLocalBolean. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.