Post reply

The message has the following error or errors that must be corrected before continuing:
Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.
Other options
Shortcuts: ALT+S post or ALT+P preview

Topic summary

Posted by aigleborgne
 - August 25, 2006, 06:59:03 AM
Hi,

I am not really confident in tp2 coding and still have troubles.

In short, there are 2 files, I will patch one of them, depending of a variable. I have try this code:

Part of Setup-Enhanced_Creatures.tp2:
INCLUDE ~Enhanced_Creatures/Setup-Enhanced_Creatures.tph~
OUTER_SET "component" = 4
LAUNCH_ACTION_MACRO ~PATCH_CREATURES~

Part of Setup-Enhanced_Creatures.tph:
DEFINE_ACTION_MACRO ~PATCH_CREATURES~ BEGIN
ACTION_IF ("%component%" = 3) BEGIN
  COPY ~Enhanced_Creatures/JA#monst.2da~ ~override/JA#monst.2da~
ELSE
  COPY ~Enhanced_Creatures/JA#npc.2da~ ~override/JA#npc.2da~
END

Or:

DEFINE_ACTION_MACRO ~PATCH_CREATURES~ BEGIN

ACTION_IF ("%component%" = 3) BEGIN
  SPRINT open_file  JA#monst.2da
ELSE
  SPRINT open_file  JA#npc.2da
END

COPY_EXISTING  ~%open_file%~ ~override/open_file~

Neither of this work. ACTION_IF, PATCH_IF... I tried both. I don't know how to solve it.
Well, I know one way: open any file, so I can use patch_if, then open the 2nd with inner action.

If someone know the right way to do this, I would really appreciate and be very happy