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.

Credit Script

Page: 1 of 1
 HK-42
01-16-2009, 3:36 PM
#1
Does anybody have a script that checks for your credit amount? I would like one.
I know there is one that takes credits but how does it work if you dont have that much.
Thanks!
 Star Admiral
01-16-2009, 4:05 PM
#2
Does anybody have a script that checks for your credit amount? I would like one.
I know there is one that takes credits but how does it work if you dont have that much.
Thanks!

I'm almost certain there is a built-in script, but I can't find it. Ah well, it is rather simple to create a custom one. Assuming this is for K1:

int StartingConditional() {
int nGold = GetGold( GetFirstPC() );
if( nGold >= xxx )
return TRUE;
return FALSE;
}

This conditional script checks if you have xxx amount of gold or more. If you're just looking to get how much gold the player has, you can just use the GetGold() function.

- Star Admiral
 HK-42
01-16-2009, 4:28 PM
#3
I'm almost certain there is a built-in script, but I can't find it. Ah well, it is rather simple to create a custom one. Assuming this is for K1:

int StartingConditional() {
int nGold = GetGold( GetFirstPC() );
if( nGold >= xxx )
return TRUE;
return FALSE;
}

This conditional script checks if you have xxx amount of gold or more. If you're just looking to get how much gold the player has, you can just use the GetGold() function.

- Star Admiral

Thanks I will try it out.
 HK-42
01-16-2009, 5:05 PM
#4
One more thing. Could someone give me a conditional script that checks to see if a quest entry is activated and if it is display a different node of dialog instead of the main one.
 Star Admiral
01-16-2009, 5:23 PM
#5
For quest entries, you can use the GetJournalEntry() function. The conditional script for the dialog file would look something like this.

int StartingConditional() {
if( GetJournalEntry( "xxx" ) == zzz )
return TRUE;
return FALSE;
}

"xxx" refers to a string with the PlotID and zzz refers to the quest entry for that particular plot.

- Star Admiral
 HK-42
01-16-2009, 5:44 PM
#6
For quest entries, you can use the GetJournalEntry() function. The conditional script for the dialog file would look something like this.

int StartingConditional() {
if( GetJournalEntry( "xxx" ) == zzz )
return TRUE;
return FALSE;
}

"xxx" refers to a string with the PlotID and zzz refers to the quest entry for that particular plot.

- Star Admiral

Won't seem to work:(. What I'm trying to get it to do is after it says one thing of dialog I get the quest. But if I talk to that guy again I want to have that option disappear and select a diffenent option. I tried attacting this script to both of those 2 options and if attached to the one that gives the quest, the dialog that dosent always comes up, regardless if you have the quest or not. However if I attach it to the one that dosent give the quest, the quest one appears every time. Any ideas?
 Star Admiral
01-16-2009, 5:54 PM
#7
How many nodes do you have in your dialog file? The best way to set it up would be something as follows.

- Branch #1 (checks if the quest is there; NPC uses this branch if the quest doesn't exist)
- Branch #2 (checks if the quest is there; NPC uses this branch if the quest already exists)
- Branch #3 (generic branch that is used if all other branches return false)

- Star Admiral
 HK-42
01-16-2009, 6:02 PM
#8
How many nodes do you have in your dialog file? The best way to set it up would be something as follows.

- Branch #1 (checks if the quest is there; NPC uses this branch if the quest doesn't exist)
- Branch #2 (checks if the quest is there; NPC uses this branch if the quest already exists)
- Branch #3 (generic branch that is used if all other branches return false)

- Star Admiral

Alright I have 3 now.
Quest
NonQuest if already there
Generic.

Should I attach the script above to the first 2 or just one of them?
 Star Admiral
01-16-2009, 6:41 PM
#9
Use this conditional for branch 1.

int StartingConditional() {
if( GetJournalEntry( "xxx" ) == 0 )
return TRUE;
return FALSE;
}

Use this conditional for branch 2.

int StartingConditional() {
if( GetJournalEntry( "xxx" ) == zzz )
return TRUE;
return FALSE;
}

And no conditionals for the generic branch.

- Star Admiral
 HK-42
01-16-2009, 6:43 PM
#10
Use this conditional for branch 1.

int StartingConditional() {
if( GetJournalEntry( "xxx" ) == 0 )
return TRUE;
return FALSE;
}

Use this conditional for branch 2.

int StartingConditional() {
if( GetJournalEntry( "xxx" ) == zzz )
return TRUE;
return FALSE;
}

And no conditionals for the generic branch.

- Star Admiral
I got it to work. Thanks!
Page: 1 of 1