Note: LucasForums Archive Project
The content here was reconstructed by scraping the Wayback Machine in an effort to restore some of what was lost when LF went down. The LucasForums Archive Project claims no ownership over the content or assets that were archived on archive.org.

This project is meant for research purposes only.

Scripting equiped item DS points

Page: 1 of 1
 sketch42
02-06-2005, 10:42 PM
#1
well i wanted to ask a few questions before i start to get over my head in this...
what i want to do is basically while having an object equipped that object will assign DS points to the PC. The thing is.. to do this without it being a burden on the player i would want the DS point icon only to appear at the top left .. (i.e like after cick on the ok button how the icon shows in the top left than fades... ) i dont want it to prompt to constantly click ok... Is this possible??

and also ive been searching the scripting forum and found that i can use this line to assign DS points to the pc

AdjustAlignment( GetFirstPC(),ALIGNMENT_DARK_SIDE,nAmount);

would the script look anything like this???

void main()
{
ClearAllActions();
object oPC;
oPC = OBJECT_SELF;
AdjustAlignment( GetFirstPC(),ALIGNMENT_DARK_SIDE,n1);
ApplyAdjustAlignmentToObject(DURATION_TYPE_TEMPORA RY, AdjustAlignment, oPC, 120);
}


if so than i still need to know how to make the conditional for the alignment adjustment to only occur when the PC has said item equipped
 sketch42
02-07-2005, 8:04 PM
#2
anyone have any suggestions?
 RedHawke
02-07-2005, 8:32 PM
#3
sketch42,

Read the Forum Rules (http://www.lucasforums.com/showthread.php?s=&threadid=127725), as bumping a thread is not generally allowed, and could get you into trouble with the moderators.

If someone around here knows the answer to your question they will tell you so.
Originally posted by sketch42
anyone have any suggestions?
Here's my take, but I'm not a scripting expert, hence why I didn't respond before...

IMHO there is no way to do what you are attempting because there is no script run when you equip an item.

If you used the heartbeat script slot to run your item detection and give DS points script you would put the item on and be 100% DS in a hurry because your script would constantly run every so many seconds...

The only solution to your problem is to restrict your item to DS use only, and possibly, when giving the PC your DS item, use a dialogue when you ask the PC wheather they want the item or not you could give them DS points for accepting possession of it, which is kind of what you want.

You would be tainted by mere possession of a powerful DS item anyway, not by just wearing/using it only.

Just my suggestion. ;)
 sketch42
02-07-2005, 8:49 PM
#4
Originally posted by RedHawke
sketch42,

Read the Forum Rules (http://www.lucasforums.com/showthread.php?s=&threadid=127725), as bumping a thread is not generally allowed, and could get you into trouble with the moderators.

If someone around here knows the answer to your question they will tell you so.

Here's my take, but I'm not a scripting expert, hence why I didn't respond before...

IMHO there is no way to do what you are attempting because there is no script run when you equip an item.

If you used the heartbeat script slot to run your item detection and give DS points script you would put the item on and be 100% DS in a hurry because your script would constantly run every so many seconds...

The only solution to your problem is to restrict your item to DS use only, and possibly, when giving the PC your DS item, use a dialogue when you ask the PC wheather they want the item or not you could give them DS points for accepting possession of it, which is kind of what you want.

You would be tainted by mere possession of a powerful DS item anyway, not by just wearing/using it only.

Just my suggestion. ;)

i really didnt want to bump the thread .. it really took me a number of hours to get the nerve to post that second post... i really just wanted to know if this was ossible.. otherwise i wouldnt want to waste anyones time.... but thanks for the warning...
but the script could run to alternate between LS and DS points no?? like add 3 dark side points than add 2 DS points and 3 DS 2 LS etc.. it would take longer to get there .. but still pretty fast...

You would be tainted by mere possession of a powerful DS item anyway, not by just wearing/using it only.
so your saying that i can make a script that when the player finds the item and than clicks the get item button that it issues X amount of dark side points since the item itself is DS Restricted...

hmm that could possibly wrk better because than i dont have to worry about the DS point issued pop up every 2 mins :D

Thanks for the idea RedHawk

and to all the Moderators .. im terribly sorry for bumping the thread..
 tk102
