【脚本】多功能事件
因為上次發的腳本功能實在是太少了??!!所以這次重新寫了些沒人寫過的功能並整合?!(應該吧)
提供功能:扔物品、放置物品、丟錢、放置錢、放置經驗、置設傳送點、複製事件、刪除前面的這些東西
詳情看註解~
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_Characterattr_accessor :id # IDattr_accessor :tel # IDendclass Eve_To_Mapdef 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 == nil $game_map.events = Game_Event.new($game_map.map_id, map.events) $game_map.events.moveto(x,y) $game_map.events.id=i $scene.spriteset.dispose $scene.spriteset = Spriteset_Map.new break end end endendclass Game_Event < Game_Characterattr_accessor :erased # eraseddef 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(355,0,["Dis_A_Eve.new("+eve_id.to_s+")"]),RPG::EventCommand.new(0,0,[])] @list=),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 = nilenddef 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(355,0,["Dis_A_Eve.new("+eve_id.to_s+")"]),RPG::EventCommand.new(0,0,[])] @list=),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 = nilenddef 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(355,0,["Dis_A_Eve.new("+eve_id.to_s+")"]),RPG::EventCommand.new(0,0,[])] @list=),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 = nilenddef 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(355,0,["Dis_A_Eve.new("+eve_id.to_s+")"]),RPG::EventCommand.new(0,0,[])] @list=),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.name @always_on_top=false @interpreter = nilenddef 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(0,0,[])] @list=),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 = nilenddef 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(0,0,[])] @list=),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 = nilendendclass Telport_To_Map_Adef 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 == 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 = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events.id=i $game_map.events.set_as_telport_a $game_map.events.tel = 1 $game_map.Telport_A[$game_map.map_id]=i if set == 1 $scene.spriteset.push_eve(i) end break end endendendclass Telport_To_Map_Bdef 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 == 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 = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events.id=i $game_map.events.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.x,$game_map.events.y) $game_map.events.tel = 1 $game_map.Telport_A[$game_map.map_id]=nil if set == 1 $scene.spriteset.push_eve(i) end break end endendendclass Telport_To_Map_A_xydef 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 == nil $game_map.events = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events.id=i $game_map.events.set_as_telport_a $game_map.events.tel = 1 $game_map.Telport_A[$game_map.map_id]=i if set == 1 $scene.spriteset.push_eve(i) end break end endendendclass Telport_To_Map_B_xydef 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 == nil $game_map.events = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events.id=i $game_map.events.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.x,$game_map.events.y) $game_map.events.tel = 1 $game_map.Telport_A[$game_map.map_id]=nil if set == 1 $scene.spriteset.push_eve(i) end break end endendendclass Throw_Item_To_Mapdef 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 == 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 = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events.id=i $game_map.events.set_as_item(item_id,i) if set == 1 $scene.spriteset.push_eve(i) end break end end endendendclass Throw_Item_To_Map2def 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 == nil x=$game_player.x y=$game_player.y $game_map.events = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events.id=i $game_map.events.set_as_item(item_id,i) if set == 1 $scene.spriteset.push_eve(i) end break end end endendendclass Throw_Money_To_Map2def initialize(value, set = 1) if $game_party.gold > value $game_party.gain_gold(value) for i in 200..300 if $game_map.events == nil x=$game_player.x y=$game_player.y $game_map.events = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events.id=i $game_map.events.set_as_item_money(value,i) if set == 1 $scene.spriteset.push_eve(i) end break end end endendendclass Throw_Money_To_Mapdef 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 == 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 = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events.id=i $game_map.events.set_as_item_money(value,i) if set == 1 $scene.spriteset.push_eve(i) end break end end endendendclass Variables_To_Mapdef initialize(variables_id,value, x,y,set = 1) for i in 200..300 if $game_map.events == nil $game_map.events = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events.id=i $game_map.events.set_as_variables(variables_id,value,i) if set == 1 $scene.spriteset.push_eve(i) end break end endendendclass Item_To_Mapdef initialize(item_id, x,y,set = 1) for i in 200..300 if $game_map.events == nil $game_map.events = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events.id=i $game_map.events.set_as_item(item_id,i) if set == 1 $scene.spriteset.push_eve(i) end break end endendendclass Money_To_Mapdef initialize(value, x,y,set = 1) for i in 200..300 if $game_map.events == nil $game_map.events = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events.id=i $game_map.events.set_as_money(value,i) if set == 1 $scene.spriteset.push_eve(i) end break end endendendclass EXP_To_Mapdef initialize(value, x,y,set = 1) for i in 200..300 if $game_map.events == nil $game_map.events = Game_Event.new($game_map.map_id,RPG::Event.new(x,y)) $game_map.events.id=i $game_map.events.set_as_exp(value,i) if set == 1 $scene.spriteset.push_eve(i) end break end endendendclass Game_Mapattr_accessor :SEveattr_accessor :Telport_Aalias initialize_seve initializedef initialize @SEve= @Telport_A= initialize_seveendalias update_seve updatedef update if $game_map.need_refresh endupdate_seveendendclass Save_Evedef initialize $game_map.SEve[$game_map.map_id]= for i in 200..300 if $game_map.events != nil if !$game_map.events.erased $game_map.SEve[$game_map.map_id] = $game_map.events end end end endendclass Load_Evedef initialize if $game_map.SEve[$game_map.map_id]!=nil for i in 0..200 if $game_map.SEve[$game_map.map_id] != nil and $game_map.SEve[$game_map.map_id] != 0 $game_map.events=$game_map.SEve[$game_map.map_id] $scene.spriteset.push_eve(i+200) end end endendendclass Dis_A_Evedef initialize(eve_id) if $game_map.events != nil $game_map.events.erase end endendclass Dis_Telport_Evedef initialize for i in 200..300 if $game_map.events != nil if $game_map.events.tel=1 $game_map.events.erase end end endendendclass Dis_Evedef initialize for i in 200..300 if $game_map.events != nil $game_map.events.erase end end endendclass Interpreteralias command_201_seve command_201def command_201 if !$game_switches[$Eve_Control] Save_Eve.new end command_201_seveendendclass Scene_Mapattr_accessor :spritesetalias transfer_player_seve transfer_playerdef 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_Mapdef push_eve(i) sprite = Sprite_Character.new(@viewport1, $game_map.events) @character_sprites.push(sprite)endendclass Game_Characterattr_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在线咨询功能删除,谢谢。
页:
[1]