因為上次發的腳本功能實在是太少了??!!
所以這次重新寫了些沒人寫過的功能並整合?!(應該吧)
提供功能:扔物品、放置物品、丟錢、放置錢、放置經驗、置設傳送點、複製事件、刪除前面的這些東西
詳情看註解~
p.s. 「置設傳送點」這功能是給ARPG用的(玩家可以用它來在同一張地圖內傳來傳去躲攻擊?!)
~~~~~~~~~2013/4/6 15:17 修復重大的Bug~~~~~~~~~~(之前會當掉...)
~~~~~~~~~2013/4/6 22:35 加入新功能~~~~~~~~~~~
~~~~~~~~~2013/4/10 21:30 修正註解~~~~~~~~~~~
~~~~~~~~~2013/4/28 16:09 支援RGSS3forXP並改進效率~~~~~~~~~~~
- #========================================================#★ 多功能事件 -by joe59491#========================================================#========使用說明========================================#扔物品到地圖上#Throw_Item_To_Map.new(物品編號,set*) #會扔在主角面前,名稱為物品名,會扣物品#Throw_Item_To_Map2.new(物品編號,set*) #會扔在主角腳下,名稱為物品名,會扣物品#放置物品到地圖上#Item_To_Map.new(物品編號,x,y,set*) #會放在地圖上的(x,y),名稱為物品名,不扣物品#丟錢到地圖上#Throw_Money_To_Map.new(多少錢,set*) #會扔在主角面前,會扣錢#丟錢到地圖上#Throw_Money_To_Map2.new(多少錢,set*) #會扔在主角腳下,會扣錢#放置錢到地圖上#Money_To_Map.new(多少錢,x,y,set*) #會放在地圖上的(x,y),不扣錢#放置經驗到地圖上#EXP_To_Map.new(多少經驗,x,y,set*) #會放在地圖上的(x,y),不扣經驗#放置變數到地圖上#Variables_To_Map.new(變數ID,多少,x,y,set*) #會放在地圖上的(x,y)#製造傳送點A#Telport_To_Map_A.new(set*) #會放在主角面前#製造傳送點B#Telport_To_Map_B.new(set*) #會放在主角面前#製造傳送點A(xy版)#Telport_To_Map_A_xy.new(x,y,set*) #會放在地圖上的(x,y)#製造傳送點B(xy版)#Telport_To_Map_B_xy.new(x,y,set*) #會放在地圖上的(x,y)# set為是否要刷新地圖,預設會刷新,如果是從非地圖畫面,請寫0#每對A和B傳送點是互傳的#複製事件#Eve_To_Map.new(新X座標,新Y座標,複製事件所在地圖的編號,複製事件編號)#刪除事件(全部,針對傳送點的)#Dis_Telport_Eve.new#刪除事件(全部,針對多功能事件)#Dis_Eve.new#刪除某事件(針對多功能事件)#Dis_A_Eve.new(編號)#儲存事件(非自動,針對多功能事件)#Save_Eve.new #讀取事件(非自動,針對多功能事件)#Load_Eve.new#p.s. 當開關關閉時,會事件會被保留,否則會消失。#多功能事件預設一個地圖最多200個,然後暫時消除多功能事件等於刪掉它#========================================================#========參數設定======================================#Pic開頭是指行走圖名稱#Dir開頭是指朝向 2上(第一排) 4左(第二排) 6右(第三排) 8下(第四排)#Item=物品 EXP=經驗 Money=錢 Variables=變數 Telport=傳送點$Pic_Item = "193-support01"$Dir_Item = 6$Pic_EXP = "193-support01"$Dir_EXP = 6$Pic_Money = "193-support01"$Dir_Money = 6$Pic_Variables = "193-support01"$Dir_Variables = 6$Pic_TelportA = "199-support07_tori"$Dir_TelportA = 2$Pic_TelportB = "199-support07_tori"$Dir_TelportB = 6$Eve_Control = 18 #是否要關閉自動回復地圖上的事件的開關編號#======================================================class Game_Character attr_accessor :id # ID attr_accessor :tel # IDendclass Eve_To_Map def initialize(x, y, map_id, eve_id) map = load_data(sprintf("Data/Map%03d.rxdata", map_id)) for i in 200..300 if $game_map.events[i] == nil $game_map.events[i] = Game_Event.new($game_map.map_id, map.events[eve_id]) $game_map.events[i].moveto(x,y) $game_map.events[i].id=i $scene.spriteset.dispose $scene.spriteset = Spriteset_Map.new break end end endendclass Game_Event < Game_Character attr_accessor :erased # erased def set_as_exp(value,eve_id) @through = false @direction_fix = true @character_name = $Pic_EXP @pattern=0 @opacity=255 @direction=$Dir_EXP @page.list=[RPG::EventCommand.new(315,0,[0,0,0,value]),RPG::EventCommand.new(355,0,["Dis_A_Eve.new("+eve_id.to_s+")"]),RPG::EventCommand.new(0,0,[])] @list=[RPG::EventCommand.new(315,0,[0,0,0,value]),RPG::EventCommand.new(355,0,["Dis_A_Eve.new("+eve_id.to_s+")"]),RPG::EventCommand.new(0,0,[])] @skippabel=false @trigger = 0 @step_anime=false @walk_anime=false @move_frequency=3 @move_speed=3 @move_type=0 @name=value.to_s + "EXP" @always_on_top=false @interpreter = nil end def set_as_money(value,eve_id) @through = false @direction_fix = true @character_name = $Pic_Money @pattern=0 @opacity=255 @direction=$Dir_Money @page.list=[RPG::EventCommand.new(125,0,[0,0,value]),RPG::EventCommand.new(355,0,["Dis_A_Eve.new("+eve_id.to_s+")"]),RPG::EventCommand.new(0,0,[])] @list=[RPG::EventCommand.new(125,0,[0,0,value]),RPG::EventCommand.new(355,0,["Dis_A_Eve.new("+eve_id.to_s+")"]),RPG::EventCommand.new(0,0,[])] @skippabel=false @trigger = 0 @step_anime=false @walk_anime=false @move_frequency=3 @move_speed=3 @move_type=0 @name=value.to_s + $data_system.words.gold @always_on_top=false @interpreter = nil end def set_as_variables(variables_id,value,eve_id) @through = false @direction_fix = true @character_name = $Pic_Variables @pattern=0 @opacity=255 @direction=$Dir_Variables @page.list=[RPG::EventCommand.new(315,0,[variables_id,variables_id,1,0,value,0]),RPG::EventCommand.new(355,0,["Dis_A_Eve.new("+eve_id.to_s+")"]),RPG::EventCommand.new(0,0,[])] @list=[RPG::EventCommand.new(315,0,[variables_id,variables_id,1,0,value,0]),RPG::EventCommand.new(355,0,["Dis_A_Eve.new("+eve_id.to_s+")"]),RPG::EventCommand.new(0,0,[])] @skippabel=false @trigger = 0 @step_anime=false @walk_anime=false @move_frequency=3 @move_speed=3 @move_type=0 @name=value.to_s @always_on_top=false @interpreter = nil end def set_as_item(item_id,eve_id) @through = false#true @direction_fix = true @character_name = $Pic_Item @pattern=0 @opacity=255 @direction=$Dir_Item @page.list=[RPG::EventCommand.new(126,0,[item_id,0,0,1]),RPG::EventCommand.new(355,0,["Dis_A_Eve.new("+eve_id.to_s+")"]),RPG::EventCommand.new(0,0,[])] @list=[RPG::EventCommand.new(126,0,[item_id,0,0,1]),RPG::EventCommand.new(355,0,["Dis_A_Eve.new("+eve_id.to_s+")"]),RPG::EventCommand.new(0,0,[])] @skippabel=false @trigger = 0 @step_anime=false @walk_anime=false @move_frequency=3 @move_speed=3 @move_type=0 @name=$data_items[item_id].name @always_on_top=false @interpreter = nil end def set_as_telport_a @through = true @direction_fix = true @character_name = $Pic_TelportA @pattern=0 @opacity=255 @direction=$Dir_TelportA @page.list=[RPG::EventCommand.new(101,0,["沒有對應傳送點!"]),RPG::EventCommand.new(0,0,[])] @list=[RPG::EventCommand.new(101,0,["沒有對應傳送點!"]),RPG::EventCommand.new(0,0,[])] @skippabel=false @trigger = 1 @step_anime=true @walk_anime=false @move_frequency=3 @move_speed=3 @move_type=0 @name="傳送點" @always_on_top=false @interpreter = nil end def set_as_telport_b(tox,toy) @through = true @direction_fix = true @character_name = $Pic_TelportA @pattern=0 @opacity=255 @direction=$Dir_TelportB @page.list=[RPG::EventCommand.new(201,0,[0,$game_map.map_id,tox,toy,0,1]),RPG::EventCommand.new(0,0,[])] @list=[RPG::EventCommand.new(201,0,[0,$game_map.map_id,tox,toy,0,1]),RPG::EventCommand.new(0,0,[])] @skippabel=false @trigger = 1 @step_anime=true @walk_anime=false @move_frequency=3 @move_speed=3 @move_type=0 @name="傳送點" @always_on_top=false @interpreter = nil endendclass Telport_To_Map_A def initialize(set = 1) if $game_map.Telport_A[$game_map.map_id] != nil $game_temp.message_text = "你已經設過了起點!" return end if !$game_player.passable?($game_player.x, $game_player.y, $game_player.direction) $game_temp.message_text = "前面無法放傳送點!" return end for i in 200..300 if $game_map.events[i] == nil x=$game_player.x y=$game_player.y if $game_player.direction==2 y += 1 elsif $game_player.direction==4 x -= 1 elsif $game_player.direction==6 x += 1 elsif $game_player.direction==8 y -= 1 end $game_map.events[i] = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events[i].id=i $game_map.events[i].set_as_telport_a $game_map.events[i].tel = 1 $game_map.Telport_A[$game_map.map_id]=i if set == 1 $scene.spriteset.push_eve(i) end break end end endendclass Telport_To_Map_B def initialize(set = 1) if $game_map.Telport_A[$game_map.map_id] == nil $game_temp.message_text = "你還沒設起點!" return end if !$game_player.passable?($game_player.x, $game_player.y, $game_player.direction) $game_temp.message_text = "前面無法放傳送點!" return end for i in 200..300 if $game_map.events[i] == nil x=$game_player.x y=$game_player.y if $game_player.direction==2 y += 1 elsif $game_player.direction==4 x -= 1 elsif $game_player.direction==6 x += 1 elsif $game_player.direction==8 y -= 1 end $game_map.events[i] = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events[i].id=i $game_map.events[i].set_as_telport_b($game_map.events[$game_map.Telport_A[$game_map.map_id]].x,$game_map.events[$game_map.Telport_A[$game_map.map_id]].y) $game_map.events[$game_map.Telport_A[$game_map.map_id]].set_as_telport_b($game_map.events[i].x,$game_map.events[i].y) $game_map.events[i].tel = 1 $game_map.Telport_A[$game_map.map_id]=nil if set == 1 $scene.spriteset.push_eve(i) end break end end endendclass Telport_To_Map_A_xy def initialize(x,y,set = 1) if $game_map.Telport_A[$game_map.map_id] != nil $game_temp.message_text = "你已經設過了起點!" return end for i in 200..300 if $game_map.events[i] == nil $game_map.events[i] = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events[i].id=i $game_map.events[i].set_as_telport_a $game_map.events[i].tel = 1 $game_map.Telport_A[$game_map.map_id]=i if set == 1 $scene.spriteset.push_eve(i) end break end end endendclass Telport_To_Map_B_xy def initialize(x,y,set = 1) if $game_map.Telport_A[$game_map.map_id] == nil $game_temp.message_text = "你還沒設起點!" return end for i in 200..300 if $game_map.events[i] == nil $game_map.events[i] = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events[i].id=i $game_map.events[i].set_as_telport_b($game_map.events[$game_map.Telport_A[$game_map.map_id]].x,$game_map.events[$game_map.Telport_A[$game_map.map_id]].y) $game_map.events[$game_map.Telport_A[$game_map.map_id]].set_as_telport_b($game_map.events[i].x,$game_map.events[i].y) $game_map.events[i].tel = 1 $game_map.Telport_A[$game_map.map_id]=nil if set == 1 $scene.spriteset.push_eve(i) end break end end endendclass Throw_Item_To_Map def initialize(item_id, set = 1) if $game_party.item_number(item_id)>0 if !$game_player.passable?($game_player.x, $game_player.y, $game_player.direction) $game_temp.message_text = "前面無法放東西!" return end $game_party.gain_item(item_id, -1) for i in 200..300 if $game_map.events[i] == nil x=$game_player.x y=$game_player.y if $game_player.direction==2 y += 1 elsif $game_player.direction==4 x -= 1 elsif $game_player.direction==6 x += 1 elsif $game_player.direction==8 y -= 1 end $game_map.events[i] = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events[i].id=i $game_map.events[i].set_as_item(item_id,i) if set == 1 $scene.spriteset.push_eve(i) end break end end end endendclass Throw_Item_To_Map2 def initialize(item_id, set = 1) if $game_party.item_number(item_id)>0 $game_party.gain_item(item_id, -1) for i in 200..300 if $game_map.events[i] == nil x=$game_player.x y=$game_player.y $game_map.events[i] = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events[i].id=i $game_map.events[i].set_as_item(item_id,i) if set == 1 $scene.spriteset.push_eve(i) end break end end end endendclass Throw_Money_To_Map2 def initialize(value, set = 1) if $game_party.gold > value $game_party.gain_gold(value) for i in 200..300 if $game_map.events[i] == nil x=$game_player.x y=$game_player.y $game_map.events[i] = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events[i].id=i $game_map.events[i].set_as_item_money(value,i) if set == 1 $scene.spriteset.push_eve(i) end break end end end endendclass Throw_Money_To_Map def initialize(value, set = 1) if $game_party.gold > value if !$game_player.passable?($game_player.x, $game_player.y, $game_player.direction) $game_temp.message_text = "前面無法放東西!" return end $game_party.gain_gold(value) for i in 200..300 if $game_map.events[i] == nil x=$game_player.x y=$game_player.y if $game_player.direction==2 y += 1 elsif $game_player.direction==4 x -= 1 elsif $game_player.direction==6 x += 1 elsif $game_player.direction==8 y -= 1 end $game_map.events[i] = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events[i].id=i $game_map.events[i].set_as_item_money(value,i) if set == 1 $scene.spriteset.push_eve(i) end break end end end endendclass Variables_To_Map def initialize(variables_id,value, x,y,set = 1) for i in 200..300 if $game_map.events[i] == nil $game_map.events[i] = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events[i].id=i $game_map.events[i].set_as_variables(variables_id,value,i) if set == 1 $scene.spriteset.push_eve(i) end break end end endendclass Item_To_Map def initialize(item_id, x,y,set = 1) for i in 200..300 if $game_map.events[i] == nil $game_map.events[i] = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events[i].id=i $game_map.events[i].set_as_item(item_id,i) if set == 1 $scene.spriteset.push_eve(i) end break end end endendclass Money_To_Map def initialize(value, x,y,set = 1) for i in 200..300 if $game_map.events[i] == nil $game_map.events[i] = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events[i].id=i $game_map.events[i].set_as_money(value,i) if set == 1 $scene.spriteset.push_eve(i) end break end end endendclass EXP_To_Map def initialize(value, x,y,set = 1) for i in 200..300 if $game_map.events[i] == nil $game_map.events[i] = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events[i].id=i $game_map.events[i].set_as_exp(value,i) if set == 1 $scene.spriteset.push_eve(i) end break end end endendclass Game_Map attr_accessor :SEve attr_accessor :Telport_A alias initialize_seve initialize def initialize @SEve=[0] @Telport_A=[0] initialize_seve end alias update_seve update def update if $game_map.need_refresh end update_seve endendclass Save_Eve def initialize $game_map.SEve[$game_map.map_id]=[0] for i in 200..300 if $game_map.events[i] != nil if !$game_map.events[i].erased $game_map.SEve[$game_map.map_id][i-200] = $game_map.events[i] end end end endendclass Load_Eve def initialize if $game_map.SEve[$game_map.map_id]!=nil for i in 0..200 if $game_map.SEve[$game_map.map_id][i] != nil and $game_map.SEve[$game_map.map_id][i] != 0 $game_map.events[i+200]=$game_map.SEve[$game_map.map_id][i] $scene.spriteset.push_eve(i+200) end end end endendclass Dis_A_Eve def initialize(eve_id) if $game_map.events[eve_id] != nil $game_map.events[eve_id].erase end endendclass Dis_Telport_Eve def initialize for i in 200..300 if $game_map.events[i] != nil if $game_map.events[i].tel=1 $game_map.events[i].erase end end end endendclass Dis_Eve def initialize for i in 200..300 if $game_map.events[i] != nil $game_map.events[i].erase end end endendclass Interpreter alias command_201_seve command_201 def command_201 if !$game_switches[$Eve_Control] Save_Eve.new end command_201_seve endendclass Scene_Map attr_accessor :spriteset alias transfer_player_seve transfer_player def transfer_player transfer_player_seve if !$game_switches[$Eve_Control] Load_Eve.new end# $Jdll.call("$MOVM"+$game_map.map_id.to_s+" "+$game_player.x.to_s+" "+$game_player.y.to_s+" "+$game_player.direction.to_s+" "+$game_player.move_speed.to_s+" "+$game_player.character_name )# $Send_Msg_Map="$MOVM"$game_map.map_id.to_s+" "+$game_player.x+" "+$game_player.y+" "++$game_player.direction endendclass Spriteset_Map def push_eve(i) sprite = Sprite_Character.new(@viewport1, $game_map.events[i]) @character_sprites.push(sprite) endendclass Game_Character attr_accessor :to_x attr_accessor :to_y end复制代码
复制代码.
可以扔物品,不過這介面要自己寫....我只提供方法....
物品丟棄完成!
置設傳送點A
置設傳送點B
怪物來了!!快跑!!
呼~逃走了~
附上範例工程: ARPG腳本是愚零武鬥多提供的,不過已經被我大幅修改了
本帖来自P1论坛作者joe5491,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:
https://rpg.blue/forum.php?mod=viewthread&tid=304023 若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。