Yanfly victory aftermath + TheoAllen add-on quotes and typo questions.

Hello!

This the 2 scripts I using:

Victory aftermath : https://github.com/Archeia/YEARepo/blob/master/Battle/Victory_Aftermath.rb

Victory aftermath TheoAllen add-on: http://pastebin.com/raw.php?i=fVHuF5U3

##############

I have few questions:

1) I am using TheoAllen's add-on, so may I remove all the quotes that way in the original Yanfly's script?

Because early, I got some message error...but at the moment it looks ok.

    # Win Quotes are what the actors say when a battle is won.
    VICTORY_QUOTES ={
    # :type   => Quotes
      #------------------------------------------------------------------------
      :win    => [ # Occurs as initial victory quote.
                 ],# Do not remove this.
      #------------------------------------------------------------------------
      :level  => [ # Occurs as initial victory quote.
                 ],# Do not remove this.
      #------------------------------------------------------------------------
      :drops  => [ # Occurs as initial victory quote.
                 ],# Do not remove this.
      #------------------------------------------------------------------------
    } # Do not remove this.
    
  end # VICTORY_AFTERMATH
end # YEA
----------------------------------------------------------------------

2)I'am confuse with some typos and I wish to understand a bit:
  $game_temp.drops.size >= 2                                             if the droped items is equal or more than 2
  $game_temp.drops.include?($data_items[1])                    ##I dont understand the ##

                                                                                             .include?($data_items[1])

  hp_rate > 0.5                                                                      HP bigger than half of maxHP
  $game_troop.turn_count <= 2                                            if battle was fast or not less or equal 2 turns
  $game_temp.drops.empty?                                                Here I guess 0 item droped
 

////

EDIT: Is it possible to set a between "drop.size" ? Exemple:

$game_temp.drops.size (between 2) and 4

or not 0 but less than 3?   

////

Is that possible to type anything? For exemple a comment if someone is dead at the end (sure is not correct):

$game_actor(x)_status(x)?        

Or about MP? :

mp_rate > 0.5   

Or if it's the very first time you find a specific item and dont show the comment again if the quantity turns to 0 and you find 1 again...

---------------------------------------------------

3) In the TheoAllen's selfgame exemple, he using "true" and I did the same for some comments,

but it looks the "true"s ones go over all conditionnals comment.

For exemple the comment "0 item droped" never go out.

I turned them all in "false" and it looks to work...and I cant understand why.

-------------------------------------------------------------------------------

4)Here, what is the "+"?

  ["Actor28_ex",3,"Did you see that? Did you see that I shot" +
    "\nthree bullets in single shot?","true"],

Does it makes possible to interacting dialog with 2 actors?

Actor(1) "You're stupid!" + Actor(2) "No, I am not!"

################

Well, sorry about my bad english and I hope you understand me good enough.

Thanks in advance!
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.
Ahoy!


Thanks for that link to Theo's addon, I was struggling to find that one for ages! 😀


1.


Looks fine to me, and if you get no errors or unexpected behaviors, than it should be just fine.


2.a. The thing you don't understand:


"include?" means what it actually means (this sounds weird, right? o.o), it checks if something is included in something or not.


In this case, it checks if the dropped items include the item with the ID of 1 or not.


You can use $data_items[id] for items, $data_weapons[id] for weapons, or $data_armors[id] for armors, just replace the id with the ID of the item you want to check from the database.


2.b.


Yes, it is possible to check if the amount of dropped items is between this and that value.


You can use this:

$game_temp.drops.size.between?(min, max) Replace min with the minimum value and max with the maximum value. They are inclusive, so if you set 0 and 3, it means the quote can happen if the amount of drops is either 0, 1, 2 or 3.
2.c.


Yes, it is possible to check for any condition you might want, but you will need to know the correct ruby code to do so.


If you want to check for a state of a specific actor, you can do this:

$game_actors[actor_id].state?(state_id)Replace the actor_id with the ID of the actor you want to check and state_id with the ID of the state you want to check for.
In case you want to check if any of your battle members is dead (or with any other state), you can try this:

$game_party.battle_members.any? {|member| member.state?(state_id)}Replace the state_id with the ID of the state you want to check for.
To check the mp rate, you can do the same as with the hp rate, just replace the 'h' with 'm'.


