Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> Submission: Visual Equipment, by Prexus
Prexus
post Oct 15 2005, 03:32 AM
Post #1


Level 3
Group Icon

Group: Member
Posts: 31
Type: Event Designer
RM Skill: Masterful




Description
This script takes the equipment your character currently has equipped and shows graphics based on the equipment. If the equipment has no graphic setup, it won't show anything.

Note: This script does not work with the Caterpillar script (in that it won't show any but the lead character's equipment). Also, it may or may not conflict with the reflection/shadow scripts. This is untested.

How to Use
Find this line:
CODE
def game_equip_filler

Below it, you need to add a line for each item you have a visual equipment for:

For weapons, the line of code looks like this:
$game_w_equipment[WeaponID] = Game_Equipment.new(file_name, hue of characterset)

For armor, it looks like this:
$game_a_equipment[ArmorID] = Game_Equipment.new(file_name, hue of characterset)

So. For the Bronze Sword, for example, you'd put:
$game_w_equipment[1] = Game_Equipment.new("BronzeSword", 0)

Of course, file_name isn't just the name of the file. Since some charactersets are different sizes, I felt it necessary to make it so that things were characterset specific. For example, the character set image for the BronzeSword, if equipped by Arshes, would look like this:

001-Fighter01-BronzeSword.png

For Undead02, it'd look like this:

052-Undead02-BronzeSword.png

Of course, there will be duplicates of some images, if the characters are the same height, but this is a sacrifice for proper alignment of the sets.

For any additional information refer to the demo.

The Script

CODE


class Game_Equipment
attr_accessor :character_name
attr_accessor :character_hue
def initialize(character_name, character_hue)
@character_name = character_name
@character_hue = character_hue
end
end

class Game_Player < Game_Character
attr_accessor :equip_name
attr_accessor :equip_hue
def initialize
super
@equip_name = [nil, nil, nil, nil, nil] # 5 for 5 slots (weapon, shield, head, body, accessory)
@equip_hue = [0, 0, 0, 0, 0]
end
alias ve_player_refresh refresh
def refresh
ve_player_refresh
actor = $game_party.actors[0]
if actor != nil
if $game_w_equipment[actor.weapon_id] != nil
@equip_name[0] = actor.character_name.to_s + "-" + $game_w_equipment[actor.weapon_id].character_name.to_s
@equip_hue[0] = $game_w_equipment[actor.weapon_id].character_hue
end
if $game_a_equipment[actor.armor1_id] != nil
@equip_name[1] = actor.character_name.to_s + "-" + $game_a_equipment[actor.armor1_id].character_name.to_s
@equip_hue[1] = $game_a_equipment[actor.armor1_id].character_hue
end
if $game_a_equipment[actor.armor2_id] != nil
@equip_name[2] = actor.character_name.to_s + "-" + $game_a_equipment[actor.armor2_id].character_name.to_s
@equip_hue[2] = $game_a_equipment[actor.armor2_id].character_hue
end
if $game_a_equipment[actor.armor3_id] != nil
@equip_name[3] = actor.character_name.to_s + "-" + $game_a_equipment[actor.armor3_id].character_name.to_s
@equip_hue[3] = $game_a_equipment[actor.armor3_id].character_hue
end
if $game_a_equipment[actor.armor4_id] != nil
@equip_name[4] = actor.character_name.to_s + "-" + $game_a_equipment[actor.armor4_id].character_name.to_s
@equip_hue[4] = $game_a_equipment[actor.armor4_id].character_hue
end
end
end
end

class Sprite_Equipment < RPG::Sprite
attr_accessor :character
def initialize(viewport, slotid, character = nil)
super(viewport)
@character = character
@slot_id = slotid
update
end
def update
super
if @tile_id != @character.tile_id or
@character_name != @character.equip_name[@slot_id] or
@character_hue != @character.equip_hue[@slot_id]
@tile_id = @character.tile_id
@character_name = @character.equip_name[@slot_id]
@character_hue = @character.equip_hue[@slot_id]
if @tile_id >= 384
self.bitmap = RPG::Cache.tile($game_map.tileset_name,
@tile_id, @character.equip_name[@slot_id])
self.src_rect.set(0, 0, 32, 32)
self.ox = 16
self.oy = 32
else
self.bitmap = RPG::Cache.character(@character.equip_name[@slot_id],
@character.equip_hue[@slot_id])
@cw = bitmap.width / 4
@ch = bitmap.height / 4
self.ox = @cw / 2
self.oy = @ch
end
end
self.visible = (not @character.transparent)
if @tile_id == 0
sx = @character.pattern * @cw
sy = (@character.direction - 2) / 2 * @ch
self.src_rect.set(sx, sy, @cw, @ch)
end
self.x = @character.screen_x
self.y = @character.screen_y
self.z = @character.screen_z(@ch)
self.opacity = @character.opacity
self.blend_type = @character.blend_type
self.bush_depth = @character.bush_depth
if @character.animation_id != 0
animation = $data_animations[@character.animation_id]
animation(animation, true)
@character.animation_id = 0
end
end
end

