Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

2 Pages V   1 2 >  
Closed TopicStart new topic
> 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
   
Rpgx
post Oct 23 2005, 08:54 AM
Post #2


lolwut?
Group Icon

Group: Revolutionary
Posts: 924
Type: Event Designer
RM Skill: Undisclosed




Sweeeeet! Keep it up man! Awesome scripts! I love the Transparent one. Awesome!

Peace!


__________________________




I don't have a lot of userbars....
Go to the top of the page
 
+Quote Post
   
LocalScriptE
post Jan 23 2006, 05:14 AM
Post #3


Who's got the Bawlz? I've got the Bawlz!
Group Icon

Group: Member
Posts: 204
Type: Event Designer
RM Skill: Advanced




Could you put this up without the scroll bar?
It all comes up on ! line.
And the little "A" things make a syntax error


__________________________

-------------------------------------------------
My Art | Spectre Creations | Myspace | $learn.hack
Go to the top of the page
 
+Quote Post
   
Creepy
post Jan 23 2006, 03:17 PM
Post #4


Dark Lord
Group Icon

Group: Revolutionary
Posts: 1,817
Type: None
RM Skill: Skilled




Set your browser encoding as Unicode(UTF-8)
Go to the top of the page
 
+Quote Post
   
LocalScriptE
post Jan 24 2006, 04:52 AM
Post #5


Who's got the Bawlz? I've got the Bawlz!
Group Icon

Group: Member
Posts: 204
Type: Event Designer
RM Skill: Advanced




Thatks that worked


__________________________

-------------------------------------------------
My Art | Spectre Creations | Myspace | $learn.hack
Go to the top of the page
 
+Quote Post
   
Soku
post Jun 13 2006, 12:20 AM
Post #6


Level 7
Group Icon

Group: Member
Posts: 99
Type: Developer
RM Skill: Skilled




NOOOOO!!! the site doesnt work for the dmoe.. can we get a screeny or a fixed up demo pleasE?


__________________________
A far off memory, like a scattered dream...
A scattered dream, like a far off memory...
Go to the top of the page
 
+Quote Post
   
Quinn
post Jun 21 2006, 07:48 AM
Post #7


A dude who loves to play with the Bustersword!
Group Icon

Group: Member
Posts: 298
Type: Artist
RM Skill: Skilled




The link seems to be broken!


__________________________




You might think I am crazy, you might think I'm insane, but you can't say I'm stupid, that would be a shame.....
Go to the top of the page
 
+Quote Post
   
reaven
post Dec 28 2008, 05:04 PM
Post #8


Level 1
Group Icon

Group: Member
Posts: 7
Type: Developer
RM Skill: Beginner




O M F G this is what if been looking for about 2 weeks GREAT JOB keep it up m8!!!
Go to the top of the page
 
+Quote Post
   
reaven
post Jan 1 2009, 12:08 PM
Post #9


Level 1
Group Icon

Group: Member
Posts: 7
Type: Developer
RM Skill: Beginner




this doesnt work .........
i get syntax error at line 2
? attr_accessor :character_name

plz help
Go to the top of the page
 
+Quote Post
   
jens009
post Jan 1 2009, 01:06 PM
Post #10


L Did you know? Death gods... only eat apples
Group Icon

Group: +Gold Member
Posts: 2,976
Type: Scripter
RM Skill: Skilled




You have to delete every question mark (?) of the beginning of every line. These are extra characters that were created when the forum crashed.


__________________________

My RMXP Project:


Farewell RRR. =]
Go to the top of the page
 
+Quote Post
   
SpawnUchiha
post Jan 2 2009, 05:59 AM
Post #11


Level 5
Group Icon

Group: Member
Posts: 72
Type: Event Designer
RM Skill: Skilled




How'd you all download it?

EDIT: The Demo, not the Script.

This post has been edited by SpawnUchiha: Jan 2 2009, 06:01 AM
Go to the top of the page
 
+Quote Post
   
reaven
post Jan 3 2009, 06:35 AM
Post #12


Level 1
Group Icon

