Howdy my beloved forumers! For those who already know me, I'm making a game using a card game script, I have modified the original script severely. I have included more locations besides the originals presented on the script (graveyard, hand and deck/stack). I have added locations like Banish, Field, Extra Deck, etc. To make it more loyal to the original yugioh card game. Now, I'm struggling a little trying to create a method to constantly update the battle to watch if a card is in a currently location, and based on that, add the correspondent state. So for example:
Let's say I use the card Dark Magician. Dark Magician is now in the location "Field". While the Field location has a monster card on it, it should add that actor a state that correspond to Dark Magician.
To make it simple, I decided to make the monsters on the same skill id that the corresponding state.
So the Skill ID 58 if it is Dark Magician, there would be a state ID 58 which is also Dark Magician.
So far, so simple. Isn't?
Now, I'm pretty sure I could add a def method on the card game script to check constantly during the battle the location of the cards, and add an state to that actor based on the location of said card/skill. But I can't figure out 2 things:
1) In which class should I add this method?
2) How should I code this method?
I know that most method should be called some way, but I'm also sure that there should be some kind of method that check constantly the flow of the battle without being call every action. But I'm not sure how.
This is what I came with so far:
First, I choose the class Scene_Battle < Scene_Base to create this method.
Now the method was this one:
But so far, this method is not doing anything. Nor good, nor bad. Is not crashing the game, is mostly not doing anything. I'm pretty sure that's because there's nothing calling this method constantly. That's why I tried with the "update" method. But it doesn't do anything. Also tried with a "while". Anyways, I'm sure I'm not doing the things right. That's why I'm recurring to you guys. Thanks in advance and sorry if I wasn't very clear with my explanations!
Let's say I use the card Dark Magician. Dark Magician is now in the location "Field". While the Field location has a monster card on it, it should add that actor a state that correspond to Dark Magician.
To make it simple, I decided to make the monsters on the same skill id that the corresponding state.
So the Skill ID 58 if it is Dark Magician, there would be a state ID 58 which is also Dark Magician.
So far, so simple. Isn't?
Now, I'm pretty sure I could add a def method on the card game script to check constantly during the battle the location of the cards, and add an state to that actor based on the location of said card/skill. But I can't figure out 2 things:
1) In which class should I add this method?
2) How should I code this method?
I know that most method should be called some way, but I'm also sure that there should be some kind of method that check constantly the flow of the battle without being call every action. But I'm not sure how.
This is what I came with so far:
First, I choose the class Scene_Battle < Scene_Base to create this method.
Now the method was this one:
Ruby:
def def state_monster_field
@field.each do |monster|
monster = skill.id
@actor.add_state(monster)
update
end
end
But so far, this method is not doing anything. Nor good, nor bad. Is not crashing the game, is mostly not doing anything. I'm pretty sure that's because there's nothing calling this method constantly. That's why I tried with the "update" method. But it doesn't do anything. Also tried with a "while". Anyways, I'm sure I'm not doing the things right. That's why I'm recurring to you guys. Thanks in advance and sorry if I wasn't very clear with my explanations!