Per 2016, RMID pindah ke RMID Discord (Invite link dihapus untuk mencegah spambot -Theo @ 2019). Posting sudah tidak bisa dilakukan lagi.
Mohon maaf atas ketidaknyamanannya dan mohon kerjasamanya.

Share | 
 

 [VX] Alissa Advanced Move Route

Topik sebelumnya Topik selanjutnya Go down 
[VX] Alissa Advanced Move Route Empty2011-11-01, 19:29
Post[VX] Alissa Advanced Move Route
#1
bungatepijalan 
Moe Princess
bungatepijalan

Level 5
Posts : 1487
Thanked : 30
Engine : Multi-Engine User
Skill : Intermediate
Type : Developer
Awards:
[VX] Alissa Advanced Move Route Vide
Alissa Advanced Move Route
(for RMVX)
Version: 1.0
Type: Misc Add-on


Pengenalan

Script ini menambahkan beberapa fungsi untuk Set Move Route:
- move_toward_event(event_id)
- move_away_from_event(event_id)
- move_toward_point(x,y)
- jump_down([turn_ok])
- jump_left([turn_ok])
- jump_right([turn_ok])
- jump_up([turn_ok])
- jump_random
- jump_toward_event(event_id)
- jump_away_from_event(event_id)
- jump_forward
- jump_backward
- get_on_off_vehicle
- show_animation(animation_id[,event_id])
- show_balloon(balloon_id[,event_id])
- set_variable(var_id,value)
- add_variable(var_id,value)
- mul_variable(var_id,value)
- div_variable(var_id,value)
- mod_variable(var_id,value)
- get_variable(var_id)
- set_self_switch(selfswitch,value[,eventid])
- get_switch(switch_id)
- get_self_switch(selfswitch[,eventid])
- erase_event([event])
- label(label_name)
- jump_label(label_name[,cond])
- cmp_jump_label(label_name,cmp,exp1,exp2)
- end_route

Keterangan parameter-parameternya silakan diliat di body scriptnya