Group: Member
Posts: 7
Type: Developer
RM Skill: Beginner




thx for help but if got another problem = [
syntax error at line 180
$game_a_equipment[*ArmorID*] = Game_Equipment.new(*FileExtension*, *hue*)
plz help[again] ? = D
Go to the top of the page
 
+Quote Post
   
Faraway Life
post Mar 2 2009, 05:25 AM
Post #13


Level 1
Group Icon

Group: Member
Posts: 8
Type: Event Designer
RM Skill: Skilled




QUOTE (reaven @ Jan 3 2009, 02:35 PM) *
thx for help but if got another problem = [
syntax error at line 180
$game_a_equipment[*ArmorID*] = Game_Equipment.new(*FileExtension*, *hue*)
plz help[again] ? = D


Here, just copy and paste this. I took the liberty of removing all the question marks and correcting the last line you're having trouble with, it'll work now smile.gif

QUOTE
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


Also I've rigged up this lamp character set to work with it, if you need something to test it with... Just rename the file to 001-Fighter01-BronzeSword

This post has been edited by Faraway Life: Mar 2 2009, 05:27 AM
Attached File(s)
Attached File  lamp.PNG ( 2.83K ) Number of downloads: 95
 
Go to the top of the page
 
+Quote Post
   
kinloads
post Jun 29 2009, 04:05 AM
Post #14


Level 1
Group Icon

Group: Member
Posts: 11
Type: Artist
RM Skill: Masterful




hi, man this is a cool script but it doesnt work to me, can you create a new demo or fix a demo URL? i realy need that i creating online game smile.gif
Go to the top of the page
 
+Quote Post
   
davidjie
post Jun 29 2009, 09:54 PM
Post #15



Group Icon

Group: Member
Posts: 1
Type: Mapper
RM Skill: Beginner




i used that script but why when i test the game the character still didnt show the equipment ?
Go to the top of the page
 
+Quote Post
   
BlackStatic
post Jul 12 2009, 11:51 PM
Post #16


Level 2
Group Icon

Group: Member
Posts: 19
Type: Writer
RM Skill: Skilled




QUOTE (davidjie @ Jun 29 2009, 09:54 PM) *
i used that script but why when i test the game the character still didnt show the equipment ?

I've got a problem with line 35...

Script "Equipment" line 35: NoMethodError occurred.
undefined method `[]=' for NilClass

EDIT: Nevermind, I fixed it.

This post has been edited by BlackStatic: Jul 14 2009, 12:17 PM


__________________________
I'm a machine, but I'm a funny color...
Go to the top of the page
 
+Quote Post
   
Imsosupafly
post Aug 12 2009, 10:32 AM
Post #17


Level 2
Group Icon

Group: Member
Posts: 20
Type: Artist
RM Skill: Beginner




Does this only work for the main character? If so is it possible to make if for more? Lets say four characters in your party?
Go to the top of the page
 
+Quote Post
   
efeplaya35
post Aug 30 2009, 10:13 AM
Post #18


Level 1
Group Icon

Group: Member
Posts: 5
Type: None
RM Skill: Beginner




please Only 1 Working Demo ... Its hard??? mad.gif
Go to the top of the page
 
+Quote Post
   
Rik evil of fina...
post Dec 18 2009, 11:53 AM
Post #19


Level 1
Group Icon

Group: Member
Posts: 12
Type: Event Designer
RM Skill: Beginner




please anyone can give me the demo?
Go to the top of the page
 
+Quote Post
   
DreadOmen
post Jan 12 2010, 06:15 AM
Post #20


Level 1
Group Icon

Group: Member
Posts: 6
Type: Developer
RM Skill: Skilled




This somehow conflicts with Blizz ABS:

Script 'Blizz-ABS 2' line 1533: NoMethodError occurred.

undefined method `refresh' for nil:NilClass

When I took Visual Equipment off, the game worked just fine.

Anybody know how to fix this?


__________________________
Dread Lightly.
Go to the top of the page
 
+Quote Post
   

2 Pages V   1 2 >
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: 25th May 2013 - 05:33 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker