- Joined
- Nov 4, 2014
- Messages
- 2
- Reaction score
- 0
- First Language
- English
- Primarily Uses
Hey Guys,
I've got a question which might have a very simple answer, but I've been stuck on this problem for a while now.
I want to add a data field for every actor which tracks how many of a certain troop they have killed.
I don't want use variables to track it since it gets messy very quickly with several actor and several enemy types, so I've resorted to notetagging.
This is what I have so far:
class RPG::Actordef slainif @note =~ /<slain (.)>/i@slain = $1.to_ielsereturn 0endendendThis works fine. I can assign the field $data_actors[1].slain to a variable and it will show me the correct value. Changing the value of
$data_actors[1].slain doesn't seem to work. When I try:
$data_actors[1].slain += 1It shows me this error:
undefined method 'slain=' for #<RPG:Actor......>I thought $data_actors[1].slain was an integer? Why would '=' not be defined?
If anyone knows how to increment $data_actors[1].slain, I'd be very grateful for their help.
Thank You,
Beiben.
I've got a question which might have a very simple answer, but I've been stuck on this problem for a while now.
I want to add a data field for every actor which tracks how many of a certain troop they have killed.
I don't want use variables to track it since it gets messy very quickly with several actor and several enemy types, so I've resorted to notetagging.
This is what I have so far:
class RPG::Actordef slainif @note =~ /<slain (.)>/i@slain = $1.to_ielsereturn 0endendendThis works fine. I can assign the field $data_actors[1].slain to a variable and it will show me the correct value. Changing the value of
$data_actors[1].slain doesn't seem to work. When I try:
$data_actors[1].slain += 1It shows me this error:
undefined method 'slain=' for #<RPG:Actor......>I thought $data_actors[1].slain was an integer? Why would '=' not be defined?
If anyone knows how to increment $data_actors[1].slain, I'd be very grateful for their help.
Thank You,
Beiben.
Last edited by a moderator:


