Jump to content
New account registrations are disabed. This website is now an archive. Read more here.
  • 0
neiljwd

Script to compare actors stats/parameters for a challenge system?

Question

Apologies, this may be a long post, and a confusing one, I'm very much a newb in abilities and knowledge of terms.

 

What I am wanting to achieve is comparison of multiple actors parameters/stats against anothers. IE Strength, Health, Intellect etc, all at the same time. For example:

 

Actor1's:   Agility + Brawn + Cunning  VS Actor 2's  Dexterity + Endurance + Fierceness  = ?

 

So I can have the Conditional Argument:

 IF A+B+C > D + E + F

Then Option 1

Else Option 2.

 

This would be on the normal game screen when just wondering about and talking to people.

I can not for the life of me figure out a simple way to do  this, beacuse I want  to do this for 25 fights - they  were going to be actors/party members for simplicitiy's sake.

 

So far I've got a LOT of Variables:

Actor1's Agility  =v1.   V1+ B = v2. v2+C = v3

Oppositions Dex = v4  v5+ E = v5  v6+F =v6

 

Then the challenge is if v3 is > v6 = Success, else Fail.

 

With 25 competitors (with 6 stats each not 3), and the fight progression I wish to employ it means storing 150ish variables. Seems like an excessively convulted way to do it. Is it the only way?

 

What I'm hoping is I can just call 2 scripts that reads something LIKE

$actor[1].hp + $actor[1].agi + $actor[1].HP = Variable 5

$party_actor[2].hp + $party_actor[2].pdef + $party_actor[2].mdef = Variable 6

Then a conditional   v5 vs v6.

I could then just put whoever im challenging as party member 2, and have those 2 script calls every time.

 

I've just no idea how to add multiple values to each other in a script call. Got NO idea.

 

Anyhoo anyone got anything to add on the matter? I realise it's a long and strange question and I ask more in hope than in expectation. I'll check here regularly for any responses, please press me for any further information u need.

Thank you. :)

Edited by neiljwd

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

You don't have to put the opponent in your party, just use $game_actors[actor_id] to access it, where actor_id is the actor id in the database.

Then you can use the built in functions to access it's stats:

a=$game_actors[actor_id] #For ease.

a.maxhp #Get max hp.

a.maxsp #Get max sp.

a.str       #Get strength.

a.dex     #Get dexterity.

a.agi      #Get agility.

a.int      #Get intelligence.

 

In the script editor you can make a script similar to this:

def compare(c_id, d_id)
  c=$game_actors[c_id]
  d=$game_actors[d_id]
  if c.str+c.dex>d.str+ d.agi
    return true
  else
    return false
  end
end

#This function compares the str and dex of the first actor against str and agi of the second.

 

Then in the event add a conditional branch with the script option, and call the function name with the id of the actors you want to compare. compare(1,2).

Share this post


Link to post
Share on other sites
  • 0

I don't think you would have to create/store all 150 variables.  As I understand the way the engine works, when you have your party fighting one of the other characters, you aren't fighting the actual 'actor' but an enemy version of that actor.  That being the case, you shouldn't have to specify individual actors.  Just specify that the $game_party.actor[@actor_id] traits have to be higher than the $game_troup.enemy[@enemy_id] traits.  The engine should fill in the id with whichever actors/enemies are in the party and/or event.  And if you're worried about the lack of specification causing it to use the system for all battles, not just certain ones, add a condition to where if __ is on, the script will apply, but if __ is off it wont.

 

 

 

 

(Disclaimer: I'm still learning RGSS so the code specifics may not be 100% accurate.)

Share this post


Link to post
Share on other sites
  • 0

Thank you for the response, :) however I've obviously phrased my opening post poorly. :dizzy: I'm not looking for anything to do with battles.

This is a challenge system to be used when just wondering round the normal game map and talking to people. To compare their stats, receive a number and then go from there.

 

Have realised though thanks to you that yes, it'll be easier to just move the opposition character to game_party.actor slot at the start of a conversation, then make a common Event that compares  $game_party.actor[0]  Variables against $game_party.actor[1] variables.

 

Is it possioble to do that? manually change an actors position within the party via an event?

Edited by neiljwd

Share this post


Link to post
Share on other sites
  • 0

the main thing I need to know is what are you trying to achieve with this "challenge system"? Is it purely for one character fighting another character/event to work out if the party can proceed like if your party is not developed enough then you "fail" the challenge and you get a game over event (meaning you need to train up some more before you can proceed,Kind of like a road block) or are you trying to create an evented fight system? 

 

I can help with both but to explain the way the event needs to work I need to know what your trying to accomplish :) also which engine are you using?

Share this post


Link to post
Share on other sites
  • 0

RMXP 1.04 RUBY 1.8.1 are my versions.

 

And yeah it's absolutely nothing to do with fighting at all :) It's just a walking around the game map  talking to people, (who are in your party) and comparing your stats to theirs. The reason is that it's like a gateway mechanic. If you meet that persons criteria, they'll teach you Move X for example. or have a conversation, Join your party. Many things, but only if you've levelled up the right stats.

Some people will want you to have high Str and Agi, others  SP and Intellect and so on.

 

Wouldn't result in a game over, just carry on and go off and train up some where.

Share this post


Link to post
Share on other sites
  • 0

should be nothing more than a simple conditional branch then checking whether Variable [X] = [Y], Variable X being the varable where the data is stored and Y being the value that X needs to be equal to or greater than :) 

 

if your checking multiple stats have a conditional branch inside the other conditional branch :)

Share this post


Link to post
Share on other sites
  • 0

Edit/Update:

 

Holy crud that's it! Thank you the script is so small and so simple looking, makes me feel very stupid, :huh2:  but I'm too happy to be sad about my own failings!

Cheers ever so much Saltome. Does everything I want. Truly you've inspired joy and relief in a stranger thousands of miles away, so thank you. :thumbsup:

My appreciation to FleshRender and phionabrie also, a little encouragement really helps when you're struggling.

 

If anyone wanted to compare to a party  member ID, not there actor ID,

Change one of the letters to game_party.actors instead of $game_actors

 

 

def compare1(c_id, d_id)
  c=$game_actors[c_id]
  d=$game_party.actors[d_id]
    if c.agi+c.dex>d.str+ d.dex
    return true
  else
    return false
  end
end

 

script call : compare1(1,3)

This would compare actorID 1 against party member number 4. (0,1,2,3)

Edited by neiljwd

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...