NB: Beberapa fungsinya juga diambil dari script XPnya LiTTleDRAgo yang serupa ( https://rmid.forumotion.net/t3396-xp-advanced-move-route )
Sebagian juga digunakan pada gerakan loncatan pocong di game The Mystery House



Petunjuk & Pemasangan

Cukup pasang di atas slot 'Main'.
Lalu di Set Move Route, tambahkan command Script dan gunakan fungsi yang disebutkan diatas.


Screenshot

(ngapain di-SS :v)



Demo

(If requested, probably, tapi cukup pake scriptnya dan coba fungsi2nya)


Script

Code:
#==============================================================================
# Alissa Advanced Move Route
#==============================================================================
# Information:
#  This script adds some functions to Set Move Route Command:
#    - move_toward_event(event_id)
#    - move_away_from_event(event_id)
#    - move_toward_point(x,y)
#    - jump_down([turn_ok])
#    - jump_left([turn_ok])
#    - jump_right([turn_ok])
#    - jump_up([turn_ok])
#    - jump_random
#    - jump_toward_event(event_id)
#    - jump_away_from_event(event_id)
#    - jump_forward
#    - jump_backward
#    - get_on_off_vehicle
#    - show_animation(animation_id[,event_id])
#    - show_balloon(balloon_id[,event_id])
#    - set_variable(var_id,value)
#    - add_variable(var_id,value)
#    - mul_variable(var_id,value)
#    - div_variable(var_id,value)
#    - mod_variable(var_id,value)
#    - get_variable(var_id)
#    - set_self_switch(selfswitch,value[,eventid])
#    - get_switch(switch_id)
#    - get_self_switch(selfswitch[,eventid])
#    - erase_event([event])
#    - label(label_name)
#    - jump_label(label_name[,cond])
#    - cmp_jump_label(label_name,cmp,exp1,exp2)
#    - end_route
#
#  See parameter details at each function definitions.
#
# Usage:
#  At Set Move Route command, add movement command Script, and type
#  a function mentioned above.
#
# Installation:
#  Just place above Main.
#
# Credits
#  Alissa Liu
#  LiTTleDRAgo
#
#==============================================================================

if Object.const_defined?('SDK')
 SDK.log('Advanced Move Route', 'Alissa', 1, '1.11.11')
 !@alissa_advmoveroute_disabled = true if !SDK.enabled?('Advanced Move Route')
end

if !@alissa_advmoveroute_disabled
#==============================================================================
# ** Game_Character
#------------------------------------------------------------------------------
#  This class deals with characters. It's used as a superclass of the
# Game_Player and Game_Event classes.
#==============================================================================

class Game_Character
  #--------------------------------------------------------------------------
  # * Calculate X Distance From Event
  #--------------------------------------------------------------------------
  def distance_x_from_event(event)
    sx = @x - event.x
    if $game_map.loop_horizontal?        # When looping horizontally
      if sx.abs > $game_map.width / 2    # Larger than half the map width?
        sx -= $game_map.width            # Subtract map width
      end
    end
    return sx
  end
  #--------------------------------------------------------------------------
  # * Calculate Y Distance From Event
  #--------------------------------------------------------------------------
  def distance_y_from_event(event)
    sy = @y - event.y
    if $game_map.loop_vertical?          # When looping vertically
      if sy.abs > $game_map.height / 2    # Larger than half the map height?
        sy -= $game_map.height            # Subtract map height
      end
    end
    return sy
  end
  #--------------------------------------------------------------------------
  # * Calculate X Distance From Value
  #--------------------------------------------------------------------------
  def distance_x_from(x)
    sx = @x - x
    if $game_map.loop_horizontal?        # When looping horizontally
      if sx.abs > $game_map.width / 2    # Larger than half the map width?
        sx -= $game_map.width            # Subtract map width
      end
    end
    return sx
  end
  #--------------------------------------------------------------------------
  # * Calculate Y Distance From Value
  #--------------------------------------------------------------------------
  def distance_y_from(y)
    sy = @y - y
    if $game_map.loop_vertical?          # When looping vertically
      if sy.abs > $game_map.height / 2    # Larger than half the map height?
        sy -= $game_map.height            # Subtract map height
      end
    end
    return sy
  end
  #--------------------------------------------------------------------------
  # * Move toward Event/Player
  #    event_id : Event ID or -1 for player
  #--------------------------------------------------------------------------
  def move_toward_event(event_id)
    events = $game_map.events
    return if events == nil
    if event_id == -1
      sx = distance_x_from_player
      sy = distance_y_from_player
    else
      sx = distance_x_from_event(events[event_id])
      sy = distance_y_from_event(events[event_id])
    end
    if sx != 0 or sy != 0
      if sx.abs > sy.abs                  # Horizontal distance is longer
        sx > 0 ? move_left : move_right  # Prioritize left-right
        if @move_failed and sy != 0
          sy > 0 ? move_up : move_down
        end
      else                                # Vertical distance is longer
        sy > 0 ? move_up : move_down      # Prioritize up-down
        if @move_failed and sx != 0
          sx > 0 ? move_left : move_right
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Move away from Event/Player
  #    event_id : Event ID or -1 for player
  #--------------------------------------------------------------------------
  def move_away_from_event(event_id)
    events = $game_map.events
    return if events == nil
    if event_id == -1
      sx = distance_x_from_player
      sy = distance_y_from_player
    else
      sx = distance_x_from_event(events[event_id])
      sy = distance_y_from_event(events[event_id])
    end
    if sx != 0 or sy != 0
      if sx.abs > sy.abs                  # Horizontal distance is longer
        sx > 0 ? move_right : move_left  # Prioritize left-right
        if @move_failed and sy != 0
          sy > 0 ? move_down : move_up
        end
      else                                # Vertical distance is longer
        sy > 0 ? move_down : move_up      # Prioritize up-down
        if @move_failed and sx != 0
          sx > 0 ? move_right : move_left
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Move toward Position
  #    x,y : Designated position
  #--------------------------------------------------------------------------
  def move_toward_point(x,y)
    sx = distance_x_from(x)
    sy = distance_y_from(y)
    if sx != 0 or sy != 0
      if sx.abs > sy.abs                  # Horizontal distance is longer
        sx > 0 ? move_left : move_right  # Prioritize left-right
        if @move_failed and sy != 0
          sy > 0 ? move_up : move_down
        end
      else                                # Vertical distance is longer
        sy > 0 ? move_up : move_down      # Prioritize up-down
        if @move_failed and sx != 0
          sx > 0 ? move_left : move_right
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Jump Down
  #    turn_ok : Allows change of direction on the spot
  #--------------------------------------------------------------------------
  def jump_down(turn_ok = true)
    if passable?(@x, @y+1)                  # Passable
      turn_down
      @move_failed = false
      jump(0,1)
    else                                    # Impassable
      turn_down if turn_ok
      check_event_trigger_touch(@x, @y+1)  # Touch event is triggered?
      @move_failed = true
    end
  end
  #--------------------------------------------------------------------------
  # * Jump Left
  #    turn_ok : Allows change of direction on the spot
  #--------------------------------------------------------------------------
  def jump_left(turn_ok = true)
    if passable?(@x-1, @y)                  # Passable
      turn_left
      @move_failed = false
      jump(-1,0)
    else                                    # Impassable
      turn_left if turn_ok
      check_event_trigger_touch(@x-1, @y)  # Touch event is triggered?
      @move_failed = true
    end
  end
  #--------------------------------------------------------------------------
  # * Jump Right
  #    turn_ok : Allows change of direction on the spot
  #--------------------------------------------------------------------------
  def jump_right(turn_ok = true)
    if passable?(@x+1, @y)                  # Passable
      turn_right
      @move_failed = false
      jump(1,0)
    else                                    # Impassable
      turn_right if turn_ok
      check_event_trigger_touch(@x+1, @y)  # Touch event is triggered?
      @move_failed = true
    end
  end
  #--------------------------------------------------------------------------
  # * Jump up
  #    turn_ok : Allows change of direction on the spot
  #--------------------------------------------------------------------------
  def jump_up(turn_ok = true)
    if passable?(@x, @y-1)                  # Passable
      turn_up
      @move_failed = false
      jump(0,-1)
    else                                    # Impassable
      turn_up if turn_ok
      check_event_trigger_touch(@x, @y-1)  # Touch event is triggered?
      @move_failed = true
    end
  end
  #--------------------------------------------------------------------------
  # * Jump at Random
  #--------------------------------------------------------------------------
  def jump_random
    case rand(4)
    when 0
      jump_down
    when 1
      jump_left
    when 2
      jump_right
    when 3
      jump_up
    end
  end
  #--------------------------------------------------------------------------
  # * Jump toward Event/Player
  #    event_id : Event ID or -1 for player
  #--------------------------------------------------------------------------
  def jump_toward_event(event_id)
    events = $game_map.events
    return if events == nil
    if event_id == -1
      sx = distance_x_from_player
      sy = distance_y_from_player
    else
      sx = distance_x_from_event(events[event_id])
      sy = distance_y_from_event(events[event_id])
    end
    if sx != 0 or sy != 0
      if sx.abs > sy.abs                  # Horizontal distance is longer
        sx > 0 ? jump_left : jump_right  # Prioritize left-right
        if @move_failed and sy != 0
          sy > 0 ? jump_up : jump_down
        end
      else                                # Vertical distance is longer
        sy > 0 ? jump_up : jump_down      # Prioritize up-down
        if @move_failed and sx != 0
          sx > 0 ? jump_left : jump_right
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Jump away from Event/Player
  #    event_id : Event ID or -1 for player
  #--------------------------------------------------------------------------
  def jump_away_from_event(event_id)
    events = $game_map.events
    return if events == nil
    if event_id == -1
      sx = distance_x_from_player
      sy = distance_y_from_player
    else
      sx = distance_x_from_event(events[event_id])
      sy = distance_y_from_event(events[event_id])
    end
    if sx != 0 or sy != 0
      if sx.abs > sy.abs                  # Horizontal distance is longer
        sx > 0 ? jump_right : jump_left  # Prioritize left-right
        if @move_failed and sy != 0
          sy > 0 ? jump_down : jump_up
        end
      else                                # Vertical distance is longer
        sy > 0 ? jump_down : jump_up      # Prioritize up-down
        if @move_failed and sx != 0
          sx > 0 ? jump_right : jump_left
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Jump Forward
  #--------------------------------------------------------------------------
  def jump_forward
    case @direction
    when 2;  jump_down(false)
    when 4;  jump_left(false)
    when 6;  jump_right(false)
    when 8;  jump_up(false)
    end
  end
  #--------------------------------------------------------------------------
  # * Jump Backward
  #--------------------------------------------------------------------------
  def jump_backward
    last_direction_fix = @direction_fix
    @direction_fix = true
    case @direction
    when 2;  jump_up(false)
    when 4;  jump_right(false)
    when 6;  jump_left(false)
    when 8;  jump_down(false)
    end
    @direction_fix = last_direction_fix
  end
  #--------------------------------------------------------------------------
  # * Get on/off Vehicle (applicable for player)
  #--------------------------------------------------------------------------
  def get_on_off_vehicle
    $game_player.get_on_off_vehicle if self == $game_player
  end
  #--------------------------------------------------------------------------
  # * Show Animation
  #    animation_id : Animation ID
  #    event_id : Event ID or -1 for player
  #--------------------------------------------------------------------------
  def show_animation(animation_id,event_id=self.id)
    if event_id == -1
      character = $game_player
    else
      character = $game_map.events[event_id]
    end
    if character != nil
      character.animation_id = animation_id
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * Show Balloon Icon
  #    balloon_id : Balloon Icon ID
  #    event_id : Event ID or -1 for player
  #--------------------------------------------------------------------------
  def show_balloon(balloon_id,event_id=self.id)
    if event_id == -1
      character = $game_player
    else
      character = $game_map.events[event_id]
    end
    if character != nil
      character.balloon_id = balloon_id
    end
    return true
  end
  #--------------------------------------------------------------------------
  # * Control Variables
  #--------------------------------------------------------------------------
  def set_variable(var_id,value = 0)
    $game_variables[var_id] = value if var_id > 0
    $game_map.need_refresh = true
  end
  def add_variable(var_id,value = 0)
    $game_variables[var_id] += value if var_id > 0
    $game_map.need_refresh = true
  end
  def mul_variable(var_id,value = 0)
    $game_variables[var_id] *= value if var_id > 0
    $game_map.need_refresh = true
  end
  def div_variable(var_id,value = 0)
    $game_variables[var_id] /= value if var_id > 0
    $game_map.need_refresh = true
  end
  def mod_variable(var_id,value = 0)
    $game_variables[var_id] = $game_variables[var_id] % value if var_id > 0
    $game_map.need_refresh = true
  end
  #--------------------------------------------------------------------------
  # * Get Variables
  #--------------------------------------------------------------------------
  def get_variable(var_id)
    return $game_variables[var_id]
  end
  #--------------------------------------------------------------------------
  # * Control Self Switch
  #--------------------------------------------------------------------------
  def set_self_switch(selfswitch,value,eventid=self.id)
    key = [$game_map.map_id,eventid,selfswitch]
    $game_self_switches[key] = value
    $game_map.need_refresh = true
  end
  #--------------------------------------------------------------------------
  # * Get Switch
  #--------------------------------------------------------------------------
  def get_switch(switch_id)
    return $game_switches[switch_id]
  end
  #--------------------------------------------------------------------------
  # * Get Self Switch
  #--------------------------------------------------------------------------
  def get_self_switch(selfswitch,eventid=self.id)
    key = [$game_map.map_id,eventid,selfswitch]
    return $game_self_switches[key]
  end
  #--------------------------------------------------------------------------
  # * Erase Event
  #--------------------------------------------------------------------------
  def erase_event(event = self.id)
    $game_map.events[event].erase if event > 0
    $game_map.need_refresh = true
  end
  #--------------------------------------------------------------------------
  # * Label
  #    label_name : Label Name
  #--------------------------------------------------------------------------
  def label(label_name)
    @move_route.list[@move_route_index].code = 46
    @move_route.list[@move_route_index].parameters[0] = label_name
  end
  #--------------------------------------------------------------------------
  # * Jump to Label
  #    label_name : Label Name
  #    cond : Evaluation script code returning boolean value (in string)
  #--------------------------------------------------------------------------
  def jump_label(label_name,cond="true")
    for i in 0...@move_route.list.size
      if @move_route.list[i].code == 46 && @move_route.list[i].parameters[0] == label_name
        @move_route_index = i if eval(cond)
        return
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Compare and Jump to Label
  #    label_name : Label Name
  #    cmp = "eq" : equal to
  #          "ne" : not equal to
  #          "gt" : greater than
  #          "lt" : less than
  #          "ge" : greater than or equal to
  #          "le" : less than or equal to
  #    exp1,exp2 : Expression 1, Expression 2 (can be values, switches, or variables)
  #--------------------------------------------------------------------------
  def cmp_jump_label(label_name,cmp,exp1,exp2)
    cond = true
    case cmp
    when "eq"
      cond = (exp1 == exp2)
    when "ne"
      cond = (exp1 != exp2)
    when "gt"
      cond = (exp1 > exp2)
    when "lt"
      cond = (exp1 < exp2)
    when "ge"
      cond = (exp1 >= exp2)
    when "le"
      cond = (exp1 <= exp2)
    end
    for i in 0...@move_route.list.size
      if @move_route.list[i].code == 46 && @move_route.list[i].parameters[0] == label_name
        @move_route_index = i if cond
        return
      end
    end
  end
  #--------------------------------------------------------------------------
  # * End Move Route
  #--------------------------------------------------------------------------
  def end_route
    @move_route.list[@move_route_index].code = 0
    @move_route_index -= 1
  end
end
end


Credits

  • bungatepijalan
  • LiTTleDRAgo


Terakhir diubah oleh bungatepijalan tanggal 2011-11-02, 11:48, total 1 kali diubah (Reason for editing : perubahan dikit)
[VX] Alissa Advanced Move Route Empty2011-11-01, 20:11
PostRe: [VX] Alissa Advanced Move Route
#2
ashm 
Veteran
Veteran
ashm

Level 5
Posts : 1131
Thanked : 8
Engine : RMVX Ace
Skill : Intermediate
Type : Event Designer
Awards:

[VX] Alissa Advanced Move Route Vide
Numpang nanya, itu [turn ok] bernilai boolean?
Kalo jump toward even tuh kok gak ada nilai "jumlah tile yg di lompatin"?

Kalo ice sliding bisa bikinin gak :ngacay:

oot : liu ajarin rgss2 donk. Bosen alstruk pake C :V
[VX] Alissa Advanced Move Route Empty2011-11-01, 20:31
PostRe: [VX] Alissa Advanced Move Route
#3
bungatepijalan 
Moe Princess
bungatepijalan

Level 5
Posts : 1487
Thanked : 30
Engine : Multi-Engine User
Skill : Intermediate
Type : Developer
Awards:
[VX] Alissa Advanced Move Route Vide
@^
yup, nilai defaultnya true kalo parameternya ga dimasukin

OOT: cari tuts ruby & RGSS2 di google :kabur:
di forum ini juga ada :kabur:
[VX] Alissa Advanced Move Route Empty2011-11-01, 21:08
PostRe: [VX] Alissa Advanced Move Route
#4
Roger 
Novice
Novice
Roger

Level 5
Posts : 191
Thanked : 3
Engine : RMVX
Skill : Very Beginner
Type : Scripter

[VX] Alissa Advanced Move Route Vide
woaahh complex banget (maklum scripter cupu, masi baru tau yg modular programing)

kk situ edit dan modif script?? berapa persen yg ditambahkan??
sekadar nanya

OOT : klo RGSS2 kya gini mending bikin RGSS 3 aj XD
ga lengkap sih
[VX] Alissa Advanced Move Route Empty2011-11-02, 17:40
PostRe: [VX] Alissa Advanced Move Route
#5
SerpentZ 
Advance
Advance
SerpentZ

Level 5
Posts : 425
Thanked : 2
Engine : Multi-Engine User
Skill : Intermediate
Type : Mapper

[VX] Alissa Advanced Move Route Vide
Thanks :sembah:
Ane Perlu...
Bukan Perlu lagi..
Sangat Perlu...
Terserah lah..
:ngacay:
:sembah:
[VX] Alissa Advanced Move Route Empty
PostRe: [VX] Alissa Advanced Move Route
#6
Sponsored content 




[VX] Alissa Advanced Move Route Vide
 

[VX] Alissa Advanced Move Route

Topik sebelumnya Topik selanjutnya Kembali Ke Atas 

Similar topics

+
Halaman 1 dari 1

Permissions in this forum:Anda tidak dapat menjawab topik
RPGMakerID :: Scripts & Event Systems :: RMVX Scripts-