Blizzy
me = Scripter.new("Noob")
- 492
- Posts
- 20
- Years
- Age 35
- ~The Netherlands~
- Seen Sep 2, 2007
i was thinking of using an array for attackBudgie_boy said:It's only what I have so far>>>
You only need to do that once I think...
If you want more than one pok?mon you have to add:
Attr_Accessor : Party_Number #Slot number in party (1-6)
You'll also need to add below each attack variable:
Attr_Accessor : Attack_Power #Power of attack (out of 100)
Attr_Accessor : Attack_Accuracy #Accuracy of attack (out of 100)
Code:
class CBS_Instances
attr_accessor :attack
def initialize
@attack = [ attack_id , pp , max_pp, type , power, accuracy ]
end
end
Code:
@instances = CBS_Instances.new
@instances.attack[0] # => attack id
@instances.attack[1] # => current pp
@instances.attack[2] # => maximum pp
@instances.attack[3] # => type attack
@instances.attack[4] # => attack power
@instances.attack[5] # => attack accuracy
or use a Struct, which is a bit harder to use
Code:
Attack = Struct.new( 'Attack' , :pp, :max_pp, :type , :power, :accuracy )
$attack = Attack.new(20, 20, 'Fire', 50, 100)
$attack[0] # => returns pp 20
$attack[:pp] # => pp 20
$attack['pp'] # => pp 20
$attack[1] # => maxpp 20
$attack[2] # => type fire
$attack[3] # => power 50
$attack[4] # => accuracy 100
Last edited: