Labels vs Loops in common events?

Discussion in 'RPG Maker MV' started by Sekunri, Nov 2, 2016.

  1. Sekunri

    Sekunri Creator of Worlds Veteran

    Messages:
    132
    Likes Received:
    73
    Location:
    South Carolina, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Not sure if this will get answered in time to fix it before Game Jam is over but I made a few common events with Labels in them and it seems like they aren't working. I was wondering why and if Loops would actually function in this equation.


    I'm going to proceed with finishing what I have left of my game before potentially going back to change all of those to loops.


    Basic structure of the Labels is as follows


    If Variable: Pie = 2


    Label Reroll 1


    Variable: Randomizer = Random (1-5)


    If Randomizer =  # (this repeats for each value)


    ---If ValueA = 1 (this value depends on what I've personally decided was the limit, in this case 1)


    ------Jump to Reroll 1


    ---End.


    Set ValueA += 1


    Set SwitchA to ON


    End


    ValueA starts at 0.


    An event before this one will randomize a series of other common events to run formulas similar to the one above. However the check failed as evident by what I saw in game where 3 events gave the same value in a location that should only accept 1 events value.
     
    Last edited by a moderator: Nov 2, 2016
    #1
  2. InBlast

    InBlast The Mad Hamster Veteran

    Messages:
    288
    Likes Received:
    88
    Location:
    France
    First Language:
    French
    Could you give us a screen of the event instead of this ? It would be more easy to understand, because actually it's hard for me to understand your problem.
     
    #2
  3. Waterguy

    Waterguy Veteran Veteran

    Messages:
    1,183
    Likes Received:
    254
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Wait...
    you set A to 0, began the loop, ended the loop if A = 1, and only AFTER the loop changed A to +1, in this case, to 1.
    So... it won't stop looping because A will never get to 1.


    You need to put the A + 1 inside the loop.


    This is the error I'm seeing. Would be easier to tell if we could see the event itself.
     
    #3
    rifter likes this.
  4. Milennin

    Milennin "With a bang and a boom!" Veteran

    Messages:
    2,156
    Likes Received:
    1,209
    Location:
    Fiore
    First Language:
    English
    Primarily Uses:
    RMMV
    No, that Label should work. I use an event in one of my games that looks just like that. Post a screenshot of the event page?
     
    #4
  5. Waterguy

    Waterguy Veteran Veteran

    Messages:
    1,183
    Likes Received:
    254
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    @Milennin the problem is not the label, the problem is that the label only makes the loop happen if A = 1 and A is only equal to 1 after the loop.
    So he either put the label if A < 1 or changes A to 1 before the value check of A.
     
    #5
  6. Sekunri

    Sekunri Creator of Worlds Veteran

    Messages:
    132
    Likes Received:
    73
    Location:
    South Carolina, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Well in order to fix this I guess I should post the code though... it's kind of long.


    Purpose of the code is to handle my small games "NPC" locations. Luckily I use a LOT of comments while making events for when I have to revisit them. So I shouldn't need to explain too much. There is one of these events per "NPC".


    And as a reminder, the events I'm calling NPC seem to function properly its just that this call stuff a hoard of them into a room that it wasn't supposed to be able to do.


    (You don't typically have 3 people in the bathroom with you is what I'm saying.)


    You can CTRL + F to specifically Bathroom 1 or Bathroom 2 for the room with 1 as the limiter but the entire event is relevant and has the same structure.

    Code:
    
    ◆If:NPC 1 is Dead is OFF
      ◆Comment:=========================================================
      :       :Turns off NPC Location Switches.
      :       :=========================================================
      ◆Control Switches:#0008..0018 = OFF
      ◆Comment:=========================================================
      :       :Stores the last location of a live npc to previous room.
      :       :=========================================================
      ◆Control Variables:#0001 NPC 1 Previous Room = NPC 1 Current Room
      ◆Comment:=======================================================
      :       :If NPC's current location is the Foyer
      :       :=======================================================
      ◆If:NPC 1 Current Room = 1
        ◆Label:Reroll 1
        ◆Control Variables:#0181 Randomizer = Random 1..3
        ◆If:Randomizer = 1
          ◆Comment:Foyer
          ◆If:Population :: Foyer = 4
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 1
            ◆
          :End
          ◆Comment:NPC moved to Foyer.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0008 NPC 1 in Foyer = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 1
          ◆Control Variables:#0142 Population :: Foyer += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 2
          ◆Comment:Hallway
          ◆If:Population :: Hallway = 4
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 1
            ◆
          :End
          ◆Comment:NPC moved to Hallway.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0018 NPC 1 in Hallway = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 11
          ◆Control Variables:#0141 Population :: Hallway += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 3
          ◆Comment:Study
          ◆If:Population :: Study = 3
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 1
            ◆
          :End
          ◆Comment:NPC moved to Study.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0009 NPC 1 in Study = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 2
          ◆Control Variables:#0143 Population :: Study += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆
      :End
      ◆Comment:=======================================================
      :       :If NPC's current location is the Study
      :       :=======================================================
      ◆If:NPC 1 Current Room = 2
        ◆Label:Reroll 2
        ◆Control Variables:#0181 Randomizer = Random 1..2
        ◆If:Randomizer = 1
          ◆Comment:Stay in Study
          ◆If:Population :: Study = 3
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 2
            ◆
          :End
          ◆Comment:NPC stayed in Study
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0009 NPC 1 in Study = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 2
          ◆Control Variables:#0143 Population :: Study += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 2
          ◆Comment:Foyer
          ◆If:Population :: Foyer = 4
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 2
            ◆
          :End
          ◆Comment:NPC moved to Foyer.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0008 NPC 1 in Foyer = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 1
          ◆Control Variables:#0142 Population :: Foyer += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆
      :End
      ◆Comment:=======================================================
      :       :If NPC's current location is the Library
      :       :=======================================================
      ◆If:NPC 1 Current Room = 3
        ◆Label:Reroll 3
        ◆Control Variables:#0181 Randomizer = Random 1..2
        ◆If:Randomizer = 1
          ◆Comment:Library
          ◆If:Population :: Library = 3
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 3
            ◆
          :End
          ◆Comment:NPC stayed in Library
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0010 NPC 1 in Library = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 3
          ◆Control Variables:#0144 Population :: Library += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 2
          ◆Comment:Hallway
          ◆If:Population :: Hallway = 4
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 3
            ◆
          :End
          ◆Comment:NPC moved to Hallway.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0018 NPC 1 in Hallway = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 11
          ◆Control Variables:#0141 Population :: Hallway += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆
      :End
      ◆Comment:=======================================================
      :       :If NPC's current location is the Courtyard
      :       :=======================================================
      ◆If:NPC 1 Current Room = 4
        ◆Label:Reroll 4
        ◆Control Variables:#0181 Randomizer = Random 1..2
        ◆If:Randomizer = 1
          ◆Comment:Courtyard
          ◆If:Population :: Courtyard = 2
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 4
            ◆
          :End
          ◆Comment:NPC stayed in the Courtyard
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0011 NPC 1 in Courtyard = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 4
          ◆Control Variables:#0145 Population :: Courtyard += 1
          ◆Comment:====================================================
          :       :||Special Condition|| :: Wet Clothing ON
          :       :====================================================
          ◆Control Switches:#0005 NPC 1 has Wet Clothes = ON
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 2
          ◆Comment:Hallway
          ◆If:Population :: Hallway = 4
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 4
            ◆
          :End
          ◆Comment:NPC moved to Hallway.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0018 NPC 1 in Hallway = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 11
          ◆Control Variables:#0141 Population :: Hallway += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆
      :End
      ◆Comment:=======================================================
      :       :If NPC's current location is the Ballroom
      :       :=======================================================
      ◆If:NPC 1 Current Room = 5
        ◆Label:Reroll 5
        ◆Control Variables:#0181 Randomizer = Random 1..3
        ◆If:Randomizer = 1
          ◆Comment:Ballroom
          ◆If:Population :: Ballroom = 4
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 5
            ◆
          :End
          ◆Comment:NPC stayed in Ballroom
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0012 NPC 1 in Ballroom = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 5
          ◆Control Variables:#0146 Population :: Ballroom += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 2
          ◆Comment:Kitchen
          ◆If:Population :: Kitchen = 3
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 5
            ◆
          :End
          ◆Comment:NPC moved to Kitchen
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0013 NPC 1 in Kitchen = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 6
          ◆Control Variables:#0147 Population :: Kitchen += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 3
          ◆Comment:Hallway
          ◆If:Population :: Hallway = 4
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 5
            ◆
          :End
          ◆Comment:NPC moved to Hallway.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0018 NPC 1 in Hallway = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 11
          ◆Control Variables:#0141 Population :: Hallway += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆
      :End
      ◆Comment:=======================================================
      :       :If NPC's current location is the Kitchen
      :       :=======================================================
      ◆If:NPC 1 Current Room = 6
        ◆Label:Reroll 6
        ◆Control Variables:#0181 Randomizer = Random 1..4
        ◆If:Randomizer = 1
          ◆Comment:Kitchen
          ◆If:Population :: Kitchen = 3
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 6
            ◆
          :End
          ◆Comment:NPC stayed in Kitchen
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0013 NPC 1 in Kitchen = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 6
          ◆Control Variables:#0147 Population :: Kitchen += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 2
          ◆Comment:Ballroom
          ◆If:Population :: Ballroom = 4
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 6
            ◆
          :End
          ◆Comment:NPC moved to Ballroom
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0012 NPC 1 in Ballroom = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 5
          ◆Control Variables:#0146 Population :: Ballroom += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 3
          ◆Comment:Dining Room
          ◆If:Population :: Dining Room = 3
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 6
            ◆
          :End
          ◆Comment:NPC moved to Dining Room
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0014 NPC 1 in Dining Room = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 7
          ◆Control Variables:#0148 Population :: Dining Room += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 4
          ◆Comment:Hallway
          ◆If:Population :: Hallway = 4
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 6
            ◆
          :End
          ◆Comment:NPC moved to Hallway.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0018 NPC 1 in Hallway = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 11
          ◆Control Variables:#0141 Population :: Hallway += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆
      :End
      ◆Comment:=======================================================
      :       :If NPC's current location is the Dining Room
      :       :=======================================================
      ◆If:NPC 1 Current Room = 7
        ◆Label:Reroll 7
        ◆Control Variables:#0181 Randomizer = Random 1..3
        ◆If:Randomizer = 1
          ◆Comment:Dining Room
          ◆If:Population :: Dining Room = 3
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 7
            ◆
          :End
          ◆Comment:NPC moved to Dining Room
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0014 NPC 1 in Dining Room = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 7
          ◆Control Variables:#0148 Population :: Dining Room += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 2
          ◆Comment:Kitchen
          ◆If:Population :: Kitchen = 3
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 7
            ◆
          :End
          ◆Comment:NPC stayed in Kitchen
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0013 NPC 1 in Kitchen = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 6
          ◆Control Variables:#0147 Population :: Kitchen += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 3
          ◆Comment:Hallway
          ◆If:Population :: Hallway = 4
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 7
            ◆
          :End
          ◆Comment:NPC moved to Hallway.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0018 NPC 1 in Hallway = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 11
          ◆Control Variables:#0141 Population :: Hallway += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆
      :End
      ◆Comment:=======================================================
      :       :If NPC's current location is the Lounge
      :       :=======================================================
      ◆If:NPC 1 Current Room = 8
        ◆Label:Reroll 8
        ◆Control Variables:#0181 Randomizer = Random 1..3
        ◆If:Randomizer = 1
          ◆Comment:Lounge
          ◆If:Population :: Lounge = 3
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 8
            ◆
          :End
          ◆Comment:NPC stayed in Lounge.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0015 NPC 1 in Lounge = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 8
          ◆Control Variables:#0149 Population :: Lounge += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 2
          ◆Comment:=====================================================
          :       :=====================================================
          :       :BATHROOM 1 :: Killer sequence?
          :       :=====================================================
          ◆If:Pop... :: Bathroom 1 (9) = 1
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 8
            ◆
          :End
          ◆Comment:NPC moved to Bathroom 1.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0016 NPC 1 in Bathroom 1 = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 9
          ◆Control Variables:#0150 Pop... :: Bathroom 1 (9) += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 3
          ◆Comment:Hallway
          ◆If:Population :: Hallway = 4
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 8
            ◆
          :End
          ◆Comment:NPC moved to Hallway.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0018 NPC 1 in Hallway = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 11
          ◆Control Variables:#0141 Population :: Hallway += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆
      :End
      ◆Comment:=======================================================
      :       :If NPC's current location is the Bathroom 1
      :       :=======================================================
      ◆If:NPC 1 Current Room = 9
        ◆Label:Reroll 9
        ◆Control Variables:#0181 Randomizer = Random 1..2
        ◆If:Randomizer = 1
          ◆Comment:=====================================================
          :       :=====================================================
          :       :BATHROOM 1 :: Killer sequence?
          :       :=====================================================
          ◆If:Pop... :: Bathroom 1 (9) = 1
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 9
            ◆
          :End
          ◆Comment:NPC moved to Bathroom 1.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0016 NPC 1 in Bathroom 1 = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 9
          ◆Control Variables:#0150 Pop... :: Bathroom 1 (9) += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 2
          ◆Comment:Lounge
          ◆If:Population :: Lounge = 3
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 9
            ◆
          :End
          ◆Comment:NPC stayed in Lounge.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0015 NPC 1 in Lounge = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 8
          ◆Control Variables:#0149 Population :: Lounge += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆
      :End
      ◆Comment:=======================================================
      :       :If NPC's current location is the Bathroom 2
      :       :=======================================================
      ◆If:NPC 1 Current Room = 10
        ◆Label:Reroll 10
        ◆Control Variables:#0181 Randomizer = Random 1..2
        ◆If:Randomizer = 1
          ◆Comment:Bathroom 2
          ◆If:Pop... :: Bathroom 2 (10) = 1
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 10
            ◆
          :End
          ◆Comment:NPC stayed in Bathroom 2
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0017 NPC 1 in Bathroom 2 = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 10
          ◆Control Variables:#0151 Pop... :: Bathroom 2 (10) += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 2
          ◆Comment:Hallway
          ◆If:Population :: Hallway = 4
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 10
            ◆
          :End
          ◆Comment:NPC moved to Hallway.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0018 NPC 1 in Hallway = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 11
          ◆Control Variables:#0141 Population :: Hallway += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆
      :End
      ◆If:NPC 1 Current Room = 11
        ◆Comment:=======================================================
        :       :If NPC's current location is the Hallway
        :       :=======================================================
        ◆Label:Reroll 11
        ◆Control Variables:#0181 Randomizer = Random 2..9
        ◆Comment:=======================================================
        :       :In case functionality is added later the Hallway
        :       :is set to variable 1. Simply change the random
        :       :variable to 1 - 7 to allow characters to stay in
        :       :hallway more than one turn.
        :       :=======================================================
        ◆If:Randomizer = 1
          ◆Comment:Hallway
          ◆If:Population :: Hallway = 4
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 11
            ◆
          :End
          ◆Comment:NPC moved to Hallway.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0018 NPC 1 in Hallway = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 11
          ◆Control Variables:#0141 Population :: Hallway += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆Comment:=======================================================
        :       :End Hidden
        :       :=======================================================
        ◆If:Randomizer = 2
          ◆Comment:Foyer
          ◆If:Population :: Foyer = 4
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 11
            ◆
          :End
          ◆Comment:NPC moved to Foyer.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0008 NPC 1 in Foyer = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 1
          ◆Control Variables:#0142 Population :: Foyer += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 3
          ◆Comment:Library
          ◆If:Population :: Library = 3
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 11
            ◆
          :End
          ◆Comment:NPC stayed in Library
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0010 NPC 1 in Library = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 3
          ◆Control Variables:#0144 Population :: Library += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 4
          ◆Comment:Courtyard
          ◆If:Population :: Courtyard = 2
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 11
            ◆
          :End
          ◆Comment:====================================================
          :       :||Special Condition|| :: Wet Clothing Check
          :       :====================================================
          ◆If:NPC 1 has Wet Clothes is ON
            ◆Comment:This keeps characters who have been outside
            :       :from going outside twice.
            :       :**********************************
            :       :Except the Killer who overrides this function under
            :       :special circumstances.
            ◆Jump to Label:Reroll 11
            ◆
          :End
          ◆Comment:NPC moved to the Courtyard
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0011 NPC 1 in Courtyard = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 4
          ◆Control Variables:#0145 Population :: Courtyard += 1
          ◆Comment:====================================================
          :       :||Special Condition|| :: Wet Clothing ON
          :       :====================================================
          ◆Control Switches:#0005 NPC 1 has Wet Clothes = ON
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 5
          ◆Comment:Ballroom
          ◆If:Population :: Ballroom = 4
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 11
            ◆
          :End
          ◆Comment:NPC stayed in Ballroom
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0012 NPC 1 in Ballroom = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 5
          ◆Control Variables:#0146 Population :: Ballroom += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 6
          ◆Comment:Kitchen
          ◆If:Population :: Kitchen = 3
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 11
            ◆
          :End
          ◆Comment:NPC stayed in Kitchen
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0013 NPC 1 in Kitchen = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 6
          ◆Control Variables:#0147 Population :: Kitchen += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 7
          ◆Comment:Dining Room
          ◆If:Population :: Dining Room = 3
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 11
            ◆
          :End
          ◆Comment:NPC moved to Dining Room
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0014 NPC 1 in Dining Room = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 7
          ◆Control Variables:#0148 Population :: Dining Room += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 8
          ◆Comment:Lounge
          ◆If:Population :: Lounge = 3
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 11
            ◆
          :End
          ◆Comment:NPC stayed in Lounge.
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0015 NPC 1 in Lounge = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 8
          ◆Control Variables:#0149 Population :: Lounge += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆If:Randomizer = 9
          ◆Comment:Bathroom 2
          ◆If:Pop... :: Bathroom 2 (10) = 1
            ◆Comment:If Max Population is reached, reroll room.
            ◆Jump to Label:Reroll 11
            ◆
          :End
          ◆Comment:NPC stayed in Bathroom 2
          :       :> Sets Switch for map events.
          :       :> Sets Variable for Killer Behavior.
          :       :> Increases room population for other NPC Behaviors.
          :       :> Ends the Behavior function.
          ◆Control Switches:#0017 NPC 1 in Bathroom 2 = ON
          ◆Control Variables:#0002 NPC 1 Current Room = 10
          ◆Control Variables:#0151 Pop... :: Bathroom 2 (10) += 1
          ◆Jump to Label:End
          ◆
        :End
        ◆Comment:INSERT NEXT ROOM HERE
        ◆
      :End
      ◆
    :Else
      ◆Jump to Label:End
      ◆
    :End
    ◆Comment:=======================================================
    :       :End of Function
    :       :=======================================================
    ◆Label:End
     
    Last edited by a moderator: Nov 3, 2016
    #6
  7. Waterguy

    Waterguy Veteran Veteran

    Messages:
    1,183
    Likes Received:
    254
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    not appearing to me...
     
    #7
  8. Sekunri

    Sekunri Creator of Worlds Veteran

    Messages:
    132
    Likes Received:
    73
    Location:
    South Carolina, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    There was an issue with how it formatted from the RPG Maker to the forums. I fixed it using the Code BBCode so it should show up now.


    Unfortunately when I tried to set it to Javascript for its coloring scheme the sites plugin kept failing for me so its all black text.


    The above behaviors are called by the following common event within an event.

    ◆Control Variables:#0181 Randomizer = Random 1..7
    ◆Comment:===================================================
    : :Uses random variable to select pattern to use
    : :===================================================
    ◆If:Randomizer = 1
    ◆Jump to Label:Pattern1

    :End
    ◆If:Randomizer = 2
    ◆Jump to Label:Pattern2

    :End
    ◆If:Randomizer = 3
    ◆Jump to Label:Pattern3

    :End
    ◆If:Randomizer = 4
    ◆Jump to Label:Pattern4

    :End
    ◆If:Randomizer = 5
    ◆Jump to Label:Pattern5

    :End
    ◆If:Randomizer = 6
    ◆Jump to Label:Pattern6

    :End
    ◆If:Randomizer = 7
    ◆Jump to Label:Pattern7

    :End
    ◆Comment:===================================================
    : :Uses the selected pattern then jumps to next function
    : :===================================================
    ◆Label:Pattern1
    ◆Common Event:NPC 1 Behaviors
    ◆Common Event:NPC 2 Behaviors
    ◆Common Event:NPC 3 Behaviors
    ◆Common Event:NPC 4 Behaviors
    ◆Common Event:NPC 5 Behaviors
    ◆Common Event:NPC 6 Behaviors
    ◆Common Event:NPC 7 Behaviors
    ◆Jump to Label:End
    ◆Comment:===================================================
    : :===================================================
    ◆Label:Pattern2
    ◆Common Event:NPC 2 Behaviors
    ◆Common Event:NPC 4 Behaviors
    ◆Common Event:NPC 6 Behaviors
    ◆Common Event:NPC 1 Behaviors
    ◆Common Event:NPC 3 Behaviors
    ◆Common Event:NPC 7 Behaviors
    ◆Common Event:NPC 5 Behaviors
    ◆Jump to Label:End
    ◆Comment:===================================================
    : :===================================================
    ◆Label:Pattern3
    ◆Common Event:NPC 3 Behaviors
    ◆Common Event:NPC 5 Behaviors
    ◆Common Event:NPC 7 Behaviors
    ◆Common Event:NPC 6 Behaviors
    ◆Common Event:NPC 4 Behaviors
    ◆Common Event:NPC 2 Behaviors
    ◆Common Event:NPC 1 Behaviors
    ◆Jump to Label:End
    ◆Comment:===================================================
    : :===================================================
    ◆Label:Pattern4
    ◆Common Event:NPC 4 Behaviors
    ◆Common Event:NPC 6 Behaviors
    ◆Common Event:NPC 2 Behaviors
    ◆Common Event:NPC 5 Behaviors
    ◆Common Event:NPC 7 Behaviors
    ◆Common Event:NPC 1 Behaviors
    ◆Common Event:NPC 3 Behaviors
    ◆Jump to Label:End
    ◆Comment:===================================================
    : :===================================================
    ◆Label:Pattern5
    ◆Common Event:NPC 5 Behaviors
    ◆Common Event:NPC 7 Behaviors
    ◆Common Event:NPC 1 Behaviors
    ◆Common Event:NPC 2 Behaviors
    ◆Common Event:NPC 6 Behaviors
    ◆Common Event:NPC 3 Behaviors
    ◆Common Event:NPC 4 Behaviors
    ◆Jump to Label:End
    ◆Comment:===================================================
    : :===================================================
    ◆Label:Pattern6
    ◆Common Event:NPC 6 Behaviors
    ◆Common Event:NPC 3 Behaviors
    ◆Common Event:NPC 4 Behaviors
    ◆Common Event:NPC 7 Behaviors
    ◆Common Event:NPC 1 Behaviors
    ◆Common Event:NPC 5 Behaviors
    ◆Common Event:NPC 2 Behaviors
    ◆Jump to Label:End
    ◆Comment:===================================================
    : :===================================================
    ◆Label:Pattern7
    ◆Common Event:NPC 7 Behaviors
    ◆Common Event:NPC 1 Behaviors
    ◆Common Event:NPC 5 Behaviors
    ◆Common Event:NPC 3 Behaviors
    ◆Common Event:NPC 2 Behaviors
    ◆Common Event:NPC 4 Behaviors
    ◆Common Event:NPC 6 Behaviors
    ◆Jump to Label:End
    ◆Comment:===================================================
    : :End of Common Event
    : :===================================================
    ◆Label:End

    The idea here was to do 2 things.


    1. Have a simple call so that all behaviors process.


    2. Have a means to randomize the call orders so that characters have an "equal" chance of checking certain rooms.


    My example could be the Bathroom I mentioned. If the call was always any single NPC and the code was working properly then only the first called character that went to the bathroom would ever have a shot. That said it could lead to instance with character 7 is significantly less likely to ever enter it. So with the randomization it gives them all an equal chance to select a room first.
     
    Last edited by a moderator: Nov 3, 2016
    #8
  9. Waterguy

    Waterguy Veteran Veteran

    Messages:
    1,183
    Likes Received:
    254
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    I see. So the variables are changed from OTHER events too?


    That changes it.


    Are you resetting the "room population" variables between randomizations? Because in your main "patter randomizer" event there is no resetting.
     
    Last edited by a moderator: Nov 3, 2016
    #9
  10. Sekunri

    Sekunri Creator of Worlds Veteran

    Messages:
    132
    Likes Received:
    73
    Location:
    South Carolina, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    The events that call the Behavior Calls common event that calls all the NPC Behavior events has a call at the beginning that resets the range of variables to 0 prior.


    The event order is as follows:


    1. Set all variables in the population range to 0.


    2. Call Behavior Calls


    ---- This calls all the NPC behaviors in their randomized order


    3. Sets the player's location and increases population by 1. (this is hardcoded, no conditionals so the player can break the population limit)


    4. Calls "Killer Behaviors".


    In retrospect I do like the idea of just having it in the pattern randomizer. I'll do that before the randomizer method happens. Makes for cleaner events.
     
    Last edited by a moderator: Nov 3, 2016
    #10
  11. Waterguy

    Waterguy Veteran Veteran

    Messages:
    1,183
    Likes Received:
    254
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Ok, could you remind me what is the problem? I recall you sayin they aren't working but not what is going wrong.
     
    #11
  12. Sekunri

    Sekunri Creator of Worlds Veteran

    Messages:
    132
    Likes Received:
    73
    Location:
    South Carolina, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Simply put the use of the labels as used in my code should send force a re-roll of the randomizer variable in cases where a rooms population is at capacity by sending the function back to the earlier label, creating a small loop.


    Despite this there are rooms that end up with a higher capacity than I have designated for them.
     
    #12
  13. Waterguy

    Waterguy Veteran Veteran

    Messages:
    1,183
    Likes Received:
    254
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Are the variables changing properly?
    Did you try using >= instead of just =?
     
    #13

Share This Page