RMRK RPG Maker Creation > XP Scripts Database

Lambchop's Super Simple Mouse Script

(1/7) > >>

shaz:
Super Simple Mouse System
Version: 1.0
Author: Lambchop (Amaranth), Near Fantastica, SephirothSpawn, Shaz
Date: August 2, 2010
Version History

* <Version 1.0> 8.2.2010 - Original Release
* <Version 1.1> Nov 27 2010 - Fix to character selection and equipment selection in menu, CTRL to ignore passability, missing attr_accessor in Game_Character
Planned Future Versions

* <Version 2.0> Plan to add HUD
Description
This script adds mouse control to RMXP.  It is a simplified version of the mouse script used in all the Aveyond games.

Features

* Custom mouse graphics
* Popup icons on events (sword over enemy, "talk" bubble over NPC, "hand" icon over chest, etc)
* Pathfinding
* Mouse-enabled menus
Screenshots



Instructions
Copy the following scripts from the demo into your own scripts file, placing them above Main:

* Start Game
* Mouse 1
* Mouse 2
* Mouse 3
Change the icons in the Graphics/Icons folder to suit your game.  Extra icons can be added, and must be inserted into the Mouse 2 script, at the top and around line 150.

Add the following comments to events to add specific mouse functionality:

* ArrowX - on a comment on line 1, tells the script to show a certain cursor when the mouse moves over this event.  By default, Arrow is the default cursor, Arrow2 is a talk bubble, Arrow3 is a hand, Arrow4 is a sword
* Mouse[x-offset, y-offset] - on a comment on line 2, tells the script to move the player to the specified offset, then turn towards the event and trigger it.  For example, Mouse[1, 2] will make the player move one tile to the right and two tiles below the event, turn up, and trigger the event (useful if you want the player to stand below a sign or bookshelf before reading it)
* Name abc 123 - on a comment on line 2, tells the script to show some popup text (abc 123) when the mouse moves over this event.  If using the Name comment and the Mouse comment, the Mouse comment must be first on the line
Script
This system consists of several scripts, one of them quite large.  Please download the demo and take them straight from the project.
Note - you must be logged into the forum in order to see access the demo.

Credit

* Lambchop (Amaranth)
* Near Fantastica
* SephirothSpawn
* Shaz

Support
Post here or send me a PM

Known Compatibility Issues

* This script redefines the Game_Character.passable? function.  If you have any mods to this function that you have made (or other scripts have made), you will need to reapply them to this script
* If you have any windows that inherit from Window_Selectable but use non-default item sizes, you may need to add functions for oh and mouse_oh as shown in the Mouse 3 script
Demo
Demo attached (you must be logged in to see it)

Author's Notes
With the pathfinding, sometimes the player will have to click twice on an NPC that's set to move around - with the first click, they'll walk up to where the NPC is at the time, but the NPC could move away while the PC is walking.  The trigger will only happen if the NPC is still within trigger distance.

The icon, mouse offset and popup text were all added at different times, and require a total of 2 comment lines.  You COULD alter the script to allow them all to appear on line 1 and all be optional.

Restrictions
This script can be used in freeware and commercial games.
Please include the list of authors in your credits.

Karltheking4:
ZOMG, this script is awesome, this is definetly in my game, thanks! :D

btw, is there anyway to make it so an event will follow the cursor?

shaz:
the player will move when you click where you want him to walk.  You could make an event do a similar thing, I guess, though I can't think of a reason why you'd want to.

I wouldn't advise trying to make an event follow the cursor as it moves - the pathfinding could really make your game lag if the destination keeps changing and the path has to keep calculating, and the player can move the mouse around a LOT faster than an event can move.


I realise there's a couple of lines missing from the Mouse scripts.  They're in the Game_Character 1 script, but if you're just taking the 4 scripts, you'll need to insert them yourself.  In Mouse 1, where Game_Character is extended (around line 280), add
attr_accessor :ignore_movement
and set it to false in the initialize routine.

Karltheking4:
So that's a no?
ahh well, it's still an epic script ;D

reason why: Well, I was wondering if it would be possible to make some sort of telekinesis thingy-ma-bobby game out of it... :P

Edit: I just had another thought, instead of having the pathfinding going crazy trying to make the event follow the cursor, how about just clicking once on the object, and then clicking on the map to make the object go there?

coachdog113:
I get this error when I play it. I double checked every thing but this pops up any ways can u help please???

Navigation

[0] Message Index

[#] Next page

Go to full version