class Spriteset_Map
def initialize
@viewport1 = Viewport.new(0, 0, 640, 480)
@viewport2 = Viewport.new(0, 0, 640, 480)
@viewport3 = Viewport.new(0, 0, 640, 480)
@viewport2.z = 200
@viewport3.z = 5000
@tilemap = Tilemap.new(@viewport1)
@tilemap.tileset = RPG::Cache.tileset($game_map.tileset_name)
for i in 0..6
autotile_name = $game_map.autotile_names[i]
@tilemap.autotiles[i] = RPG::Cache.autotile(autotile_name)
end
@tilemap.map_data = $game_map.data
@tilemap.priorities = $game_map.priorities
@panorama = Plane.new(@viewport1)
@panorama.z = -1000
@fog = Plane.new(@viewport1)
@fog.z = 3000
@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))
actor = $game_party.actors[0]
if $game_w_equipment[actor.weapon_id] != nil
@character_sprites.push(Sprite_Equipment.new(@viewport1, 0, $game_player))
end
if $game_a_equipment[actor.armor1_id] != nil
@character_sprites.push(Sprite_Equipment.new(@viewport1, 1, $game_player))
end
if $game_a_equipment[actor.armor2_id] != nil
@character_sprites.push(Sprite_Equipment.new(@viewport1, 2, $game_player))
end
if $game_a_equipment[actor.armor3_id] != nil
@character_sprites.push(Sprite_Equipment.new(@viewport1, 3, $game_player))
end
if $game_a_equipment[actor.armor4_id] != nil
@character_sprites.push(Sprite_Equipment.new(@viewport1, 4, $game_player))
end
@weather = RPG::Weather.new(@viewport1)
@picture_sprites = []
for i in 1..50
@picture_sprites.push(Sprite_Picture.new(@viewport2, $game_screen.pictures[i]))
end
@timer_sprite = Sprite_Timer.new
update
end
end

class Game_Party
alias ve_party_starting_members setup_starting_members
def setup_starting_members
ve_party_starting_members
$game_player.refresh
end
end

class Game_Actor
alias ve_actor_equip equip
def equip(equip_type, id)
ve_actor_equip(equip_type, id)
$game_player.refresh
end
end

class Game_System
alias ve_system_initialize initialize
def initialize
ve_system_initialize
$game_w_equipment = []
$game_a_equipment = []
game_equip_filler
end

# This is where you define new image files for the weapons/armor:
def game_equip_filler
# WEAPONS (*'d items need to be changed)
#$game_w_equipment[*WeaponID*] = Game_Equipment.new(*FileExtension*, *hue*)

# ARMORS (*'d items need to be changed)
$game_a_equipment[*ArmorID*] = Game_Equipment.new(*FileExtension*, *hue*)
end
end



The Demo

The Demo

Credits go to Prexus. Idea was inspired by the similar script by Rataime which went missing during a forum attack however all the code is original and unique to Prexus.</div>


__________________________
Go to the top of the page
 
+Quote Post
   

Posts in this topic
- Prexus   Submission: Visual Equipment   Oct 15 2005, 03:32 AM
- - Rpgx   Sweeeeet! Keep it up man! Awesome scripts...   Oct 23 2005, 08:54 AM
- - CREEPY   Set your browser encoding as Unicode(UTF-8)   Jan 23 2006, 03:17 PM
- - LocalScriptE   Thatks that worked   Jan 24 2006, 04:52 AM
- - Soku   NOOOOO!!! the site doesnt work for the...   Jun 13 2006, 12:20 AM
- - Quinn   The link seems to be broken!   Jun 21 2006, 07:48 AM
- - reaven   O M F G this is what if been looking for abo...   Dec 28 2008, 05:04 PM
- - reaven   this doesnt work ......... i get syntax error at l...   Jan 1 2009, 12:08 PM
- - jens009   You have to delete every question mark (?) of the ...   Jan 1 2009, 01:06 PM
- - SpawnUchiha   How'd you all download it? EDIT: The Demo, no...   Jan 2 2009, 05:59 AM
- - reaven   thx for help but if got another problem = [ synta...   Jan 3 2009, 06:35 AM
|- - Faraway Life   RE: Submission: Visual Equipment   Mar 2 2009, 05:25 AM
- - kinloads   hi, man this is a cool script but it doesnt work t...   Jun 29 2009, 04:05 AM
- - davidjie   i used that script but why when i test the game th...   Jun 29 2009, 09:54 PM
|- - BlackStatic   QUOTE (davidjie @ Jun 29 2009, 09:54 PM) ...   Jul 12 2009, 11:51 PM
- - Imsosupafly   Does this only work for the main character? If so ...   Aug 12 2009, 10:32 AM
- - efeplaya35   please Only 1 Working Demo ... Its hard???   Aug 30 2009, 10:13 AM
- - Rik evil of final fantasy   please anyone can give me the demo?   Dec 18 2009, 11:53 AM
- - DreadOmen   This somehow conflicts with Blizz ABS: Script ...   Jan 12 2010, 06:15 AM
- - BlackStatic   Hey, guys. I created a quick new demo for this scr...   Apr 16 2010, 04:11 PM
|- - dwellercoc   RE: Submission: Visual Equipment   May 5 2010, 07:18 AM
- - rebilacx   I get this error: Script 'Visual Equipment...   Jun 19 2010, 07:14 PM
- - nbrase   Cool it's a good script i tryi't and i li...   Mar 26 2011, 11:52 AM
- - Redjet30   dude, if people arent stupid its not hard, just ma...   Sep 23 2011, 02:30 PM
|- - Tsukihime   QUOTE (Redjet30 @ Sep 23 2011, 02:30 PM) ...   Sep 23 2011, 03:06 PM
|- - Night_Runner   QUOTE (Redjet30 @ Sep 24 2011, 08:30 AM) ...   Sep 24 2011, 05:58 AM
- - supercow   put: $game_temp.common_event_id = X #X ( bein...   Sep 23 2011, 04:53 PM
- - Tsukihime   map and equip scenes are logical places to put it,...   Sep 23 2011, 08:12 PM
- - supercow   sorry i dont use this so i cant really tell what t...   Sep 24 2011, 01:09 AM
- - Tsukihime   Hmm, I wonder how that would affect gameplay on sl...   Sep 24 2011, 04:42 PM
- - Night_Runner   There was an interesting article about the overhea...   Sep 25 2011, 05:33 AM


Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th June 2013 - 05:42 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker