Oscar Senior
Posts : 830 Thanked : 13 Engine : RMVX Skill : Beginner Type : Writer
| Subyek: [ReQ]Level Restriction Script 2009-11-09, 21:55 | |
| Kalo boleh minta bantuan lagi, ada yang bisa buatin script " level restriction" untuk RMVX ? kasusnya seperti ini: Actor hanya bisa menggunakan equipment tertentu jika sudah mencapai suatu lvl. contoh: Ralph yang masih lvl 5, bisa membawa Iron Sword tapi tidak bisa membawa Mithril Sword untuk lvl 25. Mungkin ada para scripter disini bisa membantu, atau mungkin bagi-bagi link buat script ini ? Thx, sebelumnya. nb: jika ada kesalahan penempatan thread mohon dipindahkan dan mohon saia diperingatkan | |
|
CrimsonSeas Novice
Posts : 106 Thanked : 9 Engine : RMVX
| Subyek: Re: [ReQ]Level Restriction Script 2009-11-09, 22:11 | |
| Nih kk hasilnya, tp harus pake script tambahan TagNote buatan Queex Ini TagNote-nya (credits to Queex): - Spoiler:
- Code:
-
############### # TagNote # ###################################################################### # Version 2.0 # # Author: Queex # # Licence: Creative Commons non-commercial attributive # ###################################################################### # Allows the easy use of tags in the note field for # # objects to store data. Syntax is simple, and the system ignores # # any lines in the notes field that don't match the syntax. # # # # Version history: # # 1.2 Final 1.x version # # 2.0 Changed to follow Ruby naming conventions # # # # Usage: # # get_tag(<notes field>,<tag name>) # # has_tag?(<notes field>,<tag name>) # # has_tag_value?(<notes field>,<tag name>,<tag value>) # # get_additional_tag(<notes field>,<tag name>,<index> # # get_additional_tag_by_value(<notes field>,<tag name>,<tag value> # # ,<index> # # # # Syntax in the note field: # # <tag_name tag_value> # # <tag_name> # # <tag_name tag_value param1 param2 ...> # ######################################################################
module TAGNOTE
########### # get_tag # ################################################################### # Gets the stored value of the first occurrence of the named tag # # in the notes field. # # <tag_name tag_value tag_value2> will return 'tag_value' # # <tag_name tag_value> will return 'tag_value' # # <tag_name> will return true # # if no tag with tag_name, returns nil # ################################################################### def get_tag(note_field, tag_name) lines=note_field.split("\n") for line in lines #process line by line if line[0,1].eql?("<") #this line has a tag line2=line.split(/[<> ]/) if line2[1].eql?(tag_name) if(line2.length==2) #there is actually no value return true else return line2[2] end end end end return nil end
############ # has_tag? # ################################################################## # Indicates whether the given note field has a tag of that name. # # <tag_name tag_value tag_value2> and # # <tag_name tag_value> and # # <tag_name> will both return true # # if no tag with tag_name, returns false # ################################################################## def has_tag?(note_field,tag_name) lines=note_field.split("\n") for line in lines if line[0,1].eql?("<") line2=line.split(/[<> ]/) if line2[1].eql?(tag_name) return true end end end return false end
################## # has_tag_value? # ################################################################# # Indicates whether the note field has a tag of a given name # # with a certain value. # # <tag_name tag_value> returns true # # <tag_name wrong_tag_value> returns false # # <tag_name> returns false # # if no tag with tag_name has the correct value, returns false. # # tag_value2 is ignored # ################################################################# def has_tag_value?(note_field,tag_name,tag_value) lines=note_field.split("\n") for line in lines if line[0,1].eql?("<") line2=line.split(/[<> ]/) if line2[1].eql?(tag_name) and line2[2].eql?(tag_value) return true end end end return false end
###################### # get_additional_tag # ###################################################################### # Gets additional parameters for a tag of a given name. # # Calling with an index of 1 returns # # the first value after the tag name. # # Returns nil if the index is higher than the last parameter. # # Returns false if no match for the tag name is found. # ###################################################################### def get_additional_tag(note_field,tag_name,index) lines=note_field.split("\n") for line in lines if line[0,1].eql?("<") line2=line.split(/[<> ]/) if line2[1].eql?(tag_name) if(line2.length<index+2) #Actually no value to get return nil else return line2[index+1] end end end end return false end
############################### # get_additional_tag_by_value # ###################################################################### # Gets additional parameters for a tag of a given name # # with a certain value. Calling with an index of 1 returns # # the first value after the tag name. # # Returns nil if the index is higher than the last parameter. # # Returns false if no match for the tag name and tag value is found. # ###################################################################### def get_additional_tag_by_value(note_field,tag_name,tag_value,index) lines=note_field.split("\n") for line in lines if line[0,1].eql?("<") line2=line.split(/[<> ]/) if line2[1].eql?(tag_name) and line2[2].eql?(tag_value) if(line2.length<index+2) #Actually no value to get return nil else return line2[index+1] end end end end return false end
end
Nah ini Script buat level restictionnya: - Spoiler:
- Code:
-
#============================================================================= #Weapon level restriction script #By: CrimsonSeas #Credits to: Queex for the TagNote #============================================================================= #Once again a request at RMID, this script can be used to give equipments #a required level to be equipped #This version disables the unequippable equipment to be equipped, but once the #level requirement is met, the equipment can be equipped. #============================================================================= #INSTRUCTIONS(IMPORTANT!!) #To define an equipments level requirement, please write this line to the note #box: #<level_req x> #where x is the requirement level. #============================================================================= module RPG class Weapon include TAGNOTE def level_requirement return 0 unless has_tag?(self.note, "level_req") return get_tag(self.note, "level_req").to_i end end class Armor include TAGNOTE def level_requirement return 0 unless has_tag?(self.note, "level_req") return get_tag(self.note, "level_req").to_i end end end
class Scene_Equip def update_item_selection if Input.trigger?(Input::B) Sound.play_cancel @equip_window.active = true @item_window.active = false @item_window.index = -1 elsif Input.trigger?(Input::C)&& @actor.level >= @item_window.item.level_requirement Sound.play_equip @actor.change_equip(@equip_window.index, @item_window.item) @equip_window.active = true @item_window.active = false @item_window.index = -1 @equip_window.refresh for item_window in @item_windows item_window.refresh end elsif Input.trigger?(Input::C) && @actor.level < @item_window.item.level_requirement Sound.play_buzzer end end end
class Window_EquipItem def enable?(item) return true if @actor.level >= item.level_requirement return false end end
| |
|
Oscar Senior
Posts : 830 Thanked : 13 Engine : RMVX Skill : Beginner Type : Writer
| Subyek: Re: [ReQ]Level Restriction Script 2009-11-09, 23:16 | |
| wow, seems helpful.
Tq ya kk CrimsonSeas | |
|
Sponsored content
| Subyek: Re: [ReQ]Level Restriction Script | |
| |
|