RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
[Resolved] Stealing, Math Help

0 Members and 1 Guest are viewing this topic.

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
So... I'm making an advanced Stealing Event system. I'm basically finished, I just need to find a suitable equation that the game should run through to determine if a player successfully steals from his target or not. I've downloaded several different Stealing Event systems and analyzed them all and not a single one of them holds up equally as efficient at a player's level 1 to a player's level 99. Each system I've looked at uses simple addition or subtraction to determine such things but I feel like that is totally not the way to go and that percentages will hold up a lot better. Now with this... I need help coming up with a suitable equation ._.

What I want it to be set on is a player's AGI vs enemy's AGI.

Please help ._.    
I'm going braindead
« Last Edit: June 03, 2009, 02:00:13 AM by grafikal009 »

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
I don't want to give you the formula, but you need three variables.

Average Party Agi
Average Enemy Agi

Determine how much greater(or less than) the player's agi is than the enemies'.

Throw in a random element, modify it based on the percent difference of the agi's, then see if it's greater than a constant.

Try something like that.

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
Yeah, I think I'll probably move along with using the Party's average AGI.

I don't think determining the Enemy Troop's average AGI is very efficient though. In VX you can have up to 8 enemies in a troop. In the event that the equation for determining an Enemy Troop's average AGI is EnemyAGI[1..8]/8 and you come across a troop with 8 enemies in it, then that is very accurate. However, if that's the equation, then what if you come across a troop with only 3 enemies in it? That's where the equation becomes screwy since 5 of the 8 enemy slots will be equal to 0, which I'm sure you know would significantly lower the outputted number for an average.

I could probably do something like making 8 different common events and having each one correspond to how many enemies are in a troop. So if there were 8 enemies in a troop, the 'steal' would call the common event pertaining to EnemyAGI[1..8]/8 whereas if there were 3 enemies in a troop, the 'steal' would then call the common event that pertains to EnemyAGI[1..3]/3.
My problem here then, is how do I get VX to recognize the difference between how many enemies are in a troop because VX conditionals don't check the number of enemies in a troop, but do check what enemy has appeared. (And I don't think using what enemies appear would work since there are infinite possibilities as to what combination of enemies you can have in a troop.)
Ideally, I'd like to have the skill 'Steal' call the common event that holds the conditional branches that check the number of enemies in a troop, then from there determine which new common event to call with the corresponding and correct equation in it.

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
Wait, scrap that idea.

Instead of average, just use the actor's agi and the target's.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Well, since there is a target to this, why have average enemy troop rather than the enemy targetted?

However, as far as I know, there is no way to grab in an event what enemy is targetted without a script, so maybe average of troop is best if you intend to avoid scripting in a whole

I would suggest you have a battle event in every troop that calculates enemy agi as soon as the battle starts. It's not hard, since you will know how many enemies are in the party. Average it then, and merely calculate steal w.r.t. that.

As for a formula, it depends on how you want the skill to evolve, which I don't know.

The easiest way is to random a number from 100, and then check if that number is < (Player Agi - Enemy Agi)

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
Ah. I see. I think that calculating a troop's average AGI inside of each battle event would work fine. It's mostly just copy/paste stuff anyways asides from changing the one number that divides the average. Also that way, I can maintain the same variable for each battle.

As far as the skill evolving. It essentially evolves as the player levels and their AGI increases. I'm just going to have to run some numbers through a few equations and see which ones hold up best from level 1 to 99 since I don't want the skill to be overpowered at a higher level than it is at a lower level. I would like to maintain a similar chance throughout without setting what the chance is every time (like just setting it at 50% at letting it go). Then of course I plan on including several items or accessories that increase the chance to steal. But that'll be added after I figure out what I'm going to do about the math.

Thanks for your help guys. :)

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
I have another question. Is there a way to change the Game_Enemy script (around lines 154-156), into a variable of some sort that I can track in game?

I want to try and make the variable amount of gold you can steal from an enemy equal to a percentage of the total gold that the enemy wields after being defeated.

Those lines are here:
Code: [Select]
#--------------------------------------------------------------------------
  # * Get Gold
  #--------------------------------------------------------------------------
  def gold
    return enemy.gold
  end

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
If VX works similiar to XP you can use a call script command and set an variable equal to the gold.

I can't help you there, since I don't have XP, I'm sure another scripter can give you the code.

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Yeah,

