PDA

View Full Version : script example please


ace92
07-28-2008, 06:34 PM
i want to make a conversation and i don't want every line to show up every time, for example i want the PC to talk to someone and only if the pc is at 85 LS points he can chose the line, how do i do that?

TriggerGod
07-28-2008, 08:15 PM
*sigh* If you have a problem, please state what game...
Anyways, if for TSL:
There is a script called c_lighthigh. Here is the source script, as I cannot decompile because DeNCS hates me.
//:: c_lighthigh
/*
checks to see if pc is really good
*/
//:: Created By: Jason Booth
//:: Copyright (c) 2002 Bioware Corp.

#include "k_inc_debug"
#include "k_inc_utility"

int StartingConditional()
{
return IsLightHigh();
}

I'm not sure if there is a way to see if there is a way to know how high it is, except the dialog your companions have when you are kinda LS/DS, and mostly LS/DS. So use that as a guideline.

sekan
07-28-2008, 08:21 PM
I'm not sure but I think this script should do it


int StartingConditional()
{
object oPC = GetFirstPC();

if (GetFactionAverageGoodEvilAlignment(oPC) != 85) return FALSE;

return TRUE;
}

oldflash
07-29-2008, 02:40 AM
Is not better if you put

if (GetFactionAverageGoodEvilAlignment(oPC) < 84) return FALSE;
?
Thinking about npc with 90 lightside points which can return false.

glovemaster
07-29-2008, 04:15 AM
Is not better if you put

if (GetFactionAverageGoodEvilAlignment(oPC) < 84) return FALSE;
?
Thinking about npc with 90 lightside points which can return false.

Well it depends on whether or not ace wants it to be 85 or higher. Admittedly ace hasn't been very clear but I think that 85+ would be better since its rare than anyone will have exactly 85.
Also its GetAlignmentGoodEvil(); to return the alignment as an integer.

int StartingConditional()
{
return (GetAlignmentGoodEvil(GetFirstPC()) >= 85);
}

ace92
07-29-2008, 05:10 AM
ohh i see, sorry i didn't mention it but yes it's for TSL, i meant that he has at least 85 so it's should be:

int StartingConditional()
{
return (GetAlignmentGoodEvil(GetFirstPC()) >= 85);
}

right?
another question if i may, is it possible to write a script that it's condition is that if the player finished a quest?

glovemaster
07-29-2008, 05:18 AM
Right.
another question if i may, is it possible to write a script that it's condition is that if the player finished a quest?
Its certainly possible, most quests have a global variable assigned to them to track their progress. So I guess if you wanted to see if they had completed a quest you would have to find the global for that quest and compare the number with the number that would mean it was completed. AFAIK there is easier script function to get the progress of a quest. Do you know which quest it is that you want to check?

The script will be something like this:
int StartingConditional()
{
int iFinished = (Complete value);
return (GetGlobalNumber("quest_global_ref") >= iFinished);
}

ace92
07-29-2008, 05:27 AM
i see thanks for helping me out, it will help me a lot with my mod!
and again thanks!

Stream
07-29-2008, 05:50 AM
Obviously you need a way to track the quest, if you use journal entries to track it then this script would do, just replace entry with the name of the journal entry and 60 with whatever state it is to be completed.


int StartingConditional()
{

return (GetJournalEntry("ENTRY")==60);

}

Another way to do it is to use globals, again replace global with the name of the global you're using and 2 with whatever state it needs to be at.


int StartingConditional()
{

return (GetGlobalBoolean("GLOBAL")==2);

}

--Stream

ace92
07-29-2008, 05:53 AM
i was looking at "How to add Journal entries" by Darth333 but i wasn't able to find the global.jrl, can you help me?

Istorian
07-29-2008, 06:46 AM
The global.jrl file is located for TSL:

Open up Kotor Tool>Kotor II>dialogues.bif>Journal File>global.jrl. To extract it, simply select it and press the Extract file button at the right.

For Kotor 1:

Open up Kotor Tool>Kotor I>_newbif.bif>Journal File>global.jrl. To extract it, do the same thing as with TSL.

You can then open the global.jrl file with a GFF editor.

|I|

ace92
07-29-2008, 07:02 AM
thanks for your help! i really appreciate it!and thanks again

Darth InSidious
07-29-2008, 07:57 AM
You might also want to try this tutorial (http://lucasforums.com/showthread.php?t=143372).

ace92
07-29-2008, 08:03 AM
i did, it just didn't covered what i wanted.
but thanks anyway darth.