02-07-2005, 10:20 PM
#5
:lightning Who dares bump this thread? :chop1:

:) J/K

You're pretty close on your script. You can probably just get away with the following:
void main() {
AdjustAlignment( GetFirstPC(), ALIGNMENT_DARK_SIDE, 10);
}

Basically the above script says adjust the alignment of the main pc by 10 points in the dark direction. The rest of your script isn't necessary. Also note the explicit use of the number 10 in place of nAmount.

Now the tricky part is getting that script to fire. There is really no easy way to get it to fire when you equip the item. Redhawke's suggestion is exactly what I would do. Dialog files are definitely the easiest way to fire scripts.
 sketch42
02-07-2005, 10:27 PM
#6
so i would need to make a new dlg for when i take the item into possession to tell it to adjust my PCs alignment by 10 points towards dark?

i always thought that dialogs where mainly for ... well dialogs... speaking etc..

so do i use the standard conversation editor?
 RedHawke
02-07-2005, 11:14 PM
#7
Originally posted by sketch42
so i would need to make a new dlg for when i take the item into possession to tell it to adjust my PCs alignment by 10 points towards dark?
Yes this would be the easiest way.
Originally posted by sketch42
i always thought that dialogs where mainly for ... well dialogs... speaking etc..
They can also be used for so much more.
Originally posted by sketch42
so do i use the standard conversation editor?
If you mean tk102's or the one built into KT then... yes. :)

Here's roughly what it sounds like you want to do;
--------------------------------------------------
1) You will need to make a .utp file like a metalbox placeable, you can use any placeable but for simplicity I'm going with a metalbox. Take a metal box placeable and open it up in KT. They are located in BIF's/templates/Blueprint, Placeables/plc_metalbox.utp

Once you have that .utp file open, on the basic tab you want to add the number 42 to the end of the MetalBox text in the name and tag fields, click on the advanced tab in the templateresref put MetalBox42 in there as well, also you want to make sure Party Interact and Usable are also checked. In the scripts tab you want to enter s42dlg in the OnUsed field, and lastly save the .utp file as metalbox42.utp to your working directory.

It is also a good thing to do a dialogue outline at this point, so you can map out what script goes where in the dialogue, and get a gist of what you are going to write.

2) Next you will need the script to fire the dialog when you open the metalbox. Here is the code for the script to fire the dialogue whenever the metalbox is opened; (Hence, the script in the On Used Field on the metal box itself.)

void main() {
object oPC=GetFirstPC();
ActionStartConversation(oPC,"s42dlg");
}

Paste this into notepad and save as s42dlg.nss. Compile.

3) Next you will need the script to give the item to the PC along with the DS points, it will look something like this;

void main()
{
CreateItemOnObject("InsertItemTagHere",GetFirstPC());
AdjustAlignment( GetFirstPC(), ALIGNMENT_DARK_SIDE, 10);

}

Paste this into notepad and save it as whatever name you want .nss. Compile.

And you might want one that just gives LS points if the PC refuses to take the item too. For resisting the temptation. ;)

4) Then you will need to get rid of the metal box once you take the item, or else people will be able to get tons of these things. At the end of the dialoge if the PC has taken the item you would then attach this script;

void main()
{

DestroyObject(GetObjectByTag ("MetalBox42"));

}

Paste this into notepad and save it as whatever name you want .nss. Compile.

5) Now that you know the scripts and the outline of your dialogue, you will then need to create the actual dialogue, and just give it a computer interface instead of the standard face to face style chat, with KT's Dialogue Editor there is a combo box that you can designate the conversation type. Be sure to save your dialogue as s42dlg.dlg. Write the dialogue to your hearts content. :D

6) All you would then need is the items files and a place in the game where you could fire a script to spawn your new placeable. And a tutorial for that is in the Scripting Forum. ;)

This is just a rough set of instructions, but I'm sure it will help! :D
 sketch42
02-07-2005, 11:39 PM
#8
Originally posted by RedHawke
5) Now that you know the scripts and the outline of your dialogue, you will then need to create the actual dialogue, and just give it a computer interface instead of the standard face to face style chat, with KT's Dialogue Editor there is a combo box that you can designate the conversation type. Write the dialogue to your hearts content.
in KT when i slect computer it asks moder or ancient... its not either.. also in KT theres type 2, 3 ,4 what are those...
also what dialog do you mean??... i dont want any dialog..im just opening a box???

