Nearly Infinite
Member
Script Title: NI_SvD
This is my first time Requesting a Script. I'm still pretty green when it comes to Ruby, but I'm learning fast. I'll try to make this request as succinct as possible. Hopefully, once it's done, it'll help a whole lot more people than just little old me.
I'm looking for a Script that can be plugged into the Script radio button in the Conditional Branch section of the Event Editor, takes several inputs and returns a True or False depending on a comparison of the inputs versus a specified "Difficulty Number," also declared in the inputs. The function will require some form of Scripted random number generator whose result will be part of the process.
(One of the more difficult aspects of this Script, for me, is the random number generator. Not sure if Ruby has something already mocked up in its library files. If it does, awesome.)
For instance, the function placed within the Conditional Branch Event window might be something like this:
NI_stupid_script_request(actor_id, stat_id, class_id, class_id2, class_id3, difficulty_number, rand_span)*
•actor_id would be the number that identifies the actor. A 0 here indicates that you use the second input instead, class_id.
•class_id this should always be 0, unless actor_id is set to 0. In that case, it searches the current party for a member of the character class that matches the given number. If more than one exist, it associates with whoever has the higher stat_id (see below). If both have the same stat_id, it goes with whomever is higher level. IF BOTH ARE STILL THE SAME (not likely), it goes with whatever actor has the lowest numerical actor number. If both actor_id and class_id are set to 0, it randomly picks someone in the current party and ignores class_id2 and class_id3. If it is set > 0 but there's none in the party, automatically the function returns false.
•class_id2 this should always be 0, unless class_id > 0 and you want multiple options. It checks here first to see if there's anyone of class_id2 in the party before checking class_id. If there isn't a member of class_id2's specified class in the party, use class_id. If class_id = 0, class_id2 is ignored.
•class_id3 this should always be 0, unless class_id > 0 AND class_id2 > 0 and you want multiple options. It checks here first to see if there is a member of class_id3's specified class in the party, if not it goes on to class_id2, and so on. If class_id = 0, class_id3 is ignored.
•stat_id would be the specified actor or party member's stat taken into consideration, probably determined by a switch statement (switch as in C++ jargon, not a RMXP game switch :tongue: don't know what the Ruby jargon is for them). For instance, A = STR, B = DEX, etc etc.
•difficulty_number would be an integer, the target number to overcome (explained below)
•rand_span would be another integer, setting the range of random numbers used in the calculation (explained below). For instance, if rand_span was 20, the calculation would involve a random number from 1-20. If 100, a random number from 1-100, etc. The purpose of having this a variable set by the designer is because some games have radically different scales of values for STR and INT and whatnot, and having it a static 1-100 will probably skew the results. Anyway I'm getting ahead of myself...
The Script itself
Mind you, this is not intended to be actual script, it's an abstract. If I knew the syntax for all this, I wouldn't be making the request :scruff:
Line number On/Off | Expand/Contract | Select all
I hope my IF's and ELSE's are setup right. Ignore them if you get the gist of what I'm saying.
If all that looked like crazy nonsense:
The Script I'm looking for is a universal tool for establishing a Difficulty Number and linking an Event-based task to either a specific actor, or a specific character class in the party (with the option of listing up to 3 other classes, giving each a priority). The Script takes that character's relevant stat, combines it in some way with a random number, and then compares it to the Difficulty Number. If it is equal to or higher than the difficulty number, the function returns True. If not, False.
Anyone familiar with tabletop RPG's will intuitively see what I'm trying to do with this.
I realize this is simultaneously a monster to fathom for those with limited Script knowledge, yet at the same time something quite simple for those who Script on a regular basis. I apologize to both groups and would greatly appreciate any help in the matter.
If you concoct a similar script with slightly different parameters, I'd still like to see it and hear how it works. I might be able to do what I want with a modified version of this, but I thought I would try to construct it in a way that would best befit the community.
*-If possible, don't make this function's name so long and ugly. Shorter the better :biggrin: .
This is my first time Requesting a Script. I'm still pretty green when it comes to Ruby, but I'm learning fast. I'll try to make this request as succinct as possible. Hopefully, once it's done, it'll help a whole lot more people than just little old me.
I'm looking for a Script that can be plugged into the Script radio button in the Conditional Branch section of the Event Editor, takes several inputs and returns a True or False depending on a comparison of the inputs versus a specified "Difficulty Number," also declared in the inputs. The function will require some form of Scripted random number generator whose result will be part of the process.
(One of the more difficult aspects of this Script, for me, is the random number generator. Not sure if Ruby has something already mocked up in its library files. If it does, awesome.)
For instance, the function placed within the Conditional Branch Event window might be something like this:
NI_stupid_script_request(actor_id, stat_id, class_id, class_id2, class_id3, difficulty_number, rand_span)*
•actor_id would be the number that identifies the actor. A 0 here indicates that you use the second input instead, class_id.
•class_id this should always be 0, unless actor_id is set to 0. In that case, it searches the current party for a member of the character class that matches the given number. If more than one exist, it associates with whoever has the higher stat_id (see below). If both have the same stat_id, it goes with whomever is higher level. IF BOTH ARE STILL THE SAME (not likely), it goes with whatever actor has the lowest numerical actor number. If both actor_id and class_id are set to 0, it randomly picks someone in the current party and ignores class_id2 and class_id3. If it is set > 0 but there's none in the party, automatically the function returns false.
•class_id2 this should always be 0, unless class_id > 0 and you want multiple options. It checks here first to see if there's anyone of class_id2 in the party before checking class_id. If there isn't a member of class_id2's specified class in the party, use class_id. If class_id = 0, class_id2 is ignored.
•class_id3 this should always be 0, unless class_id > 0 AND class_id2 > 0 and you want multiple options. It checks here first to see if there is a member of class_id3's specified class in the party, if not it goes on to class_id2, and so on. If class_id = 0, class_id3 is ignored.
•stat_id would be the specified actor or party member's stat taken into consideration, probably determined by a switch statement (switch as in C++ jargon, not a RMXP game switch :tongue: don't know what the Ruby jargon is for them). For instance, A = STR, B = DEX, etc etc.
•difficulty_number would be an integer, the target number to overcome (explained below)
•rand_span would be another integer, setting the range of random numbers used in the calculation (explained below). For instance, if rand_span was 20, the calculation would involve a random number from 1-20. If 100, a random number from 1-100, etc. The purpose of having this a variable set by the designer is because some games have radically different scales of values for STR and INT and whatnot, and having it a static 1-100 will probably skew the results. Anyway I'm getting ahead of myself...
The Script itself
Mind you, this is not intended to be actual script, it's an abstract. If I knew the syntax for all this, I wouldn't be making the request :scruff:
Line number On/Off | Expand/Contract | Select all
Code:
 1. Â
  2. if actor_id > 0
  3.  gets ACTOR
  4.  GUY = ACTOR
  5. else if class_id > 0
  6.     if class_id3 > 0
  7.       gets CLASS provided there is one
  8.     else if class_id2 > 0
  9.         gets CLASS provided there is one
 10.     else if there's more than 1 of class in party
 11.        compare numbers of both stat_id
 12.         if stat_id == stat_id
 13.           compare levels
 14.             if level == level
 15.               gets lowest ACTOR number
 16.             else gets highest level
 17.         else gets highest stat_id     Â
 18.      else if class_id is in the party
 19.          gets CLASS
 20.         else RETURN FALSE
 21.      GUY = CLASS
 22. else get random party member
 23.    GUY = random party member
 24. Â
 25. get stat_id of GUY
 26.  STAT_BONUS = stat_id of guy
 27. Â
 28. get random number from 1 to rand_span
 29.    this = RANDOM
 30.  RESULT = RANDOM+STAT_BONUS [color=#0000FF](RESULT, RANDOM, or STAT_BONUS can be multiplied here by a static integer within the Script itself if specific users feel the need because they put particularly low or high general stat levels in their game)[/color]
 31. Â
 32. if RESULT => difficulty number
 33. return TRUE
 34. else return FALSE
 35.   Â
Â
I hope my IF's and ELSE's are setup right. Ignore them if you get the gist of what I'm saying.
If all that looked like crazy nonsense:
The Script I'm looking for is a universal tool for establishing a Difficulty Number and linking an Event-based task to either a specific actor, or a specific character class in the party (with the option of listing up to 3 other classes, giving each a priority). The Script takes that character's relevant stat, combines it in some way with a random number, and then compares it to the Difficulty Number. If it is equal to or higher than the difficulty number, the function returns True. If not, False.
Anyone familiar with tabletop RPG's will intuitively see what I'm trying to do with this.
I realize this is simultaneously a monster to fathom for those with limited Script knowledge, yet at the same time something quite simple for those who Script on a regular basis. I apologize to both groups and would greatly appreciate any help in the matter.
If you concoct a similar script with slightly different parameters, I'd still like to see it and hear how it works. I might be able to do what I want with a modified version of this, but I thought I would try to construct it in a way that would best befit the community.
*-If possible, don't make this function's name so long and ugly. Shorter the better :biggrin: .