Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,511
Reaction score
11,995
First Language
English
Primarily Uses
RMVXA
What I want to happen is this:

At a specific time actor 2 is equipped with a particular weapon. The first time that the player opens the equip screen for that actor after that event I want to go back to the map for some dialogue (e.g. via a common event) and then, if possible, return to the equip screen. If I can't return to the equip screen, it doesn't matter, that would just have been the icing on the cake.

I know of Hime's Equip Event script, but that only runs when you actually equip/unequip something. The whole point of this particular weapon is that it cannot be unequipped, so that script won't work for me.

Does anyone know of a script which will do this? Or maybe there is some deeply cunning way of eventing it that I've not thought of.

Thanks.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
33,676
Reaction score
8,490
First Language
German
Primarily Uses
RMMV
No way to do this with events.
You'll need a script that activates common events on menu access or something like that.

One idea: search for "tutorial" or "in game manual" scripts. I think I remember that there was one that would activate something as a help function whenever the player first accessed the menues - you might be able to adapt that for this.
 
  • Like
Reactions: Kes

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,511
Reaction score
11,995
First Language
English
Primarily Uses
RMVXA
I think it might be this one.
However, the formatting has been messed up, and it's beyond my competence to sort out.
The link to the demo is dead, so that option for getting the script is out.

Can anyone help, either by re-formatting that script or by suggesting another?
Thanks.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,347
Reaction score
15,161
First Language
English
Primarily Uses
RMMV
I couldn't figure it out - the conversion of text to smilies makes it very difficult, and I don't understand what some of the code is doing that I was able to read.

However, I think it's much more simple than that.

In the event that equips that actor with that item, turn on a switch. Whenever the equip menu is open and that actor is selected, it'll check to see if that switch is on. If it is, it'll then turn on another switch and return you to the map. You can have an autorun common event conditioned by that switch to do the stuff you want to do at that point in time, then turn off both switches, then execute a Script command to return to the equip screen.


This is just a guess, but give it a go ...

Code:
class Window_EquipStatus < Window_Base
  alias :kes_actor= :actor=
  def actor=(actor)
    if @actor.id == 5 && $game_switches[10]
      $game_switches[11] = true
      SceneManager.clear
      SceneManager.goto(Scene_Map)
    else
      kes_actor = actor
    end
  end
end

(of course, you can change the actor id and the switches - hopefully you can understand what they are for and set accordingly)

I'm not certain I have the correct syntax there for the alias.

then in the script call to reopen the equip screen:
Code:
Script: SceneManager.call(Scene_Equip)


If you want it to then go back to the main menu after leaving the equip screen and it doesn't, try adding this script as well:
Code:
module SceneManager
  def self.push(scene_class)
    @stack.push(@scene)
  end
end

and make your script call do this instead:
Code:
Script: SceneManager.push(Scene_Menu)
        SceneManager.goto(Scene_Equip)

Now I haven't tested this so really have no idea if it'll work, but I think it's on the right track, so should just require a bit of tweaking if it doesn't work. I can help you with that tomorrow if needed.
 
Last edited:
  • Like
Reactions: Kes

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,511
Reaction score
11,995
First Language
English
Primarily Uses
RMVXA
I've tried this, including starting a New Game, but I constantly get this error

upload_2018-4-27_14-32-25.png

That is pointing to this line
if @actor.id == 2 && $game_switches[74]

As you can see, I've changed the actor and switch IDs

It doesn't matter which actor I've selected to see the equipment, nor does it make a difference whether it is before or after the event which gives the particular weapon I'm interested in.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,201
Reaction score
853
First Language
Hungarian
Primarily Uses
RMVXA
Because @actor will be nil the first time that method is called.
The code should use actor, the local variable there, not the instance variable.

Not sure if that alias way is correct though.
I didn't try it, but the way the alias method is called just doesn't seem right (it seems like it's trying to set a local variable instead).
I would go with this to be sure:
Code:
class Window_EquipStatus < Window_Base
  alias :kes_actor= :actor=
  def actor=(actor)
    kes_actor=(actor)
    if actor.id == 5 && $game_switches[10]
      $game_switches[11] = true
      SceneManager.clear
      SceneManager.goto(Scene_Map)
    end
  end
end
I didn't test any of this, so no idea if this will work for what you want or not, I just fixed the crash issue you have.
 
Last edited:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,511
Reaction score
11,995
First Language
English
Primarily Uses
RMVXA
What happens now is that I can open the Equip screen, but if I go to do anything with the equipment I get this error message

upload_2018-4-27_22-16-8.png
Again this is both before and after the event which gives the weapon and turns on the switch.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,201
Reaction score
853
First Language
Hungarian
Primarily Uses
RMVXA
I updated the snippet in my previous post. Try it now, see if it helps or not.
 
  • Like
Reactions: Kes

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,347
Reaction score
15,161
First Language
English
Primarily Uses
RMMV
okay, got it working. Here's the script:
Code:
class Window_EquipStatus < Window_Base
  alias :kes_actor= :actor=
  def actor=(actor)
    if actor && actor.id == 1 && $game_switches[1]
      $game_switches[2] = true
      SceneManager.call(Scene_Map)
    else
      kes_actor = actor
    end
  end
end

and in the event that's conditioned by the switch turned on in the script, you turn both switches off again, then
Code:
Script: SceneManager.call(Scene_Menu)
        SceneManager.call(Scene_Equip)
 
  • Like
Reactions: Kes

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,511
Reaction score
11,995
First Language
English
Primarily Uses
RMVXA
@Shaz The scene now runs perfectly, it does exactly what I want it to

But having this snippet gives me the same error message whenever I try and use the equip menu
upload_2018-4-28_7-6-33.png

I can access the menu, select any actor, select any piece of equipment i.e. highlight it ready for an action, but as soon as I hit the actuon button, that comes up. I can see from the Window_Equip Status that it's where it shows the difference in stats when an equipment is changed, but I cannot see how this new snippet affects that.
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
43,347
Reaction score
15,161
First Language
English
Primarily Uses
RMMV
It was the syntax of the alias, which I wasn't sure about.

This seems to work:
Code:
class Window_EquipStatus < Window_Base
  alias :kes_actor= :actor=
  def actor=(actor)
    self.kes_actor = actor
    if actor && actor.id == 1 && $game_switches[1]
      $game_switches[2] = true
      SceneManager.call(Scene_Map)
    end
  end
end
 
  • Like
Reactions: Kes

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,511
Reaction score
11,995
First Language
English
Primarily Uses
RMVXA
@Shaz Perfection!
Thank you very much. I can now go off and have my few days' break in peace and tranquillity.
As always, your help is much appreciated.
 

Latest Threads

Latest Posts

Latest Profile Posts

A music I create while practicing E Major scale. :D
Too bad the Boss Battle Build Bout isn't also for VXAce.
I might not participate in the Boss Battle contest after all... I have more important things to do, like Wishful Wanda. And of course the Dark Deception spinoff I plan to pitch, Demon Slayer.
Changed my avatar, goodbye Alan Sugar, hello George Carlin (one of my favorite human beings ever)

Forum statistics

Threads
115,176
Messages
1,087,859
Members
149,738
Latest member
jasperluna
Top