Jump to content


Photo

Applying random effects to .CRE files


5 replies to this topic

#1 subtledoctor

subtledoctor
  • Modders
  • 2144 posts
  • Gender:Male

Posted 12 March 2017 - 04:16 PM

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?

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#2 argent77

argent77
  • Modders
  • 710 posts
  • Gender:Male

Posted 12 March 2017 - 04:21 PM

You can also use WeiDU's RANDOM function.



#3 subtledoctor

subtledoctor
  • Modders
  • 2144 posts
  • Gender:Male

Posted 13 July 2017 - 01:49 PM

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.]
??

Edited by subtledoctor, 13 July 2017 - 01:49 PM.

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#4 Ardanis

Ardanis

    A very GAR character

  • Modders
  • 2550 posts
  • Gender:Male
  • Location:Saint-Petersburg, Russia

Posted 13 July 2017 - 09:02 PM

Yes https://github.com/G...llbooks.tpa#L70


"Uguu~ Boku Ayu."

Before you start breaking wall tiles with your bare fists, ask yourself first - do you truly need it?

#5 subtledoctor

subtledoctor
  • Modders
  • 2144 posts
  • Gender:Male

Posted 14 July 2017 - 12:18 PM

Nice! Thx.

Faiths & Powers: Spell spheres and kit pack for priests and paladins
Might & Guile: Tweaks and kits for warriors and rogues
Scales of Balance: Game tweaks and rule overhauls
NPC_EE: More options for NPCs in BGEE, SoD, & BG2EE


#6 Jarno Mikkola

Jarno Mikkola

    The Imp

  • Modders
  • 6194 posts
  • Gender:Male
  • Location:The town where the dead haven't keeled over, yet. In Finland.

Posted 14 July 2017 - 12:50 PM

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.
Welcome to the sanity, you are free to search for the limit, it's out there, we drew it in the sand.
Here's how to install all the ... mods you ever really could want to Infinity Engine games. I removed the stable word from there as Roxanne began to add BS mods that are likely to break compatibility from the BWS.



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users