I'm running a dev game after having borrowed the basics from Actor Inventory (Roninator2), an addon to Hines Actor Inventory Script. The basic idea of that is to separate inventory gold by specific actors.
However, I've run into a small snag. I need to initiate a script call inside an event system, which causes both active actors (all party members) to lose half of their current gold. This means the lose_gold also needs to call on an in-game variable with predetermined values.
I have added some bits and pieces to the script, and made a specific call, but I don't have a means to test this readily. All I'm asking is, does it even look right?
class Game_Interpreter
def gain_gold(amount, actor_id)
$game_actors[actor_id].gain_gold(amount)
end
def lose_gold(amount, actor_id)
$game_actors[actor_id].lose_gold(amount)
end
def p1_lose_gold($game_variables[4941], actor_id)
$game_actors[actor_id].lose_gold($game_variables[4941])
end
def p2_lose_gold($game_variables[4942], actor_id)
$game_actors[actor_id].lose_gold($game_variables[4942])
end
end
>Control Variables: [4944:Isothermic Player1 Gold] = $game_actors[015].inventory_gold
>Control Variables: [4945:Isothermic Player2 Gold] = $game_actors[014].inventory_gold
>Control Variables: [4941:IsoPlayer1 Lose Gold] = Variable [4944:Isothermic Player1 Gold]
>Control Variables: [4942:IsoPlayer2 Lose Gold] = Variable [4945:Isothermic Player2 Gold]
>Control Variables: [4941:IsoPlayer1 Lose Gold] =/ 2
>Control Variables: [4942:IsoPlayer2 Lose Gold] =/ 2
>Script: p1_lose_gold($game_variables[4941], 015)
p2_lose_gold($game_variables[4942], 014)
The first 2 definitions are what already existed. I added the next 2 following this to the whole script within the same class. The idea is to define the function in which the specified actor loses gold based on a specific in-game variable, rather than "amount." However, I am unsure if this creates any issue with the arguments expected.
The second segment is the code execution, presently stored in a common event system to keep it organized and prevent it from running automatically if incorrectly made. Variable 4944 refers to the specific amount of gold of the 15th actor (which is the default in the project, as well as party leader). With the Hines script running natively, the build-in game function for determining actor gold doesn't seem to work correctly anymore, but even if it did, it only applies to the primary actor and doesn't account for other actors. So, the initial objective is to set 4944 and 4945 to interpret the specific gold of each actor in their respective inventories.
The next 2 control variables will actually become the "amount" of gold that is removed from the actor based on the functions added into the script. Since it is supposed to be based on [inventory gold / 2], the variable must first check and match the data of actor gold before dividing it by 2. Once done, the previous script is called, as shown above.
I predict I might not have it quite right, but cannot test it for a while with other scripts I am currently editing. It's also a unique idea for those learning along side me. This goal can be particularly useful if actor gold is an important factor of any game.
Thoughts?
Oh, and here is a copy of the original script I was working off of. Everything in green is what I tried to add.
Inventory Script
However, I've run into a small snag. I need to initiate a script call inside an event system, which causes both active actors (all party members) to lose half of their current gold. This means the lose_gold also needs to call on an in-game variable with predetermined values.
I have added some bits and pieces to the script, and made a specific call, but I don't have a means to test this readily. All I'm asking is, does it even look right?
class Game_Interpreter
def gain_gold(amount, actor_id)
$game_actors[actor_id].gain_gold(amount)
end
def lose_gold(amount, actor_id)
$game_actors[actor_id].lose_gold(amount)
end
def p1_lose_gold($game_variables[4941], actor_id)
$game_actors[actor_id].lose_gold($game_variables[4941])
end
def p2_lose_gold($game_variables[4942], actor_id)
$game_actors[actor_id].lose_gold($game_variables[4942])
end
end
>Control Variables: [4944:Isothermic Player1 Gold] = $game_actors[015].inventory_gold
>Control Variables: [4945:Isothermic Player2 Gold] = $game_actors[014].inventory_gold
>Control Variables: [4941:IsoPlayer1 Lose Gold] = Variable [4944:Isothermic Player1 Gold]
>Control Variables: [4942:IsoPlayer2 Lose Gold] = Variable [4945:Isothermic Player2 Gold]
>Control Variables: [4941:IsoPlayer1 Lose Gold] =/ 2
>Control Variables: [4942:IsoPlayer2 Lose Gold] =/ 2
>Script: p1_lose_gold($game_variables[4941], 015)
p2_lose_gold($game_variables[4942], 014)
The first 2 definitions are what already existed. I added the next 2 following this to the whole script within the same class. The idea is to define the function in which the specified actor loses gold based on a specific in-game variable, rather than "amount." However, I am unsure if this creates any issue with the arguments expected.
The second segment is the code execution, presently stored in a common event system to keep it organized and prevent it from running automatically if incorrectly made. Variable 4944 refers to the specific amount of gold of the 15th actor (which is the default in the project, as well as party leader). With the Hines script running natively, the build-in game function for determining actor gold doesn't seem to work correctly anymore, but even if it did, it only applies to the primary actor and doesn't account for other actors. So, the initial objective is to set 4944 and 4945 to interpret the specific gold of each actor in their respective inventories.
The next 2 control variables will actually become the "amount" of gold that is removed from the actor based on the functions added into the script. Since it is supposed to be based on [inventory gold / 2], the variable must first check and match the data of actor gold before dividing it by 2. Once done, the previous script is called, as shown above.
I predict I might not have it quite right, but cannot test it for a while with other scripts I am currently editing. It's also a unique idea for those learning along side me. This goal can be particularly useful if actor gold is an important factor of any game.
Thoughts?
Oh, and here is a copy of the original script I was working off of. Everything in green is what I tried to add.
Inventory Script