Random Variables for a Less Predicatable Adventure

Discussion in 'General Modification' started by Edwin P, Aug 11, 2011.

Remove all ads!
  1. Edwin P

    Edwin P Member

    Joined:
    Oct 1, 2003
    Messages:
    57
    Likes Received:
    0
    2 Questions - any words of wisdom would be deeply appreciated.

    Question 01.
    What would be the optimal place to place a global variable generator in TOEE? >>> random.randrange(1, 2, 1) # integer from 1 to 2

    I ask this as I want to vary an NPC randomly from game to game to make the game less predictable. I was thinking of triggering it with one of the early dialog scripts.

    Example:

    Global Variable 234 has 50% to have a value of 1: NPC A is Evil in this game and will attempt to pick your pockets.
    Global Variable 234 has 50% to have a value of 2: NPC A is Good in this game

    Question 02.
    What is the best way to calculate a random variable just before a map opens to determine what NPCs are present.

    Example: There is a 30% that the pirate captain and his mates are in Nulb when you visit this fair village. At other times the pirate captain is not present; as he away pirating, and dialog reponses will indicate this.
     
  2. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    Interesting idea.

    1. Said NPC's first heartbeat and dialog scripts. Theoretically, on an NPC's first heartbeat, a random number would be generated that determined a variable to be set at 1 (good) or 2 (evil). The dialog script would then check the variable and direct to the correct dialog line number accordingly (e.g. 1 = good = line 100 = good dialog or 2 = evil = line 200 = evil dialog) upon the initiation of dialog with the NPC. You'd also have to script all the following and flag/variable related contacts accordingly though (has met and is good, has met and is evil, etc.)

    2. Same thing - first heartbeat. Random number = 1 = var is set to 1 = guy is present = object flag 'off' is not set, random number = 2 = var is set to 2 = guy is absent = object flag 'off' is set.

    Note that heartbeat scripts are preferable (imo) to first heartbeat scripts on big maps to achieve the same results. I've found through much heartache that first heartbeats don't fire reliably on big maps, but being as regular heartbeats fire every second or so, they'll register properly eventually. First heartbeats are 'all or nothing.'
     
Our Host!