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

[XP/Solved] Simple Script Request

Recommended Posts

I'd like to request a simple script for a game I am making. All I would like it to do is to is change the actor graphics to the bat image and turn switch 1 on when you press the keyboard 'A'. Then when you press 'A' again, it will turn the switch off and change the graphics back to normal. Would somebody be able to make it for me?

 

-Thanks in Advance, Tomo2000. ;)

Share this post


Link to post
Share on other sites

Believe it or not, all you need to know is a couple script commands, and you can make this in a common event. (Which is really easier than editing Scene_Map. It won't interrupt the other scripts that edite Scene_Map).

 

Now, let's get started. To do this, you need a switch to turn on the common event; and set it to 'parallel process'. After that, do this:

 

  • Conditional Branch, tab 4, the Script command. (Yes, conditional branch). In there, put this:
    Input.trigger?(Input::Z)

    , no 'else' case.

  • Conditional Branch, tab 4, the Script command (again). This time, insert this:
    $game_party.actors[0].character_name == "088-Monster02"

    Yes, there is an else command.

  • Next, set an animation, if you want it, over the 'player'.(Show animation command.)
  • Change Actor Graphic event command. Change the main actor's graphic to the actor's human form.
  • Turn on your switch.
  • Now, under the 'else' command, set your animation again, if you want it. (Show animation command.)
  • Set the 'Change Graphic' command so it will change the main actor into a bat.
  • Turn your switch off.

 

Not too hard. Here is a picture of how it should look when complete:

changeactorgraphicevent.png

Share this post


Link to post
Share on other sites

Haha, sweet; I think I could do this. Really easy huh?

 

 

Tomo2000, if your problem has been solved, edit the name of your topic (this one) the following:

 

[XP/Solved]

 

 

Thank you!

Share this post


Link to post
Share on other sites

You guys are jumping the gun iwth the 'solved'. Remember: It isn't solved until he is satisfied, and we won't know that til he posts again

Share this post


Link to post
Share on other sites

Yeah, I was juts asking, xD!

 

 

 

If he IS solved, then that is when I was telling him to do that.

Share this post


Link to post
Share on other sites

Wow, thanks Leon! I really appreciate it and never thought I would be able to use a common event. I'll be sure to credit you when my game is complete! Im having a little bit of trouble though... I have copied everything to your exact specifications and made it so that the map will turn on switch 2 on entering, but when I press 'A' nothing happens.

 

Yes, I did change it from 'Z' to 'A'.

 

Also, I think you may have made a mistake. Shouldn't it be :

$game_party.actors[0].character_graphic == "088-Monster02"

 

Instead of:

$game_party.actors[0].character_name == "088-Monster02"

 

Because I'm not 100% sure why it says 'character_name'. Please clarify this for me.

 

EDIT: Incase you are wondering, this is what my common event looks like. I only have 1 common event.

Currebt.png

 

-Thanks in Advance, Tomo2000

Share this post


Link to post
Share on other sites

It should be character_name, because that is the variable where the name of the graphic for the actor. You see, the way scripting works is the term 'actor' is for everything a character is. Their name, graphic, class, etc. Character defines the picture for the actor. That is why you are probably confused. So '$game_party.' defines the overall party. 'actors' defines the array that holds the actors of the party. '[0]' defines it is calling up the first actor in the array. After that, you have 'character_name' defines the actor's sprite graphic. In essence, this takes the first actor in the party, and changes their graphic. I hope that clarifies how this works.

 

Also, the reason i set it to 'Z', is because 'Z' is the name of the button, and the 'A' key accesses the 'Z' button.

 

Here, this should explain more. It is directly from the Help File

Helpfilebuttons.png

Share this post


Link to post
Share on other sites

You could also Playtest your game and press F1. A window called Game Properties will appear and it'll have 3 tabs, no idea what the first tab is really about, but the second and third one are called Gamepad and Keyboard, showing you which button does what. But Leons way works to.

Share this post


Link to post
Share on other sites

Ok, I've set up everything in the common event as Leon has (no difference) and also made an autorun event on the map to turn the switch in the parallel process on. Is this right? And is there anything specific apart from the common event that I need to do to make the event work?

Share this post


Link to post
Share on other sites

Nope, should work fine. Just turn on the switch to make this run via parallel process, and make sure you have the right key set up for hte button you wish to use.

Share this post


Link to post
Share on other sites

Im sorry... I've tried everything I can think of (and copied it to Leon's exact spec's) but it still wont work. Leon, if you dont mind, would you be able to make me a demo of it?

 

-Thanks in advance, Tomo2000

Share this post


Link to post
Share on other sites

Post a screenshot of it real quick, and I can tell you if there is a problem or not.

Share this post


Link to post
Share on other sites
Ok, sure, this is the Common Event:

 

database.png

 

And this is the autorun event:

 

event.png

 

I only have two switches; Bat Transform and Allow Bat. Anything else I need?

 

In the second conditional branch, does it say: $game_party.actors[0].character_name == "094-Monster08"

Share this post


Link to post
Share on other sites

Will it need anything special in the line of script if it has a hue? I've replaced the script and still nothing...

Share this post


Link to post
Share on other sites

Amazing! Thats exactly how I wanted it! I also tested it on my other game and now its working! Thanks a million, Leon! This topic is now solved!

 

By the way, I finished you down image, it will be posted in your thread.

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...