6) All you would then need is the items files and a place in the game where you could fire a script to spawn your new placeable. And a tutorial for that is in the Scripting Forum. ;)

This is just a rough set of instructions, but I'm sure it will help! :D [/B]

how do i find out where a script can be fired??
 RedHawke
02-08-2005, 12:36 AM
#9
Originally posted by sketch42
in KT when i slect computer it asks moder or ancient... its not either.. also in KT theres type 2, 3 ,4 what are those...
Modern is the Blue Field Computer interface dialogue type, Ancient is the Brownish Computer interface dialogue type, use either one of those. I don't bother with the rest.
Originally posted by sketch42
also what dialog do you mean??...
The one you will have to create for your mod of course. :roleyess:
Originally posted by sketch42
i dont want any dialog..im just opening a box???
Er'... :eyeraise: Have you been reading anything of what tk102 and I have said to you?

You asked how to go about doing this, I have now given you lengthly directions on how to do it... please, please attempt it before saying what you "don't want"...

What you want to do is definately not "just opening a box", you have to do a dialogue so you can do what you want to do, dialogues run scripts, you need to run scripts for your mod to work like you said you wanted it to.

If you just want a simple box with your item in it for the PC to take, with nothing special happening when they do, then I have been spinning my wheels here. What happened to the DS points and everything??? Normal game placeables can't do that...

What seem like simple KOTOR mods can have a lot going on in the background, while they can appear in the game as simple things, there can actually be quite a few more complex things going on in the background that modders have to make, file-wise, and that the mods end users have absolutely no idea of.

Like my Ebon Hawk Construction Bench... I had to write in excess of 200 scripts, and the biggest dialogue file I have ever seen for that mod to work! People have no idea simply using the mod just how many checks are being done, by scripts in the background, just browsing the various dialog choices.

What you are wanting to attempt is far less complicated, but it will require the files and scripts I told you to create above.
Originally posted by sketch42
how do i find out where a script can be fired??
In the Scripting Forum... there are tutorials... for this... :eyeraise:
 sketch42
02-08-2005, 8:27 AM
#10
i made all the scripts as per your directions... but the dialog still puzzles me.. i know what you are saying it does... but i still dont understand what to write for a dialog..
do i write something like

Pc walks to box
box opens

thats what im not sure of... again i understand the point f the dialog and that its needed to tell the script to fire... but the contents of the dialog treei dont understand...

can you explain to me how a dialog tree would look like if its not a conversation... ... say like the dialog for the rancor in the lower sewers before the beck base.. iknow that there has to be a dialog to fire the script for the rancor to blow (right?) how would that look in the conversation tree
 tk102
02-08-2005, 8:34 AM
#11
Your dialog could just something like

Entry:
"(Inside the box there is a powerful darkside item.)"

And the possible Replies:
(Take item)
(Leave item alone)


The choice that the PC makes would fire the script that adds the item to inventory and gives Darkside points OR it would destroy the box and grant lightside points.

Dialogs offer the modder a means of using IF... THEN ... ELSE logic when choosing which scripts to fire.
 sketch42
02-08-2005, 10:51 AM
#12
Originally posted by tk102
Your dialog could just something like

Entry:
"(Inside the box there is a powerful darkside item.)"

And the possible Replies:
(Take item)
(Leave item alone)


The choice that the PC makes would fire the script that adds the item to inventory and gives Darkside points OR it would destroy the box and grant lightside points.

Dialogs offer the modder a means of using IF... THEN ... ELSE logic when choosing which scripts to fire.
so the dialog would create a cutscene of sorts ... like when you put the knotched sword in the statue in ajunta pauls cave... i get it now ok thanks.. i think im understanding how dialogs work alot better
 tk102
02-08-2005, 1:07 PM
#13
Not really a cutscene, more like when you're talking to somebody or when you're using a computer (depending on the ConversationType field in the .dlg file).

