[RMVX ACE] [SCRIPTING] HELP WITH MOGHUNTER "SMOOOOCH EVO" SCRIPT?

Posts

Pages: 1
Hello! ^ ^

I was wondering if maybe someone could help me with Moghunter's "Smooooch EVO" script.
See, I've been playing around with it for 2 (going on 3) days now, and I've pretty much gotten it all figured out, for the most part, there's just one problem:
As far as I know, the script only carries out its assigned switch if you win the match. ._.
So, for example, if I wanted (which I do) to make a conditional branch for if you win or if you lose, I couldn't do that, 'cause it'd only carry out the switch if I won anyway.

What I really want to do is have an option to carry out a switch for if you lose or if you win, rather than only the latter.

A big part of my game kinda depends on this whole thing. '_'

Thanks!
Marrend
Guardian of the Description Thread
21781
Correct me if I'm wrong, but... couldn't the CONDITIONAL BRANCH you're looking for be based on whither or not the switch in question is enabled or not? I mean, the assumption on my part, based on what you're written, is that the script uses a game-switch to keep track of if the player wins. So, if the player wins, it's active (ie: true), and if the player looses, it's inactive (ie: false).
author=Marrend
I mean, the assumption on my part, based on what you're written, is that the script uses a game-switch to keep track of if the player wins. So, if the player wins, it's active (ie: true), and if the player looses, it's inactive (ie: false).


Exactly. ^ ^
So, if I were to make a conditional branch, I wouldn't put it in with the same event that activates if the player wins, right? I'd make a separate event for it based on whether the switch is off or not? 'Cause I've tried putting the conditional branch in with the same event as the "victory" switch before, and it didn't work,obviously, since if I lose that event wouldn't even activate at all.

By the way, thanks for replying so fast. :3
Marrend
Guardian of the Description Thread
21781
I was mostly thinking about doing the CONDITIONAL BRANCH check right after making the script-call? As in, on the same event-page, one command after the other? Let the CONDITIONAL BRANCH handle whatever needs to happen in regards to the results.

*Edit: Then again, I might have a very large misunderstanding of what it is that you are attempting to accomplish.
So, like this?

@>Conditional Branch: Switch == ON
(STRING OF EVENTS FOR VICTORY, ETC. ETC.)
: Branch End
@>Conditional Branch: Switch == OFF
@>Game Over
@>
: Branch End
@>

I'm not sure I'm getting it... Maybe, could you please type or screenshot how the event should be structured? ._.
I don't think putting in a conditional branch based on whether or not the switch is on or off will do much good, since if you win the match, it carries out that switch's events no matter what, and if you lose, it will just ignore that event all together, even the part of the conditional branch that says what to do if the switch is off.
The script call for Smooooch EVO is "smooooch(n,n,n,n,n)"
Where the very last number is the number of the switch that will carry out if you win.
Maybe someone could edit the script so that it could carry out a switch for if you lose as well? I swear I've tried every which way with conditional branches. >,<
Marrend
Guardian of the Description Thread
21781
I was thinking more like..


@>Conditional Branch: Switch == ON
@>#String of events for victory
Else
@>#String of evens for defeat
Branch End

...this, if you excuse the psudocode.

*Edit: I'm not entirely sure I comprehend...

author=Nejitage
I don't think putting in a conditional branch based on whether or not the switch is on or off will do much good, since if you win the match, it carries out that switch's events no matter what, and if you lose, it will just ignore that event all together, even the part of the conditional branch that says what to do if the switch is off.

...this statement. Like, I get the winning the mach would do whatever events are associated with winning. What I don't get is how loosing would make code associated with failure to not occur? Like, I cannot fathom this.

*Edit2: Sorry, my head's hurting a bit!
author=Marrend
Like, I get the winning the mach would do whatever events are associated with winning. What I don't get is how loosing would make code associated with failure to not occur?


Well, to put it as simply as possible, losing the match would cause the event not to occur because if you lose, it won't even acknowledge that the event is there at all. It will just downright ignore it.

That's why putting in a conditional branch for if you lose or win wouldn't do anything, because even if you did add in an "Else" statement, it wouldn't carry out the assigned code because if you lose it wouldn't even pay any attention to the event containing the "Else" statement. It wouldn't acknowledge the event or anything in it if you lose.

Smooooch EVO just doesn't function like a normal battle script.
When you win or lose, Smooooch doesn't turn any switch "ON" or "OFF". It checks to see if there's any events on the map containing the switch it was assigned to in the script call.

Conditional branches downright just won't work.

I'm pretty sure I just need someone to edit the Smooooch EVO script for me so that I can have TWO switch options (one for winning and one for losing).
Otherwise, I'm pretty sure there's just nothing I can do.

As of now, the script is only designed to carry out a switch if you win, and if you win only. If you lose, it's designed to do nothing at all.

author=Marrend
*Edit2: Sorry, my head's hurting a bit!


Haha, no, no, it's fine. x3 I feel your pain.
Marrend
Guardian of the Description Thread
21781
Did a bit of delving on this. I personally think it's kinda bad, but the work-around of having a switch enabled on-defeat seems to be the way to go. So, what I did is was basically...

