Script Call Equivalent of Events

Discussion in 'RPG Maker VX Ace' started by Archeia, Nov 14, 2012.

Thread Status:
Not open for further replies.
    Tags:
  1. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,045
    Likes Received:
    13,039
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    I'd like to compile a list of Call Script equivalent of events. I think it's nice to know the script call equivalent since there might be some people who work better with them (like me ;w;). If I posted in the wrong section, feel free to move. Below is a list of the ones I have so far...c:

    Variables

    $game_variables[n]Switches

    $game_switches[n]Conditional Branch

    if #something#somethingelse#somethingendShow Picture

    screen.pictures[index].show(file_name, upperleft/center, x, y, x zoom, y zoom, opacity, blend type)Move Picture

    screen.pictures[n].move(0/1 (top left or center), x, y, zoom1, zoom2, opacity, blend type (0,1, 2), wait)Picture Tone

    screen.pictures[n].start_tone_change(Tone.new(0, 0, 0, 0), wait)Looping

    For#somethingendMove Event

    move_route = RPG::MoveRoute.newmove_route.repeat = falsemove_route.skippable = truem = RPG::MoveCommand.newm.code = 45 #The List of M Code can be found over Game_Character, this current m.code is call scriptm.parameters = ["script call here"]move_route.list.insert(0,m.clone)$game_player.force_move_route(move_route)Transfer Event Location

    $game_map.events[id].moveto(new_x, new_y)Transfer Player

    $game_player.reserve_transfer(map_id, x, y, direction)Screen Tint

    t = Tone.new(red,green,blue, gray)screen.start_tone_change(t, duration)Shake Screen

    @params = []@params[0] = power or $game_variables[x]@params[1] = speed or $game_variables[y]@params[2] = duration or $game_variables[z]Note: (Neonblack and Fomar0153 found this glitch!)
    The shake screen has an option in the editor where you can add a "wait" or not. But the glitch involves that it will wait no matter what. But it will only wait a number of frames equal to whatever the speed is set to the default option. For example, the setting is 5 power, 5 speed, 60 frames, and wait. It will wait for 5 frames, no matter what.
     
    Last edited by a moderator: Apr 14, 2013
    #1
  2. Necrofear04

    Necrofear04 Variemai... Veteran

    Messages:
    38
    Likes Received:
    2
    First Language:
    Greek
    Thank you very much Archeia, it's very helpful for RMVX starters like me!!
     
    #2
    Archeia likes this.
  3. Celianna

    Celianna Tileset artist Global Mod

    Messages:
    10,400
    Likes Received:
    5,364
    First Language:
    Dutch
    Primarily Uses:
    RMMV
    I'd also be interested in conditional script calls which have no equivalent event command. Things like



    Code:
    $game_player.moving?
    and



    Code:
    Input.trigger?(Input::A)
    They're so useful! And it's okay, since you're asking for script calls, it's in the right forum.
     
    Last edited by a moderator: Nov 16, 2012
    #3
  4. Galv

    Galv Veteran Veteran

    Messages:
    1,160
    Likes Received:
    1,045
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    N/A
    Thought I would add some more to the list.

    Call Common Event:

    $game_temp.reserve_common_event(id)Play SE/ME/BGS/BGM:
    Code:
    RPG::SE.new("SE Name", volume, pitch).playRPG::ME.new("ME Name", volume, pitch).playRPG::BGS.new("BGS Name", volume, pitch).playRPG::BGM.new("BGM Name", volume, pitch).play
    Show Text:
    Code:
    $game_message.add("Text")
    Gain/lose Item:
    Code:
    $game_party.gain_item($data_items[id], amount)$game_party.lose_item($data_items[id], amount)
    (For weapons/armor use $data_weapons or $data_armors in place of $data_items.)Gather Followers:

    $game_player.followers.gatherChange Player Followers:
    Code:
    $game_player.followers.visible = true or false
    Erase Event:
    Code:
    $game_map.events[event_id].erase
    Some conditional script calls to add to Celianna's:

    Button pressing

    Input.repeat?:)A)Input.press?:)A)Movement
    Code:
    $game_player.dash?$game_player.jumping?$game_map.events[event_id].moving?$game_map.events[event_id].jumping?
    Location
    Code:
    $game_map.events[event_id].x$game_map.events[event_id].y$game_player.x$game_player.y
    Remove Actor
    Code:
    $game_party.remove_actor(actor_id)
    Add Actor
    Code:
    $game_party.add_actor(actor_id)
    Remove Party Member from position (where x = party position. 0 = 1st member, 1 = 2nd member, etc.)
    Code:
    m = $game_party.members$game_party.remove_actor(m[x].id)
    Of course the list can go on, but I hope that little bit helps [​IMG]EDIT: Fixed some typos and shortened input text as Nicke suggested

    EDIT: Added more
     
    Last edited by a moderator: Apr 28, 2013
    #4
    Artificer, Corlagon, ashes999 and 5 others like this.
  5. Nicke

    Nicke Fortune seeker Veteran

    Messages:
    521
    Likes Received:
    443
    Location:
    Sweden
    First Language:
    Swedish
    Primarily Uses:
    RMMV
    I'll just continue then!

    If you ever wanted to add every item/skills/weapons for debugging purpose (or something else?) it can be kind of tedious to add them all if you have alot. This small script call will help immensely:



    Code:
    $data_items.each { |i|
    next if i.nil? or i.name == ""
    $game_party.gain_item(i, 99)
    }
    
    Of course, if you want you can change $data_items to $data_weapons or something else and the amount you want.

    When checking for input triggers/pressing you can actually shorten that a bit:



    Code:
    Input.trigger?(:CTRL)
    
    There is no need to write Input::CTRL anymore.

    To get the leader of the party you can do this:



    Code:
    $game_party.leader
    
    Gain/lose gold:



    Code:
    $game_party.gain_gold(amount)
    $game_party.lose_gold(amount)
    
    Check for current max gold:



    Code:
    $game_party.max_gold
    
    Get map id and name:



    Code:
    $game_map.map_id
    $game_map.name
    
    To correct the screen shake bug thing do the following at Game_Interpreter:



    Code:
    def command_225
    screen.start_shake(@params[0], @params[1], @params[2])
    wait(@params[2]) if @params[2]
    end
    
    Now it will wait the right amount of frames and not 5.
     
    Last edited by a moderator: Nov 17, 2012
    #5
    Mihel, ct_bolt, Domin0e and 2 others like this.
  6. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,045
    Likes Received:
    13,039
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    I can't believe I forgot an important one. Regions.



    Code:
    $game_player.region_id == n
    $game_map.events[event_id].region_id == n
     
    #6
    ct_bolt and Acetonide like this.
  7. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,045
    Likes Received:
    13,039
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    Show Choices



    Code:
    params = []
    choices = []
    choices.push("choice 1")
    choices.push("choice 2")
    params.push(choices)
    params.push(0/1/2 this part is where you press cancel and which choice to default)
    setup_choices(params)
     
    #7
    ct_bolt likes this.
  8. Domin0e

    Domin0e Like a leaf in the wind Member

    Messages:
    516
    Likes Received:
    18
    Location:
    Germany
    First Language:
    German
    Can we bypass the choice limit by using the script commands? :)
     
    #8
  9. Archeia

    Archeia Level 99 Demi-fiend Staff Member Developer

    Messages:
    14,045
    Likes Received:
    13,039
    Location:
    Game Dev Salt Mines
    First Language:
    Filipino
    Primarily Uses:
    VNM
    Seems like you can!

    [​IMG]
     
    Last edited by a moderator: Nov 30, 2012
    #9
    GrandmaDeb likes this.
  10. Shaz

    Shaz Veteran Veteran

    Messages:
    36,053
    Likes Received:
    10,233
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Do you know how to set up what to do when a choice is made?
     
    #10
  11. Sumasuun

    Sumasuun Veteran Veteran

    Messages:
    33
    Likes Received:
    0
    Am I the only one who runs into automatic word wrap in the script call which forces a line break?
     
    #11
  12. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,022
    Location:
    Toronto
    First Language:
    English
    Nope, that is the default behavior in the (really small) script call box
     
    #12
    Sumasuun likes this.
  13. Shaz

    Shaz Veteran Veteran

    Messages:
    36,053
    Likes Received:
    10,233
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    No, and it can cause your game to crash depending on where it puts the line break. It's best, if your line will be too long, to force the break yourself, after a =+-/*( symbol so it knows it's continued on the next line and doesn't add in its own spaces and break things.
     
    #13
    Acetonide likes this.
  14. Fomar0153

    Fomar0153 All wrapped up for winter. Restaff

    Messages:
    1,242
    Likes Received:
    229
    Location:
    England
    First Language:
    English
    Upping my current game's resolution upto 640 width was the best thing I did.

    I never ever have to check my text fits anymore. It's such a time saver.
     
    #14
    Shaz likes this.
  15. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,022
    Location:
    Toronto
    First Language:
    English
    Do you mean like the choice branching?
     
    Last edited by a moderator: Dec 6, 2012
    #15
  16. Shaz

    Shaz Veteran Veteran

    Messages:
    36,053
    Likes Received:
    10,233
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Yes. The code for setting up the choices themselves is above, but the branching is normally created automatically when you use the Show Choices command. If you're now circumventing the Show Choices command, you also have to have a way to fake the When [**] branch that automatically gets created. It's like that script you created the other day where you use conditions, but this thread is for script calls that don't rely on other scripts being installed.
     
    #16
  17. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,022
    Location:
    Toronto
    First Language:
    English
    It is pretty easy to fake the When [**] command (402).

    The definition is just



    Code:
    command_skip if @branch[@indent] != @params[0]
    
    Where @params stores the choice number for that specific branch (0, 1, 2, ... )

    So all you have to do is replace @params[0] with an integer



    Code:
    if @branch[@indent] == 0
      # branch for first choice
    elsif @branch[@indent] == 1
      # branch for second choice
    end
    
     
    Last edited by a moderator: Dec 6, 2012
    #17
  18. Shaz

    Shaz Veteran Veteran

    Messages:
    36,053
    Likes Received:
    10,233
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Thank you. I thought it would be something like that, but the params/indent was messing me up.
     
    #18
  19. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,022
    Location:
    Toronto
    First Language:
    English
    I think the indent will still mess things up since indentation is internal to the game interpreter and event commands and you basically have no control over it. Which means any scripted choice branches will need to use scripts to create event commands, which I think is starting to get a little ugly.
     
    #19
  20. harvard1932

    harvard1932 Veteran Veteran

    Messages:
    40
    Likes Received:
    10
    is there a way to make script call to have more than 10 lines?
     
    Last edited by a moderator: Dec 13, 2012
    #20
Thread Status:
Not open for further replies.

Share This Page