No idea where the actual checks are eval-ed, but if it is outside the scope of Game_BattlerBase, simple putting 'hp_rate > 0.5" will trigger an error.


If it won't trigger an error, disregard this information, and feel free to use it the way you did it before.


Your last check would require to save a list of already gotten items and update that list whenever you get a new item type. This requires additional coding, but once you code that list in, it will be possible to check for this too.


3.


All conditional checks will return either 'true' or 'false'. 'true' means that the conditions are met, so the code can run, 'false' means that the conditions are NOT met, so any code within the conditional check will NOT run. So, adding 'true' as a condition means that that quote can always happen.


4.


The + there simply adds the first part of the string (text) to the second part. Nothing else. You could have written that same thing like this too:

["Actor28_ex",3,"Did you see that? Did you see that I shot \nthree bullets in single shot?","true"],This will show up the same as the example you gave, but I wrote it on one single line, eliminating the need of adding that + there.
This will most probably result in the text being cut down on the edges in the script editor, so the end of it can not be seen unless you scroll the script editor to the right manually.


Most scripters hate to scroll left and right in the script editor, so they use alternate ways to avoid that, such as that + method for strings.


Code-wise, it is not important how you write it, the result will be the same.


So, no, it is not a direct interactive mode between two actors.


Did I answer everything? 😀
Thank you very much for the long reply!

I'd wish to learn Ruby/script stuffs but no time ... and probably not the energy either for that,

but I try to understand and memorize as much as possible what I am using.

1) And about double comment, is that possible?

Does it makes possible to interact dialog with 2 actors?

Actor(1) "You're stupid!" *and then the other answers# Actor(2) "No, I am not!"

EDIT:

2) I wish to force a comment if a rare item drops with commun items...

I was wondering if something like that is possible: (of course I am getting syntaxError)

$game_temp.drops.size != 0.$game_temp.drops.include?($data_items[1])

$game_temp.drops.size != 0($game_temp.drops.include?($data_items[1]))

Thanks a lot
This is one check: $game_temp.drops.size != 0


And this is another: $game_temp.drops.include?($data_items[1])


If you want to combine two or more checks, you can do so like this:

$game_temp.drops.size != 0 && $game_temp.drops.include?($data_items[1])See that && sign between them? That means it will check for both conditions, and if not both conditions are true, the thing in the condition check will NOT happen.
Similarly, you can use an "or" check too like this:

$game_temp.drops.size != 0 || $game_temp.drops.include?($data_items[1])That || sign means "or", so if either of the conditions are true, the thing in the condition check will happen.
You can combine as many checks as you want using the above operators (&& and ||). In case of advanced condition checks, you will need to use brackets at the correct places to ensure that your condition checks will be run properly.


But the examples I (and you) used are not the best, since if the drop items include any items, the size of the drop items will surely be bigger than 0, so you can drop the first check from your examples, and leave only the ones with the "include?" check.


Also, for your actor conversation question...


There is an actual audio addon for this script, if I remember right, so if you want, you can make real conversations happen between your actors with real audio. You will need to make your own voices thou, of course. The script is written by DiamondPlatinum, I think.


Other than that, there is no way to indicate a direct conversation between the actors using only message boxes, since only one box is displayed, and that box got only one face in it.
Thank you+1 for your time, Sixth! You're awsome!

I'll use all your advices as good as possible!

Now just a "&& and ||" which open so much possibilitese!

Let's write some awsomeness!
Me again,

Is that possible to check if one of the following items (1,2,4,8,32) not droped,  but the item (11) droped.

Clearly, I wish to make hero reacts if a very rare item drops in the middle of any others.

I wanna force the message over all others.

Exemple of my drop check:

["",0,"Bah!, nothing?!","$game_temp.drops.empty?"],

["",0,"We already have a lot of that","$game_temp.drops.size != 0"],

["",0,"W...What is that !!!","$game_temp.drops.include?($data_items[11])"],

]

If I do that, the 2nd check has a chance to show up, even if the rare item drops.

I wondering if it's possible something like that:

["",0,"Bah!, nothing?!","$game_temp.drops.empty?"],

["",0,"We already have a lot of that","$game_temp.drops.size != 0 && $game_temp.drops.noinclude?($data_items[11])"], #lol noinclude?