class Scene_Smooooch
  #--------------------------------------------------------------------------
  # ● Execute Pre Terminate
  #--------------------------------------------------------------------------       
  def execute_pre_terminate
    #execute_reward if @actor[0].hp > 0
    if @actor[0].hp > 0
      execute_reward
    else
      execute_failure
    end
    RPG::BGM.stop
    BattleManager.replay_bgm_and_bgs
  end    

  #--------------------------------------------------------------------------
  # ● Execute Reward
  #--------------------------------------------------------------------------       
  def execute_reward
    $game_switches[$game_temp.smoooch[4]] = true
    $game_switches[$game_temp.smoooch[5]] = false
    $game_variables[VARIABLE_ID_STORE_SCORE] = @score
    $game_variables[VARIABLE_ID_STORE_MAX_SCORE] = @max_score   
    $game_variables[VARIABLE_ID_STORE_MAX_COMBO] = @max_combo
  end

  #--------------------------------------------------------------------------
  # ● Execute Failure
  #--------------------------------------------------------------------------       
  def execute_failure
    $game_switches[$game_temp.smoooch[4]] = false
    $game_switches[$game_temp.smoooch[5]] = true
  end
end

class Game_Interpretor
  #--------------------------------------------------------------------------
  # ● Smooooch
  #--------------------------------------------------------------------------     
  def smooooch(player_1_id = 1, player_2_id = 1, stage_id = 1, difficulty_level = 1, win_switch_id = 0, loose_switch_id = 0)
      player_1_id -= 1 if player_1_id > 0 ; player_2_id = 1 if player_2_id == 0
      stage_id = 1 if stage_id < 1 
      difficulty_level = 10 if difficulty_level.abs > 10
      $game_temp.smoooch.clear
      $game_temp.smoooch[0] = player_1_id
      $game_temp.smoooch[1] = player_2_id
      $game_temp.smoooch[2] = stage_id.abs
      $game_temp.smoooch[3] = difficulty_level.abs
      $game_temp.smoooch[4] = win_switch_id.abs
      $game_temp.smoooch[5] = lose_switch_id.abs
      SceneManager.call(Scene_Smooooch)
  end
end

...this. Interestingly enough, the changes that I did make seemed to work if they are applied to the original code, not as a separated out in a new code-block.

The big question now, is if this solution actually works for your game.
Oh wow! O.o
Thank you so much!
But, two small questions:
Do I add another switch number in the script call?
Like instead of this: smooooch(0,1,2,3,4)
This: smooooch(0,1,2,3,4,5)

And also, do I just paste your script at the bottom of Smooooch?
Because I tried pasting it at the bottom and adding another number into the script call and I got a wrong number of arguments error:

Script 'Game_Interpreter' line 1411: ArgumentError occurred.
wrong number of arguments (6 for 5)


And the above error isn't because Smooooch is clashing with another script, 'cause I checked them all to see. x3

And also, if I do lose the battle and don't add another number to the script call I get this error:

Script 'Game_Switches' line 26: TypeError occurred.
no implicit conversion from nil to integer


*Edit
Also if I win I get the same 'Game_Switches' error.
Marrend
Guardian of the Description Thread
21781
But, two small questions:
Do I add another switch number in the script call?
Like instead of this: smooooch(0,1,2,3,4)
This: smooooch(0,1,2,3,4,5)

Essentially, yes, the second example you're providing would be the new implementation.

And also, do I just paste your script at the bottom of Smooooch?
Because I tried pasting it at the bottom and adding another number into the script call and I got a wrong number of arguments error.

How I eventually got it to work was editing the script directly. Though, to be fair, I did try to have my edits in a different section (ie: not even on the same page as the rest of the Smooooch functions). However, that implementation raised the number of arguments error that you're referring to here.

*Edit: Oddly enough, I started out editing the script directly, rather than copy-pasting the code I thought I needed elsewhere, and going from there. The latter is my usual mode of operation.
Hmm... I still can't get it to work. I keep getting different errors.
It's probably because I don't know EXACTLY how you did it (where you put in all the changes in the original script). I found the matching class names that you made changes to and edited them in, but it still gave me errors. (Like, unexpected keyword_end expecting $end, and stuff like that.)

So, maybe you could put the entire edited script you did somewhere where I could copy it into my game? 'Cause it's definitely something I'm doing wrong since you can get it to work.

I'm sorry this post is going on so long and I'm running into so many different problems, but you have no idea how much I appreciate your help so far! ^ ^
Marrend
Guardian of the Description Thread
21781
Thankfully, RMN has a locker system! This is the Scripts data-file that was in the project I was working with. What I humbly suggest you do is make a back-up of your current Scripts data-file (for the sake of having a back-up), then copy this over. Then do a test-run, or three.

If you're really curious about what you did versus what I did, you could try copying what you have right now into a plain-text file, then, after replacing the data-file (you probably still want to make a backup), copy what I had into another file, and compare them side-by-side. It might not be color-coded (unless you have Notepad++?), but, I feel like that could be a learning experience for you.
Oh my goodness...

This isn't a dream, right? This is reality??
It works! It works perfectly! Thank you so so much, you have no idea how happy you've made me! ^a^
I've been trying to get this to work for so long. x3

And I did what you suggested, by the way; putting the two text files containing both versions of the script side-by-side.
It seems I put a couple things in the wrong places, I guess I just misunderstood where they were supposed to go. ._. Oh, well, I know a little bit of Ruby, but not enough to know how to put things in the right places, apparently. > <

But, that's okay, 'cause it's all figured out now! ^w^

Thank you very much once again, and I hope you'll play my game once it's finished! I'll definitely let you know when it's done. (It's going to be free, so... x3)

P.S. I've added you to credits. ^u^
Marrend
Guardian of the Description Thread
21781
Coolio! Let me know when the game page is up!
Pages: 1