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);
}
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
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
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.
ok i'll look into that. :)
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.
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
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
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.
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
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)
Ahhhh!
Ok then :D
Thanks for your explanation.
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
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 (
http://www.lucasforums.com/showthread.php?s=&postid=1495453#post1495453) 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.)
Originally posted by tk102
Take a look at this (
http://www.lucasforums.com/showthread.php?s=&postid=1495453#post1495453) 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 ;)
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
Reload2k -- take a look at Zaalbar's dialog in the Darkside Choker mod.
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.
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.
Well if it is easyer could you please post here how would it look like my script with those things?
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?
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
void main () {
object oObject = GetObjectByTag("npc_tag");
if (GetLocalBoolean(oObject,0)) { return; }
CreateItemOnObject("star_lghtsbr87",oObject);
SetLocalBoolean(oObject,0,TRUE);
}
And I'll need another one right?
Saying something with that Boolean thing?
That one should do it. It's all in there: GetLocalBolean and SetLocalBolean.
So that way the item will go to my player inventory right?
Thanks in advance,
ReLoaD2K
If the npc is a party member, yes. If you want to equip the npc with an item in a particular slot, check this thread:
http://www.lucasforums.com/showthread.php?s=&threadid=130977)
The available slots are:
INVENTORY_SLOT_HEAD
INVENTORY_SLOT_BODY
INVENTORY_SLOT_HANDS
INVENTORY_SLOT_RIGHTWEAPON
INVENTORY_SLOT_LEFTWEAPON
INVENTORY_SLOT_LEFTARM
INVENTORY_SLOT_RIGHTARM
INVENTORY_SLOT_IMPLANT
INVENTORY_SLOT_BELT
INVENTORY_SLOT_CWEAPON_L
INVENTORY_SLOT_CWEAPON_R
INVENTORY_SLOT_CWEAPON_B
INVENTORY_SLOT_CARMOUR * for an example of this one, see this thread:
http://www.lucasforums.com/showthread.php?s=&threadid=129600)
No no no.
I want to make an NPC give me the PC that Lightsaber.
An NPC that is not in my team at all!
A NPC from the game that I'll create a special conversation for him that will in the end give me that Lightsaber.
Now another question, that number that you gave, the 0 can always be a random number?
I mean the npc on which the object is created, not necessarily the one who is talking. If the object is created on one of you party members, then it will go to your inventory.
To your second question, no, it doesn't have to be 0. Just look at the Darkside choker.
Don't be afraid to try. The worst thing that can happen is that it doesn't work. You'll learn a lot by trying different things.
Ok, like I said, sorry for using this same post for this but I'm excited about my first MOD if I can call it that.
How do I make a dialog option with a REAL Force Persuade check?
Like this:
[Force Persuade]Hey I'm good, show me!
Then if it's high enough I get the the success or if its not u know the drill I fail :o :p :D
Try attaching this script in the active field of the RepliesList located in the EntryList of a dlg file
EntryList:
->0
->->RepliesList
->->->0
->->->->Index:
->->->->my_script
For a check for dominate mind:
int StartingConditional()
{
return GetHasSpell(FORCE_POWER_DOMINATE,GetPCSpeaker());
}
and for affect mind:
int StartingConditional()
{
if(GetHasSpell(FORCE_POWER_AFFECT_MIND, GetPCSpeaker()))
{
return TRUE;
}
return FALSE;
}
ok, where exactly I have to add that?
I'm using this file:
man26_shady.dlg
Thanks in advance,
ReLoaD2K
In EntryList --> RepliesList--> active
Screenshot (
http://img47.photobucket.com/albums/v144/Darth333/activefield.jpg) of the dlg file opened with a GFFeditor.
Now, the Entry no. to which you want to attach the script is up to you.
Ok, dont know if it helps but I have the DLG editor.
I have to type the script name in there right?
Another question, what I'll have to do then to make it work on my phrases?
Sorry, well the phrase worked.
But he didnt gave me the item.
here is the script:
void main () {
object oObject = GetObjectByTag("npc_tag");
if (GetLocalBoolean(oObject,0)) { return; }
CreateItemOnObject("star_lghtsbr87",oObject);
SetLocalBoolean(oObject,0,TRUE);
}
Any help would be appreciated :p
Thanks in advance,
ReLoaD2K
Here you go: screenshot with DLGedit:
http://img47.photobucket.com/albums/v144/Darth333/activedlg.jpg)
When you attach the script to the active field, the game will make the check automatically.
Originally posted by ReLoaD2K
here is the script:
void main () {
object oObject = GetObjectByTag("npc_tag");
if (GetLocalBoolean(oObject,0)) { return; }
CreateItemOnObject("star_lghtsbr87",oObject);
SetLocalBoolean(oObject,0,TRUE);
}
If this is the exact script you are using, I think your problem is here;
object oObject = GetObjectByTag("npc_tag");
npc_tag needs to be changed to a valid NPC or object tag enclosed in the quotes. For it to work properly, I think!
I hope this helps! :D
And what I do with the phrase where he says the thing with Force Persuade?
I dont know any NPC tag...
Thanks in advance,
ReLoaD2K
Reload2k,
What began as a scripting question has turned into a hand-held tutorial of how to create a dialog along with conditional scripts and custom .utc files. You seem to require a lot of baby steps, so either this topic is too complex for you at this time, or you are unwilling to look up your own information.
Please please please - go read some stuff on your own before you ask your next question. -- you're driving people crazy. Sorry to be so blunt but it's true.
Suggested reading:
DLGEdit readme.txt
Bioware's Conversation Format (at
http://nwn.bioware.com/developers) )
Like TK said,
You are probably doing something too complicated right now.
You'll learn much more if you try to gather some info by yourself. Read the documentation TK pointed you at and download some mods and check how they are done. To do this, compare the original Kotor files with the modified files. It takes time and it requires efforts but it's the only way you'll really learn something.
We've been answering questions for nearly 8 hours now. We like to help people but we are not free customer online tech support service either.
Can you answer 1 more thing or I'll drive u mad?
The script you gave me for affect mind is generating a Syntax Error! (
http://img32.exs.cx/my.php?loc=img32&image=syntaxerror.jpg)
One last help?
Thanks in advance,
ReLoaD2K
It was a simple bracket missing: (if you open a bracket you have to close it)
I duly edited the script posted above and it compiles for me.
:eek: :eek: :eek:
Wow, you could be just a bit nicer there tk, I mean, isn't teaching others to mod kinda half the fun in moddding? o.O Besides, if you keep saying things like that to people who just want to learn, pretty soon you and Darth333 are going to be the only scripters around here, so we're not gonna have a whole lot of great mods are we. :D You might want to consider what Reload can do before you tell him to stop asking questions. Besides it's not driving me crazy. :p
That's the problem Mono. There are not many people into scripting here and we have a lot to do. I think TK has provided a lot of support in this forum since the very beginning. We both like to help when we can :) But there is a limit to what we can do. The fact is that we both have full time jobs and we cannot just answer everyone's questions: this is a hobby and should remain as is.
The reason why I don' t make a lot of mods and don't come out with new areas is that I am helping people with their mods first. Tk has made a bunch of great utilities that are very useful to all modders and without his utilities, many mods would have never been released. He also made KSE for everyone to enjoy.
People should make reasonable efforts to find out a solution to what is wrong and not expect to be spoon fed all the time. Yesterday we helped Reload2K during hours...sometimes his questions were coming so quickly that it was impossible that he tried all what we said before asking (it is not the first time that this happens). Some questions would have required just a minimum of attention to find the answer. The idea is to try first and ask after. We cannot do the work for everyone...
Again we like to help but we expect the person being helped to make some efforts too.
I see, I'm the problem here.
Well you may believe or not but yes, I did tryied all of your answers and still some things are not working.
But I wont ask for help cuz I wont finish the MOD.
I think this will make everybody happy right?
I dont know anything about scripting that why I was asking so much. But I got, there should be a new rule in the forum, everybody have a max of questions to ask per day and the time between them should be like 20min what you guys think?
Thanks in advance,
ReLoaD2K
Mono_Giganto said:
Besides, if you keep saying things like that to people who just want to learn, pretty soon you and Darth333 are going to be the only scripters around here,
On the other hand, if we're too exhausted to answer questions, then there won't even be us to help. ;)
This thread is just sucked the life out of everyone involved I think.
Originally posted by ReLoaD2K
I see, I'm the problem here.
Well you may believe or not but yes, I did tryied all of your answers and still some things are not working.
But I wont ask for help cuz I wont finish the MOD.
I think this will make everybody happy right?
LOOK AT WHAT YOU'VE DONE TO THIS YOUNG MODDING LEARNER!? i think you lot should think about creating a Tutorial for this type of thing, then you wont get as many questions!
i think you lot should appolige to this kid, hes only learning and you have a go at him for asking!? children learn thought questions and fun, without these a child is nothing!
i mean no disrespect or offence to you lot, and i hope this wont lead to any aggression between us.
MattCole
People should make reasonable efforts to find out a solution to what is wrong and not expect to be spoon fed all the time. Yesterday we helped Reload2K during hours...sometimes his questions were coming so quickly that it was impossible that he tried all what we said before asking (it is not the first time that this happens). Some questions would have required just a minimum of attention to find the answer. The idea is to try first and ask after. We cannot do the work for everyone...
:monkey3: Heh, I didn't know it was yesterday too, and I'm not asking you two to do all the work for him/everyone else, I'm trying to learn scripting just for the sole purpose of not having to take up the time of anyone else. I'm just asking not to start... well it wasn't flaming, but you know what I mean, it was just a little mean tk.
I'm not saying that either of you need to do more work, you both do MORE than enough around here.
But have you noticed, that when everytime somebody new joins the forum, someone who welcomes them always talks about how nice the people around here are? That post just kinda made me disbelieve a bit and made me feel sad. :cry6:
Okay I'm just gonna quietly retreat back beneath my rock now. :D
Originally posted by Mono_Giganto
Okay I'm just gonna quietly retreat back beneath my rock now. :D
Thats two of us.