Jump to content

Home

Conditional Scripts


harIII

Recommended Posts

I need a few conditional scripts for dialog options:

One to check what specific quest is activated

One to check what specific quest entry is activated

One to check to see if you have a specific item on you

One to check to see if you have a specific item equipped

 

These will be for K1

 

Thanks

 

-----Edit-----

Also another that checks to see if you have killed somebody

Link to comment
Share on other sites

I need a few conditional scripts for dialog options:

 

One to check to see if you have a specific item on you

 

I have these ones.

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

if (GetItemPossessedBy(oPC, "g_i_mandomask") == OBJECT_INVALID) return FALSE;

return TRUE;
}

Link to comment
Share on other sites

Thats right, to check a certain item, this is probably a little clearer to use:

int StartingConditional() {
   if(GetItemPossessedBy(GetFirstPC(), "[color=cyan]String_Item_Tag[/color]") == OBJECT_INVALID)
       return FALSE;
   return TRUE;
}

 

As for seeing if you have a specific item equipped:

int StartingConditional() {
   if (GetTag(GetItemInSlot([color=cyan]INVENTORY_SLOT_(Expected Slot)[/color], GetFirstPC()) == "[color=cyan]Tag_Of_Item[/color]")
}

If you want to check for a weapon you will probably have to check both hands.

 

Arkward K1 scripting, its a pain that you can't use the dialog script parameters. ¬.¬

 

As for quest tracking, you will have to look into Global's and find out the globals for the quests, as that is how the game tracks how far you are throughout the plots.

 

The script will likely be something along the lines of:

int StartingConditional() {
   if(GetGlobalNumber("[color=cyan]Global_Identifier[/color]") <= [color=cyan]Number it needs to be equal to or more than[/color])
       return TRUE;
   return FALSE;
}

 

I can't remember if you can just return (GetGlobalNumber("G_N") <= 4); but the script above should work.

Link to comment
Share on other sites

I need a few conditional scripts for dialog options:

One to check what specific quest is activated

If you mean to check if a specific quest is active you can do it like this, where JournalQuestTag should be set to the Tag of the quest from global.jrl:

int StartingConditional() {
   return (GetJournalEntry("[color=orange]JournalQuestTag[/color]") > 0);    
}

 

One to check what specific quest entry is activated

Very similar to the previous one, just replace the yellow number with the quest stage to check for:

int StartingConditional() {
   return (GetJournalEntry("[color=orange]JournalQuestTag[/color]") == [color=Yellow]10[/color]);    
}

 

One to check to see if you have a specific item on you

Change TagOfItem" to the tag of the item as set in the UTI file. Make sure the item has a unique tag:

int StartingConditional() {
   return GetIsObjectValid(GetItemPossessedBy(GetFirstPC(), "[color=Yellow]TagOfItem[/color]"));
}

 

One to check to see if you have a specific item equipped

Change TagOfItem to the tag of the item as set in the UTI file.

int StartingConditional() {
   object oPC = GetFirstPC();
   string sTag = "[color=Yellow]TagOfItem[/color]";
   int i;

   for (i = INVENTORY_SLOT_HEAD; i <= INVENTORY_SLOT_CARMOUR; i++) {
       if (GetTag(GetItemInSlot(i, oPC)) == sTag) {
           return TRUE;    
       }
   }

   return FALSE;
}

 

 

Also another that checks to see if you have killed somebody

 

There is no way to directly check this unless the player still is in the same area as the victim, and corpse fade has been turned off on the victim so they stay around permanently. The easiest way around this is to set a global variable in the victim's OnDeath event script and then check for that.

 

Give the victim a new OnDeath script that looks something like:

void main() {
   SetGlobalBoolean(GetTag(OBJECT_SELF) + "_ISDEAD", TRUE);
   ExecuteScript("k_ai_master", OBJECT_SELF, 1007);    
}

 

Then add a global boolean variable to the globalcat.2da file with the tag of the NPC followed by "_ISDEAD", for example "Bastila_ISDEAD" if wanting to keep track of if an NPC with the tag "Bastila" has been killed. Then you can later check for that in a dialog anywhere in the game like:

int StartingConditional() {
   return GetGlobalBoolean("Bastila_ISDEAD");  
}

Link to comment
Share on other sites

Thank you so much for your input, for a long time now, I've been stuck where I am because of the lack of these scripts. Everyones' reply has been greatly appreciated.

 

 

-----Edit-----

I just thought of this one, would anyone know of a conditional script that checks to see if you are in a specific area? I want to create a trigger and then apply a script or would the rigger be the script that checks what area you're in?

Link to comment
Share on other sites

I just thought of this one, would anyone know of a conditional script that checks to see if you are in a specific area? I want to create a trigger and then apply a script or would the rigger be the script that checks what area you're in?

You would create the trigger in the area, I wouldn't imagine that the script would need to check what area your in if the trigger can only be triggered in that area ;)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...