["",0,"W...What is that !!!","$game_temp.drops.include?($data_items[11])"],

]

Thank you
You were close enough, and the logic you used is right. It's just the syntax is not right.


Try this:

$game_temp.drops.size != 0 && !$game_temp.drops.include?($data_items[11])See that ! sign just before the 2nd condition? That is the negate sign. That means if the condition is met, the check will return false, and if the condition is NOT met, it will return true.
So, basically, that inverts the result of conditions.


You can use that before any condition in case you need an inverted check.
Hello Sixth!

I'm feeling very close of what I wish to have! ^^

I just need a check to definit if none of listed item (my rares ones) has droped.

I dont know what I wrote here, but I guess it checks if 4 all droped for the condition...

Is that possible a multi check like that?

$game_temp.drops.size != 0 && !$game_temp.drops.include?($data_items[11,12,13,14])I've tried:

$game_temp.drops.size != 0 && !$game_temp.drops.include?($data_items[11||12||13||14])Of course SyntaxError

I just hope I dont have to type them all like that:

$game_temp.drops.size != 0 && !$game_temp.drops.include?($data_items[11]) || !$game_temp.drops.include?($data_items[12]) || !$game_temp.drops.include?($data_items[13] || !$game_temp.drops.include?($data_items[14]))---------------------------------------

!$game_temp.drops.include?($data_items[11]) && $game_temp.drops.size != 0Does the order is important?

Maybe it's me, but I feel to get no messy random that way.

Thank you!
[11,12,13,14].all? {|i| !$game_temp.drops.include?($data_items)}This should do what you want. Enter any item IDs into the array at the start to check for more.
You can also shorten that array like this:

[*11..14]This will enter a range of numbers from 11 to 14, so you don't have to enter all the IDs one by one. Works best if your rare items are organized in your database.
The order here does not matter much. But yeah, in some cases, it is important, just as much as the placements of the brackets.


Like, you always need to check if a variable is 'nil' before any other checks in case the variable is not always defined, else the game will crash with a NoMethod error. But I don't suppose you will need to do any checks like that here.
Thank you Sixth.

At the begining I was not sure if I had to let the ...

|i|... but I did not touch it finaly.

---------------------------------------------------------------------------

This:

[11,12,13,14].all? {|i| !$game_temp.drops.include?($data_items)}It looks to check if 11,12,13,14 all of them droped at once on the monster, if not, the victory aftermath finishes with an Error.

Just wondering if I can do something with "any?":

[11,12,13,14].any? {|i| !$game_temp.drops.include?($data_items)}I realy dont have any idea if "any?" is a code stuff...

---------------------------------------------------------------------------

Imagine there is a total of 5 rares items [11,12,13,14,15]  in the world and only 1 in each of the 5 dungeons.

After common fights, no chance to find a rare item on the world map, the code check if there is one of the 5 item droped, if not, show up an usual drop comment.

Now, in 1 dungeon, the player find a rare item, ("the number 14 for exemple" [11,12,13,14,15] ). The code check and it see that it droped, so

whatever the kind or howmany item droped, the code show up the Rare drop comment.

Thank you!

EDIT:

I tried the ".any?" stuff cause no error when launched the tests.

I think I understand why you typed ".all?" and I totaly remove my check "drop.size" to replace

by only check if not empty.

Time to go to work so I just tried couple of times, but it looks to work fine that way:

Code:
  Actor_Drops = [  ["",0,"No Drop Comment 1","$game_temp.drops.empty?"],  ["",0,"No Drop Comment 2","$game_temp.drops.empty?"],  ["",0,"Cummon Drop Comment 1","!$game_temp.drops.empty? && [36,37].all? {|i| !$game_temp.drops.include?($data_items[i])}"],  ["",0,"Cummon Drop Comment 2","!$game_temp.drops.empty? && [36,37].all? {|i| !$game_temp.drops.include?($data_items[i])}"],  ["",0,"Cummon Drop Comment 3","!$game_temp.drops.empty? && [36,37].all? {|i| !$game_temp.drops.include?($data_items[i])}"],  ["",0,"Rare Drop Comment","[36,37].any? {|i| $game_temp.drops.include?($data_items[i])}"],  ]

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-victory-aftermath-theoallen-add-on-quotes-and-typo-questions.41165/