Hi people!
I try to get PK8's SelfData Script to run, but it won't work..
This is the Error that I get..
The scripts that I use are:
- the SDK
- a Event Clone Script
- a Anti Lag script
- Title Skip Script
- Change Tileset script
- Keyboard script
- Flat Events
I tried this line of code as Script command
self_variable([@map_id, @event_id, @id], 50, 0)
But like I said, it won't work. I hope someone can help me
I try to get PK8's SelfData Script to run, but it won't work..
This is the Error that I get..
The scripts that I use are:
- the SDK
- a Event Clone Script
#==============================================================================
# ** Events klonen V1.1
# EventsKlonen.rb von Abt Ploutôn, Monsta (07.08.2008)
#------------------------------------------------------------------------------
# http://www.rpg-studio.de/scriptdb/node/51
# http://www.rpg-studio.de/forum/index.php?page=Thread&threadID=9900
# http://www.rmxp.de/forum/rmxp-de-technik/rgss-skript-datenbank/programmierhilfen/p227129-events-klonen/#post227129
#==============================================================================
#--------------------------------------------------------------------------
# Events klonen V1 @ Abt Ploutôn
#--------------------------------------------------------------------------
# Monsta Edit: 1.0 05.06.07
# Aufruf:
# $game_map.add_event(map_id,id,x,y)
# ...weitere Events...
# $scene.spriteset.refresh
# Neuerungen vom Monsta Edit
# - Man kann sich die ID des neuen Events zurückgeben lassen (@id = $game_map.add...)
# - Bug mit Self Switches bei geklonten Events behoben
# - Die Zeile "$game_map.need_refresh = true" brauch nicht mehr ins Call Skript
# - ID's werden richtig ersetzt (siehe Post SLB)
class Spriteset_Map
#--------------------------------------------------------------------------
def refresh
$game_map.need_refresh = true
unless @character_sprites == nil
for sprite in @character_sprites
sprite.dispose
end
end
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
@character_sprites.push(sprite)
end
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
end
#--------------------------------------------------------------------------
end
class Game_Map
#--------------------------------------------------------------------------
def add_event(map_id,id,x,y)
s = 1
(1..@events.size + 1).each{|s|break unless @events.keys.include?(s)}
map = load_data(sprintf("Data/Map%03d.rxdata", map_id))
ev = map.events[id]
ev.id = s
@events[s] = Game_Event.new(@map_id, ev)
@events[s].moveto(x, y)
return @events[s].id
end
#--------------------------------------------------------------------------
end
class Scene_Map
#--------------------------------------------------------------------------
attr_accessor :spriteset
#--------------------------------------------------------------------------
end
#==============================================================================
# ** Events klonen V1.1
# EventsKlonen.rb von Abt Ploutôn, Monsta (07.08.2008)
#------------------------------------------------------------------------------
# http://www.rpg-studio.de/scriptdb/node/51
# http://www.rpg-studio.de/forum/index.php?page=Thread&threadID=9900
# http://www.rmxp.de/forum/rmxp-de-technik/rgss-skript-datenbank/programmierhilfen/p227129-events-klonen/#post227129
#==============================================================================
#--------------------------------------------------------------------------
# Events klonen V1 @ Abt Ploutôn
#--------------------------------------------------------------------------
# Monsta Edit: 1.0 05.06.07
# Aufruf:
# $game_map.add_event(map_id,id,x,y)
# ...weitere Events...
# $scene.spriteset.refresh
# Neuerungen vom Monsta Edit
# - Man kann sich die ID des neuen Events zurückgeben lassen (@id = $game_map.add...)
# - Bug mit Self Switches bei geklonten Events behoben
# - Die Zeile "$game_map.need_refresh = true" brauch nicht mehr ins Call Skript
# - ID's werden richtig ersetzt (siehe Post SLB)
class Spriteset_Map
#--------------------------------------------------------------------------
def refresh
$game_map.need_refresh = true
unless @character_sprites == nil
for sprite in @character_sprites
sprite.dispose
end
end
@character_sprites = []
for i in $game_map.events.keys.sort
sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
@character_sprites.push(sprite)
end
@character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
end
#--------------------------------------------------------------------------
end
class Game_Map
#--------------------------------------------------------------------------
def add_event(map_id,id,x,y)
s = 1
(1..@events.size + 1).each{|s|break unless @events.keys.include?(s)}
map = load_data(sprintf("Data/Map%03d.rxdata", map_id))
ev = map.events[id]
ev.id = s
@events[s] = Game_Event.new(@map_id, ev)
@events[s].moveto(x, y)
return @events[s].id
end
#--------------------------------------------------------------------------
end
class Scene_Map
#--------------------------------------------------------------------------
attr_accessor :spriteset
#--------------------------------------------------------------------------
end
- a Anti Lag script
#===============================================================================
# ** AntiLag Script
#-------------------------------------------------------------------------------
#
# f0tz!baerchen
# 0.71
# 06.01.2007
#
#-------------------------------------------------------------------------------
#
# Credits:
# Chaosg1 (for testing ;) )
# NearFantastica (for the Event AntiLag I used and improved)
#
#-------------------------------------------------------------------------------
#
# Features:
# - Event AntiLag: Event (and their Sprites) which are not on the screen are
# not updated except they run on "Autostart" or "Parallel Process" or they
# have an empty comment in the first line
# - High Priority: Game can be run on high priority
# - Smooth Antilag: the Event AntiLag does only work fine if the events are
# distributed over the whole map, but when there are many events at the same
# place it lags again. If the script notices that the CPU utilization
# gets higher than $antilag.max_cpu_utilization it will slow down the game and
# reduce the framerate as long as needed.
#
#-------------------------------------------------------------------------------
#
# Settings:
# can be changed anytime during the game. They are found at the end of the
# script.
#
#===============================================================================
#-------------------------------------------------------------------------------
# * SDK Log Script
#-------------------------------------------------------------------------------
SDK.log('AntiLag', 'f0tz!baerchen', 0.71, '06.01.07')
#-------------------------------------------------------------------------------
# Begin SDK Enabled Check
#-------------------------------------------------------------------------------
if SDK.state('AntiLag') == true
#===============================================================================
# Class for Antilag Settings
#===============================================================================
class Antilag_Settings
attr_accessor :event
attr_accessor :max_cpu_utilization
attr_accessor :cpu_tolerance
#-----------------------------------------------------------------------------
# initializes default settings
#-----------------------------------------------------------------------------
def initialize
@event = true
@high_priority = true
@max_cpu_utilization = 100
@cpu_tolerance = 20
@SetPriorityClass = Win32API.new('kernel32', 'SetPriorityClass',
['p', 'i'], 'i')
@GetProcessTimes = Win32API.new('kernel32', 'GetProcessTimes',
['i','p','p','p','p'], 'i')
end
#-----------------------------------------------------------------------------
# turns high priority on/off
#-----------------------------------------------------------------------------
def high_priority=(value)
@high_priority = value
if @high_priority
@SetPriorityClass.call(-1, 0x00000080) # High Priority
else
@SetPriorityClass.call(-1, 0x00000020) # Normal Priority
end
end
#-----------------------------------------------------------------------------
# returns the current CPU Utilization
#-----------------------------------------------------------------------------
def get_cpu_utilization
# uses API Call to get the Kernel and User Time
creation_time = '0' * 10
exit_time = '0' * 10
kernel_time = '0' * 10
user_time = '0' * 10
@GetProcessTimes.call(-1, creation_time, exit_time, kernel_time, user_time)
# converts times into integer (in 100ns)
kernel_time = kernel_time.unpack('l2')
user_time = user_time.unpack('l2')
kernel_time = kernel_time[0] + kernel_time[1]
user_time = user_time[0] + user_time[1]
# takes differences to calculate cpu utilization
if @old_time != nil
timer_difference = Time.new - @old_timer
time_difference = kernel_time + user_time - @old_time
result = time_difference / timer_difference / 100000
else
result = $antilag.max_cpu_utilization
end
# saves values (to calculate the differences, s.a.)
@old_timer = Time.new
@old_time = kernel_time + user_time
return result
end
end
$antilag = Antilag_Settings.new
#===============================================================================
# Scene_Map class
#===============================================================================
class Scene_Map
#-----------------------------------------------------------------------------
# update method, smooth antilag has been added
#-----------------------------------------------------------------------------
alias f0tzis_anti_lag_scene_map_update update
def update
f0tzis_anti_lag_scene_map_update
if Graphics.frame_count % 20 == 0 and $antilag.max_cpu_utilization <= 100
# calculates difference between max utilization and current utilization
abs = $antilag.max_cpu_utilization - $antilag.get_cpu_utilization
# changes Frame Rate if difference is bigger than the tolerance
if abs.abs >= $antilag.max_cpu_utilization * $antilag.cpu_tolerance/100.0
Graphics.frame_rate = [[10, Graphics.frame_rate + abs / 2].max, 40].min
end
end
end
end
#===============================================================================
# Game_Event Class
#===============================================================================
class Game_Event
#-----------------------------------------------------------------------------
# for AntiLag, decides, if an event is on the screen or not.
#-----------------------------------------------------------------------------
def in_range?
# returns true if $event_antilag is false or the event is an
# Autostart/Parallel Process event or it has an empty
# comment in the first line
if not $antilag.event or (@trigger == 3 or @trigger == 4 or
(@list != nil and @list[0].code == 108 and @list[0].parameters == ['']))
return true
end
screne_x = $game_map.display_x
screne_x -= 256
screne_y = $game_map.display_y
screne_y -= 256
screne_width = $game_map.display_x
screne_width += 2816
screne_height = $game_map.display_y
screne_height += 2176
return false if @real_x <= screne_x
return false if @real_x >= screne_width
return false if @real_y <= screne_y
return false if @real_y >= screne_height
return true
end
#-----------------------------------------------------------------------------
# update method
#-----------------------------------------------------------------------------
alias f0tzis_anti_lag_game_event_update update
def update
return if not self.in_range?
f0tzis_anti_lag_game_event_update
end
end
#===============================================================================
# Sprite_Character Class
#===============================================================================
class Sprite_Character < RPG::Sprite
#-----------------------------------------------------------------------------
# update method, parameters added for Loop_Map, rebuild for 8dirs
#-----------------------------------------------------------------------------
alias f0tzis_anti_lag_sprite_char_update update
def update
return if @character.is_a?(Game_Event) and not @character.in_range?
f0tzis_anti_lag_sprite_char_update
end
end
end
#===============================================================================
# Settings
#===============================================================================
$antilag.max_cpu_utilization = 95 # the maximum CPU utilization, the script
# try to stay under this value during changing
# changing the frame rate. The lower this
# value the higher will be the lag reduction
# (and the smoothness, too), a value > 100
# will disable this feature completely
$antilag.cpu_tolerance = 20 # this value tells the script how many % of
# the CPU utilization change should be ignored
# If you change it too a higher value you,
# your Frame Rate will be more constant but
# smaller lags will be ignored.
$antilag.high_priority = true # set this to true if you want the game to run
# on high priority
$antilag.event = true # set this to true to enable normal anti-lag
- Title Skip Script
#==============================================================================
# Xenres' Title Skip
# Version 1.0
# 2010-11-24
#------------------------------------------------------------------------------
# Loads necessary objects and skips to the start map to use as a title screen
# or whatever.
#==============================================================================
class Scene_Title
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# If battle test
if $BTEST
battle_test
return
end
# Load database
$data_actors = load_data("Data/Actors.rxdata")
$data_classes = load_data("Data/Classes.rxdata")
$data_skills = load_data("Data/Skills.rxdata")
$data_items = load_data("Data/Items.rxdata")
$data_weapons = load_data("Data/Weapons.rxdata")
$data_armors = load_data("Data/Armors.rxdata")
$data_enemies = load_data("Data/Enemies.rxdata")
$data_troops = load_data("Data/Troops.rxdata")
$data_states = load_data("Data/States.rxdata")
$data_animations = load_data("Data/Animations.rxdata")
$data_tilesets = load_data("Data/Tilesets.rxdata")
$data_common_events = load_data("Data/CommonEvents.rxdata")
$data_system = load_data("Data/System.rxdata")
# Make system object
$game_system = Game_System.new
# Make each type of game object
$game_temp = Game_Temp.new
$game_system = Game_System.new
$game_switches = Game_Switches.new
$game_variables = Game_Variables.new
$game_self_switches = Game_SelfSwitches.new
$game_screen = Game_Screen.new
$game_actors = Game_Actors.new
$game_party = Game_Party.new
$game_troop = Game_Troop.new
$game_map = Game_Map.new
$game_player = Game_Player.new
# Set up initial party
$game_party.setup_starting_members
# Set up initial map position
$game_map.setup($data_system.start_map_id)
# Move player to initial position
$game_player.moveto($data_system.start_x, $data_system.start_y)
# Refresh player
$game_player.refresh
# Run automatic change for BGM and BGS set with map
$game_map.autoplay
# Update map (run parallel process event)
$game_map.update
# go to REAL title screen
$scene = Scene_Map.new
end
end
- Change Tileset script
#====================================
# Phylomortis Script, Ryethe. Rewrite: Leon_Westbrooke
#------------------------------------------------------------------------
# Game_Map and Spriteset_Map are aliased
# To call $game_map.replace_tileset(x), where x is the ID number of the new tileset.
#====================================
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Game_Map
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Map
attr_accessor :new_tileset
alias leon_gm_tileset_setup setup
def setup(map_id)
@new_tileset = false
leon_gm_tileset_setup(map_id)
end
def replace_tileset(new_tiles)
tileset = $data_tilesets[new_tiles]
@tileset_name = tileset.tileset_name
@autotile_names = tileset.autotile_names
@panorama_name = tileset.panorama_name
@panorama_hue = tileset.panorama_hue
@battleback_name = tileset.battleback_name
@passages = tileset.passages
@priorities = tileset.priorities
@terrain_tags = tileset.terrain_tags
$game_map.new_tileset = true
end
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Spriteset_Map
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Spriteset_Map
alias leon_sm_tileset_update update
def update
if $game_map.new_tileset == true
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
@tilemap.priorities = $game_map.priorities
for i in 0..6
autotile_name = $game_map.autotile_names[i]
@tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
$game_map.new_tileset = false
end
leon_sm_tileset_update
end
end
- Keyboard script
#===============================================================================
# Key.press?(key) keyboard Script
#===============================================================================
# Input Module written by Cybersam. Modified by Synthesize
# version 1.0.0
# May 11, 2008
#-------------------------------------------------------------------------------
module Key
@keystatus = Win32API.new("user32","GetAsyncKeyState",['i'],'i')
#-----------------------------------------------------------------------------
# Check if specified key is being pressed
#-----------------------------------------------------------------------------
def self.press?(key)
return true if @keystatus.call(key) != 0
return false
end
#-----------------------------------------------------------------------------
# Create Letter Values
#-----------------------------------------------------------------------------
Key_A = 0x41 # A key
Key_B = 0x42 # B key
Key_C = 0x43 # C key
Key_D = 0x44 # D key
Key_E = 0x45 # E key
Key_F = 0x46 # F key
Key_G = 0x47 # G key
Key_H = 0x48 # H key
Key_I = 0x49 # I key
Key_J = 0x4A # J key
Key_K = 0x4B # K key
Key_L = 0x4C # L key
Key_M = 0x4D # M key
Key_N = 0x4E # N key
Key_O = 0x4F # O key
Key_P = 0x50 # P key
Key_Q = 0x51 # Q key
Key_R = 0x52 # R key
Key_S = 0x53 # S key
Key_T = 0x54 # T key
Key_U = 0x55 # U key
Key_V = 0x56 # V key
Key_W = 0x57 # W key
Key_X = 0x58 # X key
Key_Y = 0x59 # Y key
Key_Z = 0x5A # Z key
#-----------------------------------------------------------------------------
# Map Mouse
#-----------------------------------------------------------------------------
Mouse_L = 0x01 # left mouse button
Mouse_R = 0x02 # right mouse button
Mouse_M = 0x04 # middle mouse button
Mouse_4 = 0x05 # 4th mouse button
Mouse_5 = 0x06 # 5th mouse button
#-----------------------------------------------------------------------------
# Map Control Buttons
#-----------------------------------------------------------------------------
Key_Backspace = 0x08 # BACKSPACE key
Key_Tab = 0x09 # TAB key
Key_Return = 0x0D # ENTER key
Key_Shift = 0x10 # SHIFT key
Key_Control = 0x11 # CTLR key
Key_Alt = 0x12 # ALT key
Key_Pause = 0x13 # PAUSE key
Key_Capslock = 0x14 # CAPS LOCK key
Key_Escape = 0x1B # ESC key
Key_Space = 0x20 # SPACEBAR
Key_Prior = 0x21 # PAGE UP key
Key_Next = 0x22 # PAGE DOWN key
Key_End = 0x23 # END key
Key_Home = 0x24 # HOME key
Key_Left = 0x25 # LEFT ARROW key
Key_Up = 0x26 # UP ARROW key
Key_Right = 0x27 # RIGHT ARROW key
Key_Down = 0x28 # DOWN ARROW key
Key_Select = 0x29 # SELECT key
Key_Print = 0x2A # PRINT key
Key_Snapshot = 0x2C # PRINT SCREEN key
Key_Insert = 0x2D # INS key
Key_Delete = 0x2E # DEL key
#-----------------------------------------------------------------------------
# Map Number Keys
#-----------------------------------------------------------------------------
Key_0 = 0x30 # 0 key
Key_1 = 0x31 # 1 key
Key_2 = 0x32 # 2 key
Key_3 = 0x33 # 3 key
Key_4 = 0x34 # 4 key
Key_5 = 0x35 # 5 key
Key_6 = 0x36 # 6 key
Key_7 = 0x37 # 7 key
Key_8 = 0x38 # 8 key
#-----------------------------------------------------------------------------
# Map Windows Key
#-----------------------------------------------------------------------------
Key_Lwin = 0x5B # Left Windows key (Microsoft Natural keyboard)
Key_Rwin = 0x5C # Right Windows key (Natural keyboard)
Key_Apps = 0x5D # Applications key (Natural keyboard)
#-----------------------------------------------------------------------------
# Map Numpad
#-----------------------------------------------------------------------------
Key_Numpad0 = 0x60 # Numeric keypad 0 key
Key_Numpad1 = 0x61 # Numeric keypad 1 key
Key_Numpad2 = 0x62 # Numeric keypad 2 key
Key_Numpad3 = 0x63 # Numeric keypad 3 key
Key_Numpad4 = 0x64 # Numeric keypad 4 key
Key_Numpad5 = 0x65 # Numeric keypad 5 key
Key_Numpad6 = 0x66 # Numeric keypad 6 key
Key_Numpad7 = 0x67 # Numeric keypad 7 key
Key_Numpad8 = 0x68 # Numeric keypad 8 key
Key_Numpad9 = 0x69 # Numeric keypad 9 key
Key_Multiply = 0x6A # Multiply key (*)
Key_Add = 0x6B # Add key (+)
Key_Seperator = 0x6C # Separator key
Key_Subtract = 0x6D # Subtract key (-)
Key_Decimal = 0x6E # Decimal key
Key_Divide = 0x6F # Divide key (/)
#-----------------------------------------------------------------------------
# Map F-keys
#-----------------------------------------------------------------------------
Key_F1 = 0x70 # F1 key
Key_F2 = 0x71 # F2 key
Key_F3 = 0x72 # F3 key
Key_F4 = 0x73 # F4 key
Key_F5 = 0x74 # F5 key
Key_F6 = 0x75 # F6 key
Key_F7 = 0x76 # F7 key
Key_F8 = 0x77 # F8 key
Key_F9 = 0x78 # F9 key
Key_F10 = 0x79 # F10 key
Key_F11 = 0x7A # F11 key
Key_F12 = 0x7B # F12 key
#-----------------------------------------------------------------------------
# Map Numlock and Scroll keys
#-----------------------------------------------------------------------------
Key_Numlock = 0x90 # NUM LOCK key
Key_Scroll = 0x91 # SCROLL LOCK key
#-----------------------------------------------------------------------------
# Map Control, Shift and Alt keys
#-----------------------------------------------------------------------------
Key_Lshift = 0xA0 # Left SHIFT key
Key_Rshift = 0xA1 # Right SHIFT key
Key_Lcontrol = 0xA2 # Left CONTROL key
Key_Rcontrol = 0xA3 # Right CONTROL key
Key_Lalt = 0xA4 # Left ALT key
Key_Ralt = 0xA5 # Right ALT key
#-----------------------------------------------------------------------------
# Map seperator keys
#-----------------------------------------------------------------------------
Key_Comma = 0xBC # , key
Key_Dash = 0xBD # - key
Key_Period = 0xBE # . key
end
- Flat Events
#========Flat-Events Script=======#
#===========by Monsta==========#
#=====Version 1.1=== 12.1.2007 ===#
#=======www.Monsta.aw3.de======#
# Benutzung:
# 1. Dieses Skript über Main einfügen
# 2. Sich einen oder mehrere Namen für die untersten Events aussuchen
# 3. Diesen Namen hier bei "FLAT_EVENTS" eintragen (Array)
# 4. Events im Spiel mit diesem Namen benennen
# 5. Sich freuen und mich in die Credits schreiben ;-)
# Anmerkung:
# Man kann diese Einstellung auch noch während des Spiels ändern.
# Einfach in ein Eventskript folgenden Code eingeben:
# $game_map.events[*id*].flat = true
# Das "*id*" muss durch die ID des Events ersetzt werden.
# Soll das Event nicht mehr Flach sein muss man das "true"
# im oberen Code durch ein "false" ersetzen
class Game_Map
attr_reader :map
FLAT_EVENTS = ["Speicherpunkt", "Blood", "Flach"]
alias original_setup setup
def setup(map_id)
original_setup(map_id)
for ev in $game_map.events.values
$game_map.events[ev.id].flat = FLAT_EVENTS.include?($game_map.map.events[ev.id].name)
end
end
end
class Game_Character
attr_accessor :flat
alias original_screen_z screen_z
def screen_z(height = 0)
return 0 if @flat
original_screen_z(height)
end
end
I tried this line of code as Script command
self_variable([@map_id, @event_id, @id], 50, 0)
But like I said, it won't work. I hope someone can help me