PDA

View Full Version : Which Script?


EnderWiggin
12-12-2004, 02:09 AM
Ok, I was looking around in the Crystal Caves on Dantooine. (danm14ae) I know that I have to rename one of them to something - ewss.ncs. I then need to write my own script with the name that i cannot find to add a character to the caves and the last line of the script has to say "run ewss.ncs."

Which script do I replace?


_EW_

Darkkender
12-12-2004, 04:31 AM
On a wild guess I would say take your pick it shouldn't matter if there all for the caves anyway. but if you really would like a better idea post a list of the scripts in the module here and I'll help you guess.

tk102
12-12-2004, 08:15 AM
Hi EnderWiggin,

I looked at that module. There are multiple k_pdan_cryst##.ncs files there. I used FindRefs utility on k_pdan_cryst01.ncs and saw it was attached to scrysred002.utp which to me sounded like a red cystal that could be replaced. Just to make sure, I decompiled k_pdan_cryst01.ncs and sure enough, there is the CreateItemOnObject function with g_w_sbrcrstl01 as its parameter.

Because the source code for this .ncs isn't available you could easily hex edit the script, changing the string "g_w_sbrcrstl01" to something of identical length (your custom .uti TemplateResRef). That would work for sure.

If you want to try your hand at scripting, it would go something like this:
void main()
{
object oPC=GetFirstPC();
CreateItemOnObject( "your_uti_name", oPC); //give crystal
ActionStartConversation(oPC); //say that you got a crystal
DestroyObject(OBJECT_SELF,3.0); //make the container fade away for 3 seconds
}
Save this and compile it as k_pdan_cryst01.ncs.

EnderWiggin
12-12-2004, 11:14 AM
Will this work once i replace the coordinates??

-----------------------

void main()
{
object oEnter = GetEnteringObject();
if (GetIsPC(oEnter))
{
// this line checks if your custom npc is already there:
if(!GetIsObjectValid(GetObjectByTag("ewssm.utc")))
{
// do a whereami cheat to get the coordinates where you want to spawn the npcs and replace the 0.00 by those coordinates:
CreateObject(OBJECT_TYPE_CREATURE, "ewssm.utc", Location(Vector(0.00, 0.00, 0.00), 0.0));
}
}
// This fires the original script that we renamed
ExecuteScript("oldcrystal1.ncs", GetModule());
}

----------------------

_EW_

Darkkender
12-12-2004, 11:25 AM
Originally posted by EnderWiggin
Will this work once i replace the coordinates??

-----------------------

void main()
{
object oEnter = GetEnteringObject();
if (GetIsPC(oEnter))
{
// this line checks if your custom npc is already there:
if(!GetIsObjectValid(GetObjectByTag("ewssm.utc")))
{
// do a whereami cheat to get the coordinates where you want to spawn the npcs and replace the 0.00 by those coordinates:
CreateObject(OBJECT_TYPE_CREATURE, "ewssm.utc", Location(Vector(0.00, 0.00, 0.00), 0.0));
}
}
// This fires the original script that we renamed
ExecuteScript("oldcrystal1.ncs", GetModule());
}

----------------------

_EW_

For the get object by tag function above drop the ".utc" as this should not be a part of your tag. The Tag line entry is what you should have there. so if your tag is ewssm then great if it is something like cand for canderous then it needs to be cand.

tk102
12-12-2004, 02:50 PM
Sorry EW, I don't know how I misread your post earlier... thought you were trying introduce a new crystal. :p Following DK's advice and your own script should work. However, I would rename the original k_pdan_cryst01.ncs to oldcrystal1.ncs and your script should be called k_pdan_cryst01.ncs.

And drop the .ncs extension when you refer to oldcrystal1 in the ExecuteScript function.

EnderWiggin
12-12-2004, 03:29 PM
I was trying to add a merchant who sold you the saber/crystal. You have been a great help, Thanks!!!:D


_EW_

Darkkender
12-12-2004, 05:23 PM
Glad I could be of some help.

nice catch tk102 I missed that one.