Jump to content

Applying random effects to .CRE files


subtledoctor

Recommended Posts

I have five fighter combat techniques - two melee hit effects, and three AC bonuses (vs. different weapon types). The player can learn the techniques over the course of the game, but I would like to simulate enemy creatures knowing the techniques and using them against the player.

 

Easy enough with ADD_CRE_EFFECT, since the techniques all consist of permanent spell effects. So I want to go through every .CRE and, if the class = fighter, apply one of these five effects.

 

Should I just repeat a counter from 1 to 5 as Weidu goes over each .CRE, so that the randomness is down the the alphabetical sorting of the files? Or is there is way to actually randomly pick one of the five effects for each .CRE?

Link to comment

RANDOM seems a bit weird in the Weidu readme... it's under "value" with stuff like STRING_EQUAL_CASE and similar stuff - basically, stuff I usually see after ACTION_IF or PATCH_IF.

 

Can I use it like this?

COPY_EXISTING_REGEXP GLOB ~[all non-joinable .CREs]~ ~override~
   SET variable = RANDOM (1 5)
   PATCH_IF (%variable% = 1) BEGIN
      ADD_CRE_EFFECT [#1]
   END
   PATCH_IF (%variable% = 2) BEGIN
      ADD_CRE_EFFECT [#2]
   END
   PATCH_IF (%variable% = 3) BEGIN
      ...
[etc.]
??
Link to comment

 

COPY_EXISTING_REGEXP GLOB ~[all non-joinable .CREs]~ ~override~
   SET variable = RANDOM (1 5) 

 

You might like to print out the seeded number just cause... of debugging, as you can later set the seed to that number for toils and tremors.
Link to comment

Archived

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

×
×
  • Create New...