Code: [Select]
$game_variables[x] = $game_troop.members[y].gold

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
Wait, so if I place what you wrote there, in a call script, then Y is going to equal what exactly? What gold is that. Is that the enemy troops combined gold that'll be won at the end of a battle?
« Last Edit: May 16, 2009, 07:15:10 PM by grafikal009 »

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
X is the variable number you want the target's gold stored in. Y is the target number.

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
Oh, the ID within the troop? Alright. That sounds easy enough then. Very cool. This also sets well within still being an event system as well. Thanks for your help again guys!

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
Hmm... I was thinking... How does VX know what enemy you're targeting?

... I'm just...going to throw this out there, but in a conditional branch, would it be possible to use the script command in the conditional branch to check if
Code: [Select]
$data_enemies[1] = (whatever actor's target is)
?

My point, is... if this is possible... to do this 8 times in 1 common event. Essentially checking what you're targeting. This way the stealing system actually functions on whatever your target is instead of some average of a troop.

Cause then if my little
Code: [Select]
$game_enemies[1] = blah
, is true, then I would script command
Code: [Select]
$game_enemies[1].agi = $game_variables[x]
and then use X as my point to start calculating for the steal. (or actually, der, i could just set a variable = enemy 1 in the troop's agi...)

If it's false then it would just move to the next conditional branch checking if data_enemies2 is targeted and so on.

*(hoping that it is possible)*
« Last Edit: May 22, 2009, 08:34:31 AM by grafikal009 »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
It stores target in the action. So maybe:
Code: [Select]
$game_party.members[x].action.target_index

would return what you want. I can't say for sure though without testing. I don't know when it's cleared or anything. To test it, in the CE just put:

Code: [Select]
p $game_party.members[x].action.target_index

And see if it returns correctly.

If it does, then you could use conditionals, but you'd have to put a double equal, so:

Code: [Select]
$game_party.members[x].action.target_index == 1

etc...

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
Ohhhhhhhhh snap. Awesome.

So
Code: [Select]
$game_party.members[x].action.target_index == 1
is checking if the the current actor's skill or attack is targeting enemy ID 1 in the troop? correct? Or is that X to determine the actor and the number 1 is equal to the enemy's index of actor ID X's target?

So to check if actor X is targeting enemy 2, it would be that == 2?

I'll have to check this asap before I leave for Athens in a couple hours ._.  

edit: Oh and what's that 'p' for? nvm

edit2: ok so I got to testing it. I received this error:
Spoiler for:


I have this written in the condtional:
Code: [Select]
$game_party.members[1].action.target_index == 1

I get the same error when I test it alone with a common event here:
Code: [Select]
p $game_party.members[1].action.target_index

« Last Edit: May 22, 2009, 06:06:15 PM by grafikal009 »

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
Quick bump :)

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Well, the action has to exist. Which means you have to be taking an action and it has to be in battle. I can take aothe rlook at it sometime, but I don't remember getting an error when I first tried it out.

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
How would I set it up in a way that it is linked with an action? I just started a fresh project to check it out again.

I linked the first skill (Dual Attack) with a common event which has a script command with
Code: [Select]
p $game_party.members[1].action.target_index
in it.

The skill completes, damage is resolved, and then I get the same error.

Also to double check, I tried the conditional script inside of a conditional branch. It returned the same thing.

Am I using the script correctly by placing it in a common event and linking it with a skill?

Edit:: I attached the project, to show you how I have it. It's probably wrong  :-[
« Last Edit: June 03, 2009, 01:45:54 AM by grafikal009 »

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Yeah you would be, but I'm curious, how many actors are in your party?

The error is reporting that $game_party.members[1] is nil, which tells me you only have one actor in your party. That would cause the error. It should be $game_party.members[0]

********
Resource Artist
Rep:
Level 94
\\\\\
Project of the Month winner for June 2009
Haha, wow. I forgot it starts with 0 ._.

Well I checked it out. At this point I don't get an error. I just get a message that returns '0'. I figure that's from using
Code: [Select]
p $game_party.members[1].action.target_index

I just tried out the conditional branch instead using
Code: [Select]
$game_party.members[0].action.target_index == 0

and

it

worked! :D

I'm not sure how I could make this up to you :)
Thanks for all your help. I'm positive that this topic ... is finally resolved ._. lol

Also, I take it that the enemy ID's would range from 0..7?

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member