Jump to content

Check if File Exists


Bill Bisco

Recommended Posts

I want to write code in my TP2 file to check if there is an Erevain.CRE already in the override or bifed. If that CRE exists there, then I want to input some code. Else, if it does not exist I want to input a different Code.

 

Any help would be appreciated.

Link to comment
ACTION_IF (FILE_EXISTS_IN_GAME ~erevain.cre~) BEGIN
  // erevain exists
END
ELSE BEGIN
  // erevain doesn't exist
END

Here is an example of the above code from my tp2

 

ACTION_IF FILE_EXISTS_IN_GAME ~CMNikitr.cre~ THEN BEGIN

COMPILE ~SandrahNPC/Mods/NikitaSanBG2.d~

EXTEND_TOP

~cmnikita.bcs~ ~SandrahNPC/Mods/NikitaSanBG2.baf~

EXTEND_TOP

~cmmadel.bcs~ ~SandrahNPC/Mods/NikitaMadel.baf~

PRINT ~ Nikita NPC detected - Sandrah Relationship and extended Section plot added~

END ELSE BEGIN

EXTEND_TOP

~ar1000.bcs~ ~SandrahNPC/Areas/ar1000NoNiki.baf~

PRINT ~Nikita not detected - extended Section plot without Nikita added~

END

 

If my mod finds the existing cre, the new stuff is incorporated in it- ELSE - I create a new event to trigger from there. (This is just an excerpt but it illustrates what to do)

Link to comment

Thank you both for your replies. I have incorporated this code into my mod and will test shortly. I like your example Roxanne because you're altering your mod content based on whether or not another mod is installed. Very cool.

Link to comment

Archived

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

×
×
  • Create New...