PDA

View Full Version : easier? (Placing Items In The Game)


akuma7802
05-30-2006, 02:29 AM
is there an easier way to place custom items in lets say like a footlocker and/or dead body in the game? is there a tutorial that can make me be able to place custom items in the game TSL

RedHawke
05-30-2006, 03:44 AM
The only easy way to place items in-game is through the work bench or medical lab station. It only requires the editing of a couple of 2da files, and is by far the easiest route for beginners. Here is a guide/tutorial (http://www.lucasforums.com/showthread.php?t=144452) for that. :D

Unfortunately, most of the placables are re-used between modules so if you were to add an item to a footlocker, for example, you would find your item a ton of times throughout the game, you can even break the game or quests this way.

The only safe way of adding items to placables in TSL is through scripting. We have a plethora of scripting tutorials up above in our Scripting (http://www.lucasforums.com/forumdisplay.php?f=597) tutorial forum. ;) But be warned, scripting can get complicated, while not overly difficult there is more than a little bit you will have to learn.

A great way of seeing how this is done is to take a look at someones released mod that does something similar to what you want to do. Most of us modders include our source script files, and that is the best way to get the feel for what you'll likely have to do.

I hope this helps! :D

ABCoLD
05-31-2006, 02:11 AM
You want the following threads:
http://www.lucasforums.com/showthread.php?t=134067 (Non-script method)
and the more useful: http://lucasforums.com/showthread.php?t=143536 (scripted method) I used the second one, Darth333's stuff if I remember correctly when I made my Yet Another Exile Item Pack and it worked wonderfully. (And it's a cool mod, check it out!) :)

RedHawke
05-31-2006, 02:59 AM
^^^^
ABCoLD, the non script method won't work in TSL as placables are re-used between modules like I said above. ;)

akuma7802
06-04-2006, 09:01 PM
i got the whereami band and used it and got the areas and location i need just using the loactions to put a new footlocker with custom items in there. in the threads it shows

//note this code allows for re-entry as-is,
// you should only attach it to a dialog
// that you know will only fire once.
// To prevent re-entry in a more general sense, see tk102's notes in the next post

void main()
{
float x=0.00f; //Here is where you add the 'whereami' cheat coordinate 1.
float y=0.00f; //Here is where you add the 'whereami' cheat coordinate 2.
float z=0.00f; //Here is where you add the 'whereami' cheat coordinate 3.
float r=0.0f; // This is where you set the orientation of the placeable, set in degrees.
vector MyVec = Vector(x,y,z); //line 1
location MyLoc = Location(MyVec, r); //line 2
object oLocker=CreateObject( OBJECT_TYPE_PLACEABLE, "footlker099", MyLoc); //line3

CreateItemOnObject("g_w_lghtsbr05", oLocker);
CreateItemOnObject("g_a_mstrrobe01", oLocker);
CreateItemOnObject("g_w_sbrcrstl04", oLocker, 2);

putting self explained but the bearing and neartest to door and whats the vector, location and object locker? what do i put there. sorry kinda blonde

RedHawke
06-05-2006, 02:35 AM
//note this code allows for re-entry as-is,
// you should only attach it to a dialog
// that you know will only fire once.
// To prevent re-entry in a more general sense, see tk102's notes in the next post

void main()
{
float x=0.00f; //Here is where you add the 'whereami' cheat coordinate 1.
float y=0.00f; //Here is where you add the 'whereami' cheat coordinate 2.
float z=0.00f; //Here is where you add the 'whereami' cheat coordinate 3.
float r=0.0f; // This is where you set the orientation of the placeable, set in degrees.
vector MyVec = Vector(x,y,z); //line 1
location MyLoc = Location(MyVec, r); //line 2
object oLocker=CreateObject( OBJECT_TYPE_PLACEABLE, "footlker099", MyLoc); //line3

CreateItemOnObject("g_w_lghtsbr05", oLocker);
CreateItemOnObject("g_a_mstrrobe01", oLocker);
CreateItemOnObject("g_w_sbrcrstl04", oLocker, 2);
putting self explained but the bearing and neartest to door and whats the vector, location and object locker? what do i put there. sorry kinda blonde
The only things you need to concern yourself with on the script is the 4 numbers you get from the Whereami coordinates, place them, in order, over the 0.00's in the script above... X, Y, and Z and Orientation in R.

The vector and location lines are simply declairing the different variables the script is going to use later.

The object locker line you need not worry about either other than the "footlker099" part as this should be changed to whatever you named your placeable utp file just make sure to leave the quotes on either side.

The last few createitemonobject lines are where the items get spawned into the placeable the only things you need alter is the text in between the quotes as this is where the filename/tag of the items you want to spawn go. These lines can also be added as many times as you want to spawn as many items as you want. ;)

Also note on the last line of code...

CreateItemOnObject("g_w_sbrcrstl04", oLocker, 2);
The part I colored yellow the 2 indicates that this will spawn a stack of 2 of the items, you can change the 2 to 10 or 100, this way you can place quantities of items.

I hope this helps! :D

lord ignarn
06-05-2006, 07:03 AM
But, what about some unique locations, like the Iziz Palace museum? If you add one object there it won´t appear all over the game, will it?

EnderWiggin
06-05-2006, 07:49 AM
As long as it is unique, no, it will appear once.

But there was a lot of reusing, and so you should use FindRefs or something to check.

_EW_

akuma7802
06-05-2006, 01:11 PM
wow thats helps thx, if i have anymore question i will ask. thx very much

akuma7802
06-05-2006, 11:15 PM
one more thing. where and what .dlg to use for the new footlocker.

Next you will need the .dlg file from an in game cutscene. The best place for attaching placeable spawning scripts is the mandantory in game cutscenes. Example: the Sith and Republic Soldiers bantering on Manaan.
Open the module up and locate the cutscenes dialog (.dlg) file open it up in the dialogue editor of your choice, Fred's or tk102's and search for a line that is certain to be spoken, and you should see somewhere a place that says "script to run for this node" or "script that fires when spoken" and make sure it is blank, if it is then you can easily enter your script name in there, in your case it would be ev_footlkr1. Save the edited .dlg file.

i got eveything expect the .dlg. which .dlg from kt should i use or is it the Dialog.Tlk editor?

RedHawke
06-05-2006, 11:38 PM
Unfortunately we cannot tell you anything more until you identify better what in game cutscenene or dialog that runs in the module that you want to use to run your script.

akuma7802
06-07-2006, 11:49 AM
i want to be able to put a footlocker or a metal container inside the game with my custom items where i can obtain them without having to use the cheat mod. i was following your tutorial on spawning items in the game and got stumpped at the .dlg. i am gratefull for your help. the place i am working on is the crystal cave where i can put a footlocker next to the crystal formation. i have the "whereami" and using it. just wondering about the .dlg thats all. the .dlg that i know is in use at the time is when u get the personal crystal and kiera cutscene comes into play

Edit: what do u mean by dialog runs in the module. i am not sure what u mean

akuma7802
06-11-2006, 10:45 PM
one question i was following the tutorial made by redhawke on spawning items. i am using KT and wanted to spawn a footlocker in TSL. i have made a new footlocker and figuered out how to use the nss and to complie the file to make it into .ncs now i am having trouble with the cutscene dialog. where can i find the cutscene in KT. like would it be .utc , utp , utd. which one? or is it the dialog from the charater itsself such as handmaiden or another i am lost on that part need a little help sorry for the blonde hair lol. what i want to do is to be able to place spawn with my items in it but just there no cutscene its just there smell what i am stepping in.

RedHawke
06-12-2006, 02:12 AM
A cutscene is a mandantory dialog that the game runs, one such cutscene is at the very beginning of TSL when your PC is floating in the tank and Kreia says "awaken" and you end up on the floor.

You will be searching for dialog files (dlg), and you either edit the cutscene dialog and add your script call into one of those dialog lines or the better method in case the dialog files isn't uniquely named you can find a script that the dialog runs and name yours the same as that one, simply renaming the original, then run the previous script after yours is run by calling it to run from your script. ;)

What you are doing isn't a beginners level thing and that tutorial does assume that you, the reader, have some knowledge of the various game files and are familiar with where things are in KotOR Tool.

Since this is basically the same topic as your other thread I am going to merge them...

akuma7802
06-13-2006, 12:25 PM
oh ok i think i understand now. thx

darthrevanrlz
06-15-2006, 07:54 PM
so how exactly do you add the script calling?

Just got started modding like 2 days, ago, eh.

Like Akuma, I'm simply stumped at the dlg. part...

Assuming I'm using the 'awaken' dialogue...

I've got the DLGEditor and the dialogue. Now what?

RedHawke
06-15-2006, 11:44 PM
Just got started modding like 2 days, ago, eh.
What you are doing isn't a beginners level thing and that tutorial does assume that you, the reader, have some knowledge of the various game files and are familiar with where things are in KotOR Tool.
Start with simpler modding aspirations then move up to the more difficult ones, just trying to dive right in, and not knowing what goes where and why, will lead only to frustration. ;)

I've got the DLGEditor and the dialogue. Now what?
Up above, in Holwan Labs here, you should see some locked forums, they are full of tutorials and such, you should start there. :)

darthrevanrlz
06-16-2006, 01:56 AM
Any thread you can think of? Browsed the tutorials, but they seem to go rather quickly over the part I'm stuck at...

Hey, I can handle .2da, edit/create items and even script simple force powers. I just can't seem to find a tutorial going into details on how to handle dlg. files and thus make the medbox/container/locker actually appear...

And for some reasons, I just can't compile k_force_inc.nss, K_inc_debug and k_sp1_genreric.nss for KOTOR2...

Wanted to tweak some powers, but it seems I can't even compile the ORIGINAL k_inc_force... getting a report of like a hundred mistakes... And yes, I have nsscomp.exe and the 3 files in the same folder... Was able to compile powers scripts, eh.

You'd think just tweaking during duration and lessening overpowered FPs would be simple, geez... For crying out loud, it'd be easier to just remove buffs and replaces them with a scripted version...

Oh well, I'm off to sleep... Hopefully someone can shed more light on all that mumbo-jumbo...

Oh, and about "aspirations"... :D

So far, all I want so far is to tweak some in-game force powers and "put stuff around in boxes...". Well, I already tweaked and created "special" (can't say more since those WORK, lol, but let's just say they act as lesser force powers for non-Jedi NPCs...) armbands/powers for specific PCs...

Oh, by the way, RH, just so you know...

I DID try to do it easy way...

Copied/pasted your PCBeginning itempack only I tried to change the location ever so slightly and the name of the box (created an according .uti file)...

Couldn't even get the freakin' thing to spawn...

Double sigh.

RedHawke
06-16-2006, 02:16 AM
I just can't seem to find a tutorial going into details on how to handle dlg. files and thus make the medbox/container/locker actually appear...
There isn't one just for dlg files as there is no way to write a tutorial to cover everything possible.

Have you looked at the tools thread, downloaded tk102's DLGEdit yet? Download that extract a dlg file from the game with KT then open it up in DLGEdit, play around with things. ;)

And for some reasons, I just can't compile k_force_inc.nss, K_inc_debug and k_sp1_genreric.nss for KOTOR2... Wanted to tweak some powers, but it seems I can't even compile the ORIGINAL k_inc_force... getting a report of like a hundred mistakes... And yes, I have nsscomp.exe and the 3 files in the same folder... Was able to compile powers scripts, eh.
Because you don't compile those scripts they are include scripts, while you can make changes to them they only compile as part of other scripts, so if you change an include script you will need to re-compile every game script that uses that include script.

@ You started out well by tweaking anothers mod to see if you can get things to work, I suggest you keep trying. (That's why modders include the source script files with their mods.) :)

Also, and this is for everyone as well, you will have to do a fair amount of reading but you can find what you are looking for even in Tutorials that seem to have nothing to do with what you want to accomplish.

Example: Step #4 in this Tutorial How To Recruit An NPC In 10 Steps (http://www.lucasforums.com/showthread.php?t=131944) is about dialogs and attaching scripts to them. ;)

darthrevanrlz
06-16-2006, 10:07 AM
Oh, about the K_inc_force thingie, I meant compiling k_sp1 alone WITH the other two in same compiling folder...

Reason why it didn't work seems to be that I accidently deleted the nwnnscript.txt...

Got the "revamped" power (in-game effect) to work just fine... Now I'm trying to figure out how to show it in the FP description screen...

Anyway, about the dlg. thingie... Is there a thread/tutorial listing *some8 functions/commands or at least a few examples on how to do a few key things?

Meh, worst case scenario I'll just compare a modded dlg.file with an in-game original one, I suppose...

stoffe
06-16-2006, 11:02 AM
Got the "revamped" power (in-game effect) to work just fine... Now I'm trying to figure out how to show it in the FP description screen...


The force power descriptions are found in the dialog.tlk file. Check the desc column for the power's line in spells.2da for the StrRef in question. Then you can look it up and modify that entry in the dialog.tlk file.

As for DLG editing, what exactly are you having trouble with? It's one of the more complex structures used by the game, but using tk102's DLG Editor makes it a lot easier. It's still a pretty big subject to explain everything about though. :)

Darth333
06-16-2006, 11:46 AM
For .dlg files, you can have a look at this sticky thread: http://www.lucasforums.com/showthread.php?t=143356

Also take the time to read the readme that comes with tk102's dlgeditor.

darthrevanrlz
06-16-2006, 12:20 PM
The force power descriptions are found in the dialog.tlk file. Check the desc column for the power's line in spells.2da for the StrRef in question. Then you can look it up and modify that entry in the dialog.tlk file.

As for DLG editing, what exactly are you having trouble with? It's one of the more complex structures used by the game, but using tk102's DLG Editor makes it a lot easier. It's still a pretty big subject to explain everything about though. :)

Will do.

BUt I remember checking the modded .dlg file after installing you High Lvl Powers mod, Stoffe. New saw the description of YOUR customized powers and I still can't figure for the life of me where those numbers in the spells.2da (name & Spell description) came from...



I get how the "Changes" file numbers match the ones in the .2da... but where the hell did those 136xxx values come from?

Anyway, I'm off to lunch.... Guess I'll use one of those create-FP threads and start from scratch later this afternoon...

Probably will be easier than trying to get all of what ya did and keep up...

stoffe
06-16-2006, 01:20 PM
BUt I remember checking the modded .dlg file after installing you High Lvl Powers mod, Stoffe. New saw the description of YOUR customized powers and I still can't figure for the life of me where those numbers in the spells.2da (name & Spell description) came from...

I get how the "Changes" file numbers match the ones in the .2da... but where the hell did those 136xxx values come from?


The values in the name and desc columns in the spells.2da file are StrRefs (String References), which essentially are index values for an entry to use within the dialog.tlk file. DLG files on the other hand are not used for force powers (unless you script them to activate a dialog for whatever purpose).

All standard text in the game is located in the dialog.tlk file to make it easy to localize to other languages. This way the developers just have to replace this single file, and all text in the game will be changed.

Remember the distinction
.dlg files = Dialog files, used for in-game conversations, computer terminals and to control cutscenes.
dialog.tlk file = Repository of all standard in-game text strings, and sound references for the creature Soundsets.

The dialog.tlk file, located in your main KotOR folder alongside the swkotor2.exe file (not in the override folder like most other modified resources), can be thought of as a long array (or list), with labels starting at index 0 and going upwards, that contain text string entries. A StrRef is an index value into this list/array. For example, StrRef 136500 refers to the 136501th string entry in the dialog.tlk file (since the index starts at 0).

An entry in the dialog.tlk file contains a text string, and an associated ResRef (Resource Reference, i.e. name of the sound resource file to use) value that can optionally specify a sound.

You can use an utility like TalkEd or KotorTLK, found here (http://www.starwarsknights.com/tools.php#de), to view and modify your dialog.tlk file.

As for the TSLPatcher mod installer you mention, it can be used to insert new entries into the dialog.tlk file of the user, keep track of which StrRef values the entries are added as (which may vary depending on what other changes this particular user has made to the file earlier), and insert those StrRef values into the proper cells in a 2DA file, thus saving the user the trouble of doing all this manually with KotorTool when installing the mod into their game.

Since the resulting StrRefs vary depending on what other mods the user has installed, the installer configuration uses dummy indexes in the form of StrRef# tokens, which are substituted for the actual resulting values when installation occurs. This was made to make it easier to install and make my High Level Force Powers mod compatible with other mods people already had installed, since it's lots of grunt work to manually merge 2DA files, append entries to dialog.tlk and make sure everything adds up. :)

darthrevanrlz
06-16-2006, 05:10 PM
Oh dear...

Just came back and realized I wasn't even looking at the right tlk file.

For some reason, the TLKEDitor always opens in the KOTOR I directory... Browsed all the way to KOTOR2 folder the first time and just assumed it would go right back...

So, yeah...

All your numbers DO add up (duh) and I can actually make sense of it all...

Oh well, thanks anyway, for the answer...

Got a free two hours, so I'll try figuring out the TSLPatcher thingie...

akuma7802
06-17-2006, 06:41 PM
ok i understand but the thing is that would i have to make a new script or just add on to another. i am looking for the cutscenes in the dialog editor but maybe i just looking for the wrong thing. ok darthrevanrlz maybe you can help me if u got it b/c i am still kinda stumped. on outting the footlocker in the script and having the footlocker appear where i want it in the game. and where in the keria dialog i can find the "awake" cutscrene

stoffe
06-17-2006, 07:23 PM
and where in the keria dialog i can find the "awake" cutscrene

This is not present in the main kreia.dlg file. The scene where you awaken in the kolto tank in the MedBay is found separately in the 101awake.dlg file, found in (in KotorTools treeview) Kotor2 --> ERFs --> Modules --> 101PER_dlg.erf --> 1 --> 101awake.dlg. The chat with Kreia in the morgue is found in the 101kreia.dlg file in the same location.

akuma7802
06-17-2006, 09:05 PM
wow that helps. the footlocker that i am wanted to place still does not show

akuma7802
06-19-2006, 02:20 PM
I am having a little trouble b/c the foot locker i want to put in the game is not appearing at all and including the cutscrene. where keria wakes up in the begining now she just appears to be standing and does not even show her getting up. hwere would be the best place to put the footlocker in the script to actived the new footlocker and so it will appear in the game.

stoffe
06-19-2006, 03:08 PM
I am having a little trouble b/c the foot locker i want to put in the game is not appearing at all and including the cutscrene. where keria wakes up in the begining now she just appears to be standing and does not even show her getting up.

Sounds like your DLG files have been corrupted. What did you use to edit the dialog files? The DLG editor in KotorTool does not work with KotOR2, and will corrupt files you save with it. You'll either have to use tk102's DLG Editor, or a GFF Editor.

To spawn my own custom gear container I have modified the a_hatchopen script in the 101PER module. This is the script that runs when you wake up in the kolto tank in the Peragus Medbay. I'm using it to add an extra plasteel cylinder in the storage area and that seems to work fine. :)

akuma7802
06-19-2006, 03:50 PM
i was using the tk102's dlg editor but i was using a script that was already been mod. no where in the script lets take what u was using the a_hatchopen where would i put the new foot locker or placeable.

could u send me your modified script and the plasteel cylinder aso i can have a good idea what i am doing wrong. maybe i am putting the new footlocker in the wrong slot.

stoffe
06-19-2006, 04:22 PM
could u send me your modified script and the plasteel cylinder aso i can have a good idea what i am doing wrong. maybe i am putting the new footlocker in the wrong slot.

Here is the modified a_hatch_open.nss script I've used. I've avoided creating a new container placeable and used one of the standard ones in the game instead, which I then add my custom items to in the script. The cylinder is spawned inside the storage room opposite to the computer console that unlocks the morgue where Kreia rests.

Look for the part of the script inside the "------" dashed lines:


// ST: a_hatch_open.nss (101PER_s.rim)


void RemoveT3();

// ST: custom function used to spawn storage bin if necessary.
object ST_SpawnStorageBin();

void main() {
object oEnter = GetEnteringObject();

if (GetEnteringObject() == GetFirstPC()) {
if (GetGlobalNumber("101PER_Sion_Arrives") > 0)
PlayRoomAnimation("101PERzc", ANIMATION_ROOM_SCRIPTLOOP01);
else
PlayRoomAnimation("101PERzc", ANIMATION_ROOM_SCRIPTLOOP02);

if (GetLoadFromSaveGame()) {
SetGlobalFadeOut();
SetFadeUntilScript();
DelayCommand(2.0, SetGlobalFadeIn(1.0, 1.0));
return;
}

if (GetGlobalBoolean("PER_TURNINTO_T3M4")) {
SetGlobalBoolean("PER_TURNINTO_T3M4", FALSE);
DelayCommand(0.1, RemoveT3());
}

if (GetGlobalNumber("105PER_T3_End") == 1) {
SetGlobalFadeIn(0.0, 1.0);
SetGlobalNumber("105PER_T3_End", 2);
object oAtton = GetObjectByTag("Atton");
DelayCommand(0.5, AssignCommand(oAtton, ClearAllActions()));
DelayCommand(0.5, AssignCommand(oAtton, ActionStartConversation(oEnter, "101Atton", FALSE, CONVERSATION_TYPE_CINEMATIC, TRUE)));
}

object oWP = GetObjectByTag("WP_wakeup_donnie");
if (GetIsObjectValid(oWP) && GetLocalBoolean(oWP, 29)) {
PlayRoomAnimation("101per2b", ANIMATION_ROOM_SCRIPTLOOP03);
}
else {
if (GENDER_MALE == GetGender(oEnter)) {
SetGlobalBoolean("000_PLAYER_GENDER", TRUE);
// ST: Don't!
// return;
}

// ST: ADD CUSTOM ITEMS TO START WITH HERE -----------------
object oBin = ST_SpawnStorageBin();
if (GetIsObjectValid(oBin)) {
CreateItemOnObject("st_alisrobe03", oBin);
CreateItemOnObject("st_alisbelt01", oBin);
CreateItemOnObject("st_aliscirclet", oBin);
}
// ---------------------------------------------------------

SetGlobalFadeOut();
SetFadeUntilScript();
}
}
}


void RemoveT3() {
object oT3 = GetObjectByTag("t3m4");
if (GetIsObjectValid(oT3)) {
AurPostString("destroying t3 off the map", 5, 15, 10.0);
DestroyObject(oT3);
}
SetNPCSelectability(NPC_T3_M4, FALSE);

object oPC = GetFirstPC();
effect eEff = GetFirstEffect(oPC);
while (GetIsEffectValid(eEff)) {
if (GetEffectType(eEff) == EFFECT_TYPE_PARALYZE)
RemoveEffect(oPC, eEff);

eEff = GetNextEffect(oPC);
}

SetGlobalFadeIn(0.0, 2.0);
}


// ST: custom function used to spawn storage bin if necessary.
object ST_SpawnStorageBin() {
location lLoc = Location(Vector(-0.99, -5.8, 9.09), 138.0);
int nIdx = 0;
int bFound = FALSE;

object oBin = GetObjectByTag("MilHighPlstcCylin", nIdx);
while (GetIsObjectValid(oBin)) {
if (GetDistanceBetweenLocations2D(GetLocation(oBin), lLoc) < 0.5) {
bFound = TRUE;
break;
}
oBin = GetObjectByTag("MilHighPlstcCylin", ++nIdx);
}

if (!GetIsObjectValid(oBin) || !bFound) {
oBin = CreateObject(OBJECT_TYPE_PLACEABLE, "g_tresmilhig005", lLoc);

if (GetIsObjectValid(oBin)) {
RemoveHeartbeat(oBin);
return oBin;
}
}
return OBJECT_INVALID;
}

akuma7802
06-19-2006, 11:12 PM
oh ok so do i add that to a .dlg or just compile that into .ncs sorry i am a little blonde when it comes to this. ok i am really blonde its like u have to point it out and show me how to do it i am really sorry.

ok i could the basics of the making my own footlocker with tk. i made a nss and compiled it to .ncs. the script is the problem and the cutscrenes. now do i make a script like u then put into the overdrive or can i put the new footlocker into a .dlg like 101keria. not sure b/c i just want a custom footlocker with custom items and placed where i want. and i know this is really complicated. like i said i am sorry.

stoffe
06-20-2006, 06:42 AM
Oh ok. So, do I add that to a .dlg or just compile that into .ncs? Sorry I am a little blonde when it comes to this. Ok I am really blonde, it's like you have to point it out and show me how to do it.


You compile the a_hatch_open.nss file with nwnnsscomp and put the resulting NCS file into the override folder. Nothing else should be necessary, since the script is already assigned as the OnEnter event script of the Peragus Administration level.

If you want to use a custom UTP template for the container instead of a standard game plasteel cylinder, just replace the Tag and ResRef of the cylinder with the corresponding values for your own UTP. Check the custom function at the bottom of the script, they shouldn't be hard to find.

EnderWiggin
06-20-2006, 06:43 PM
Did you double post that on purpose? It looks like you did, because it was three hours and twenty-seven minutes apart.

Bumping is not allowed, as per forum rules.

Don't worry, this community is helpful -- you'll get an answer -- but remember, it's not a chat room. It takes time :)

If you click 'Edit this' under your post and delete the second one, I will delete this post and you can delete the post that explains what happened.

Sorry about the misunderstanding.

_EW_

akuma7802
06-22-2006, 05:00 AM
in the script what part do i need to change for .dlg?

if (GetEnteringObject() == GetFirstPC()) {
if (GetGlobalNumber("101PER_Sion_Arrives") > 0)
PlayRoomAnimation("101PERzc", ANIMATION_ROOM_SCRIPTLOOP01);?
else
PlayRoomAnimation("101PERzc", ANIMATION_ROOM_SCRIPTLOOP02);

if (GetLoadFromSaveGame()) {
SetGlobalFadeOut();
SetFadeUntilScript();
DelayCommand(2.0, SetGlobalFadeIn(1.0, 1.0));
return;
}

if (GetGlobalBoolean("PER_TURNINTO_T3M4")) {
SetGlobalBoolean("PER_TURNINTO_T3M4", FALSE);
DelayCommand(0.1, RemoveT3());
}

if (GetGlobalNumber("105PER_T3_End") == 1) {
SetGlobalFadeIn(0.0, 1.0);
SetGlobalNumber("105PER_T3_End", 2);
object oAtton = GetObjectByTag("Atton");?
DelayCommand(0.5, AssignCommand(oAtton, ClearAllActions()));
DelayCommand(0.5, AssignCommand(oAtton, ActionStartConversation(oEnter, "101Atton", FALSE, CONVERSATION_TYPE_CINEMATIC, TRUE)));
}

object oWP = GetObjectByTag("WP_wakeup_donnie");?
if (GetIsObjectValid(oWP) && GetLocalBoolean(oWP, 29)) {
PlayRoomAnimation("101per2b", ANIMATION_ROOM_SCRIPTLOOP03);?

this part where it says t3m4?

void RemoveT3() {
object oT3 = GetObjectByTag("t3m4");
if (GetIsObjectValid(oT3)) {
AurPostString("destroying t3 off the map", 5, 15, 10.0);
DestroyObject(oT3);
}
SetNPCSelectability(NPC_T3_M4, FALSE);

object oPC = GetFirstPC();
effect eEff = GetFirstEffect(oPC);
while (GetIsEffectValid(eEff)) {
if (GetEffectType(eEff) == EFFECT_TYPE_PARALYZE)
RemoveEffect(oPC, eEff);

eEff = GetNextEffect(oPC);
}

SetGlobalFadeIn(0.0, 2.0);
}


// ST: custom function used to spawn storage bin if necessary.
object ST_SpawnStorageBin() {
location lLoc = Location(Vector(-0.99, -5.8, 9.09), 138.0);
int nIdx = 0;
int bFound = FALSE;

object oBin = GetObjectByTag("MilHighPlstcCylin", nIdx);
while (GetIsObjectValid(oBin)) {
if (GetDistanceBetweenLocations2D(GetLocation(oBin), lLoc) < 0.5) {
bFound = TRUE;
break;
}
oBin = GetObjectByTag("MilHighPlstcCylin", ++nIdx);?
}

if (!GetIsObjectValid(oBin) || !bFound) {
oBin = CreateObject(OBJECT_TYPE_PLACEABLE, "g_tresmilhig005", lLoc);

if (GetIsObjectValid(oBin)) {
RemoveHeartbeat(oBin);
return oBin;
}
}
return OBJECT_INVALID;
}

oh and the question marks i am kinda wondering aobut those.

stoffe
06-22-2006, 06:36 AM
in the script what part do i need to change for .dlg?
oh and the question marks i am kinda wondering aobut those.

That script is not a script made to be fired from a dialog (.dlg) file. It is made to be automatically run every time the player enters the area it is assigned to (101PER, Peragus Administration in this case).

So, if you for some reason want to fire it from a dialog you'll have to change pretty much all of it. You might as well start over from scratch then. :) If you only want the part that spawns a new container and fills it with custom items that script could look something like:


object SpawnStorageBin();

void main() {
object oBin = SpawnStorageBin();
if (GetIsObjectValid(oBin)) {
CreateItemOnObject("FirstItemResref", oBin);
CreateItemOnObject("SecondItemResref", oBin);
CreateItemOnObject("ThirdItemResref", oBin);
}
}

object SpawnStorageBin() {
location lLoc = Location(Vector(-0.99, -5.8, 9.09), 138.0);
int nIdx = 0;
int bFound = FALSE;

object oBin = GetObjectByTag("MilHighPlstcCylin", nIdx);
while (GetIsObjectValid(oBin)) {
if (GetDistanceBetweenLocations2D(GetLocation(oBin), lLoc) < 0.5) {
bFound = TRUE;
break;
}
oBin = GetObjectByTag("MilHighPlstcCylin", ++nIdx);
}

if (!GetIsObjectValid(oBin) || !bFound) {
oBin = CreateObject(OBJECT_TYPE_PLACEABLE, "g_tresmilhig005", lLoc);

if (GetIsObjectValid(oBin)) {
RemoveHeartbeat(oBin);
return oBin;
}
}
return OBJECT_INVALID;
}


The things marked in bold above is what you may need to change. Replace the text in red with the ResRef values of the items you wish the container to contain. Replace the text in green with the x, y, z coordinates in-game you want the container to appear. Replace the text in blue with the direction, in degrees, you want the container to be facing. Replace the text in yellow with the Tag of the container placeable you wish to spawn. And finally, replace the text in pink with the ResRef of the container placeable you wish to spawn.

Save the script as whatever name you like (max 16 character, alphanumerical characters only!) and compile it into a NCS file, which you put in override. Then you put this name (without the .ncs extension) in the Script# field on the dialog node in a .dlg file where you want it to be fired.



The question marks looks like something a text editor which can't handle both Linefeed + Carriage return for marking a new line, showing the unhandled of the pair as a ? instead. Seems like that text in question is inconsistent in how it marks a new line.

akuma7802
06-22-2006, 09:02 AM
wow that helps thank u very much if i have any other questions i will sure to ask them

akuma7802
06-22-2006, 10:45 PM
i think there is something wrong with my dialog files b/c when i place the .ncs in the script # and then place it in the overdrive file the placeable still does not show up. i am using the KT to compile the nss to ncs and that might be it i am not sure.

stoffe
06-23-2006, 07:31 AM
i think there is something wrong with my dialog files b/c when i place the .ncs in the script # and then place it in the overdrive file the placeable still does not show up. i am using the KT to compile the nss to ncs and that might be it i am not sure.

Hard to say what could be wrong without knowing what you have done. Some things to check:
Make sure your changes to the DLG file has been saved. You usually have to select another field or node after having changed things, otherwise your changes may not be kept when you save.


Make sure you've added the script to the correct DLG node. Sometimes there are many that looks similar but fire under different circumstances.


Make sure you've set the script name correctly. If your script is named spawnbox.ncs, you should put spawnbox in the Script# field.


In the script, make sure you've set the coordinates for the container correctly. Unlike creatures, placeables may be spawned "inside" other placeables, or outside the game world (inside walls, below the floor, above the ceiling etc) without problems.


If you use a custom container placeable that you've made yourself, make sure it's in the override folder and that its filename conforms to the ResRef rules (i.e. only alpanumerical characters and underscores, max 16 characters in length).


Make sure you've set the ResRef of the container properly in the script. If your container placeable is named mybox.utp, put "mybox" as the ResRef in the script.


Make sure you've set the Tag of the container properly in the script. This is specified in the Tag field inside the UTP file of the placeable and is not necessarily the same as the ResRef (though I recommend making them the same if you create your own placeables for simplicity's sake).

Darkkender
06-23-2006, 01:47 PM
Also if your launching a script in a dialog make certain that the dialog branch has never been entered in your savegame before. Frequently scripts can get fouled up when launching because of this.

akuma7802
06-23-2006, 02:32 PM
object SpawnStorageBin();

void main() {
object oBin = SpawnStorageBin();
if (GetIsObjectValid(oBin)) {
CreateItemOnObject("u_l_colo_26", oBin);
CreateItemOnObject("u_l_colo_29", oBin);
CreateItemOnObject("djmask", oBin);
}
}

object SpawnStorageBin() {
location lLoc = Location(Vector(70.82, 37.37, 1.80),14.57 );
int nIdx = 0;
int bFound = FALSE;

object oBin = GetObjectByTag("footlocker99", nIdx);
while (GetIsObjectValid(oBin)) {
if (GetDistanceBetweenLocations2D(GetLocation(oBin), lLoc) < 0.5) {
bFound = TRUE;
break;
}
oBin = GetObjectByTag("footlooker99", ++nIdx);
}

if (!GetIsObjectValid(oBin) || !bFound) {
oBin = CreateObject(OBJECT_TYPE_PLACEABLE, "footlker099", lLoc);

if (GetIsObjectValid(oBin)) {
RemoveHeartbeat(oBin);
return oBin;
}
}
return OBJECT_INVALID;
}
thats what i have now and the .dlg can i make it where on perogus pc opnes a door and the box appears?

Is it possible to spawn a box from a dialog that you can open a door?