See Properties of a Dialog File (http://www.lucasforums.com/showthread.php?s=&threadid=143356) for more information.
 sketch42
02-08-2005, 1:50 PM
#14
Originally posted by tk102
Not really a cutscene, more like when you're talking to somebody or when you're using a computer (depending on the ConversationType field in the .dlg file).

See Properties of a Dialog File (http://www.lucasforums.com/showthread.php?s=&threadid=143356) for more information.

yes i read that already... and i have a Much better idea of how dialogs work...

thanks for all the help ... and i know how frustrating being a moderator is.. i used to be admin of a cell phone forum untill i couldnt find the time to run it anymore... so again ... thanks.. and i appreciate all the time youve put into helping me
 tk102
02-08-2005, 2:53 PM
#15
No problem Sketch42. :)

And I thank Redhawke for helping out on this and many other posts during what most of us mods consider the graveyard shift.
 RedHawke
02-08-2005, 8:55 PM
#16
Originally posted by tk102
And I thank Redhawke for helping out on this and many other posts during what most of us mods consider the graveyard shift.
Thanks tk! :D

@ Sketch42,

I apologise if I sounded a little short with you in my last post. My intention was, and still is, to try and help you do what you wanted to do, but you kind of sounded like you were resisiting my suggestions and I was becoming a little frustrated.
 sketch42
02-09-2005, 10:28 AM
#17
Originally posted by RedHawke
Thanks tk! :D

@ Sketch42,

I apologise if I sounded a little short with you in my last post. My intention was, and still is, to try and help you do what you wanted to do, but you kind of sounded like you were resisiting my suggestions and I was becoming a little frustrated.

lol... nope.. but like i said .. i know how frustrating it can be so no worries... what i wasnt understandin was (and i still cant seem to understand how to explain this) was how the scene would look... was just a standard walk up to a box open and take... in which case i couldnt understand what to write for the dialog ...or was it like the sith statue in ajunta pauls tomb where the game says "there seems to be a slot for a sword here... what do you want to do... 1)place the notched steel sword... 2)....."(and i didnt even think of the second option untill tk102 posted this samp[le)Entry:
"(Inside the box there is a powerful darkside item.)"

And the possible Replies:
(Take item)
(Leave item alone)

so again .. no worries...
 sketch42
02-09-2005, 4:40 PM
#18
can i make the dialog tree like this??? ... i dont think i should because i need to make entry when the pplayer actually takes the items.. (right??)http://www.imagemonster.org/getimg/dialogtree.gif)
 RedHawke
02-09-2005, 7:39 PM
#19
Yes that dialogue tree looks quite sound to me.

Though if you are using a corpse you should not use the computer dialogue interface, just leave it as normal, believe me it will look allright.

Now as far as what script to run on what dialog branch;

On the "Don't Take The Items" dialogue node you would want to attach a script that would remove the corpse placeable and give you LS points (For refusing the Evil Item). A script like so;

void main()
{
AdjustAlignment( GetFirstPC(), ALIGNMENT_LIGHT_SIDE, 10);
DestroyObject(GetObjectByTag ("InsertCorpseTagHere"));
}

This will grant LS points and destroy the corpse... all you have to add is the tag of the .utp of your corpse where indicated in the script.

On the "Take The Items..." dialogue node you would attach a script that gives you DS points, the saber, and destroys the corpse placeable. Also a script like so;

void main()
{
CreateItemOnObject("InsertItemTagHere",GetFirstPC());
AdjustAlignment( GetFirstPC(), ALIGNMENT_DARK_SIDE, 10);
DestroyObject(GetObjectByTag ("InsertCorpseTagHere"));
}

This will grant DS points, give the PC the item, and destroy the corpse... all you have to add is the tag of the corpse .utp and your tag if the items .uti where indicated in the script.

NOTE: The CreateItemOnObject line can be copied as many times as you want to give more items to the player. ;)

Also you might ask "Why destroy the corpse?" well if you don't then players would get tons of your DS items instead of just only once. :)

When all is said and done... you should have the following files for your mod;
--------------------------------------------------
The Dialogue for your corpse .dlg, these 2 LS and DS scripts .ncs, the corpse placeable .utp, the dialogue activation script .ncs, your DS Item files .uti + any other files for the item, .mdl, .mdx, etc. plus the script to spawn your corpse in whatever place you put it .ncs, and lastly a game cutscene dialogue file .dlg to run your spawn script. And whith these files your mod should be good to go. :D
Page: 1 of 1