[XP] Dash and Sneak

Started by G_G, September 29, 2009, 07:34:17 am

Previous topic - Next topic

G_G

September 29, 2009, 07:34:17 am Last Edit: February 18, 2013, 02:35:57 am by Blizzard
Dash and Sneak
Authors: game_guy
Version: 1.1
Type: Custom Movement System
Key Term: Custom Movement System



Introduction

This script adds a little running and sneaking to your game. Don't use this if you're using Blizz-Abs because Blizz-Abs already has a running and sneaking.


Features


  • Allows Running and Sneaking
  • Allows Custom Walking, Running, and Sneaking Speeds
  • Allows Custom Running and Sneaking Buttons
  • Detects Walking, Running, and Sneaking
  • Disable/Enable Running and Sneaking



Screenshots

N/A


Demo

v1.0 Demo
MediaFire

v1.1 Coming Soon


Script

Spoiler: ShowHide

#===============================================================================
# Dash and Sneak
# Author game_guy
# Version 1.1
#-------------------------------------------------------------------------------
# Intro:
# This script adds a little running and sneaking to your game. Don't use this
# if you're using Blizz-Abs because Blizz-Abs already has a running and
# sneaking.
#
# Features:
# Allows Running and Sneaking
# Allows Custom Walking, Running, and Sneaking Speeds
# Allows Custom Running and Sneaking Buttons
# Detects Walking, Running, and Sneaking
#
# Instructions:
# First the default run button is Shift. The default sneak button is Alt.
# You can change them if you're familiar with the Input module.
#
# You can alter the Walking, Running, and Sneaking speed in the config below.
# You can also detect if the player is running by doing this in a condiotional
# branch.
# GameGuy.running? if he's running it will return true else it will return false
# To check sneaking use
# GameGuy.sneaking?
# For just walking use
# GameGuy.walking?
#
# You can also disable run and sneak. To do so do this.
# GameGuy.run_on to turn run on
# GameGuy.run_off to turn run off
# GameGuy.sneak_on to turn sneak on
# GameGuy.sneak_off to turn sneak off
# You can then make it possible so that you need certain equipment equipped
# to be able to do this.
#
# It is recommended to turn the running and sneaking off during cutscenes so
# simply do this. GameGuy.run_off or to turn it back on GameGuy.run_on and thats
# all.
#
# Credits:
# game_guy ~ for making it
# RoseSkye ~ helping me think of a script
#===============================================================================
module GameGuy
 #===========================================================================
 # Begin Config
 #===========================================================================
 #===========================================================================
 # RunButton       = The button used to run. Default is Shift.
 #
 #===========================================================================
 RunButton         = Input::SHIFT
 #===========================================================================
 # SneakButton     = The button used to sneak. Default is Control.
 #
 #===========================================================================
 SneakButton       = Input::ALT
 #===========================================================================
 # WalkingSpeed    = The normal walking speed for when walking.
 #
 #===========================================================================
 WalkingSpeed      = 4
 #===========================================================================
 # RunningSpeed    = The speed for when running.
 #
 #===========================================================================
 RunningSpeed      = 5
 #===========================================================================
 # SneakingSpeed   = The speed for when sneaking.
 #
 #===========================================================================
 SneakingSpeed     = 2
 #===========================================================================
 # End Config
 #===========================================================================
 def self.run_on
   $game_system.run_allowed = true
 end
 def self.run_off
   $game_system.run_allowed = false
   $game_player.move_speed = GameGuy::WalkingSpeed
 end
 def self.sneaking?
   if Input.press?(GameGuy::SneakButton) && !Input.press?(GameGuy::RunButton)
     return true
   else
     return false
   end
 end
 def self.running?
   if Input.press?(GameGuy::RunButton)
     return true
   else
     return false
   end
 end
 def self.walking?
   unless Input.press?(GameGuy::RunButton)
     unless Input.press?(GameGuy::SneakButton)
       return true
     else
       return false
     end
   else
     return false
   end
 end
 def self.run_off
   $game_system.run_on = false
 end
 def self.sneak_off
   $game_system.sneak_on = false
 end
 def self.run_on
   $game_system.run_on = true
 end
 def self.sneak_on
   $game_system.sneak_on = true
 end
end
class Game_System
 attr_accessor :run_allowed
 attr_accessor :sneak_on
 attr_accessor :run_on
 alias gg_dash_lat initialize
 def initialize
   @run_allowed = true
   @sneak_on = true
   @run_on = true
   gg_dash_lat
 end
end
class Game_Character
 attr_accessor :move_speed
end
class Scene_Map
 alias gg_dash_update_lat update
 def update
   if $game_system.run_allowed
     if Input.press?(GameGuy::RunButton) &&
         $game_system.run_on
       $game_player.move_speed = GameGuy::RunningSpeed
     elsif Input.press?(GameGuy::SneakButton) &&
         $game_system.sneak_on
       $game_player.move_speed = GameGuy::SneakingSpeed
     else
       $game_player.move_speed = GameGuy::WalkingSpeed
     end
   end
   gg_dash_update_lat
 end
end



Instructions

In the script.


Compatibility

Not tested with SDK.


Credits and Thanks


  • game_guy ~ for making it
  • RoseSkye ~ helping me think of a script to make and beta testing



Author's Notes

Give Credits and Enjoy!

RoseSkye


fugibo


G_G

any comments on the actual script itself? Yes I know this can be easily evented but....I was bored

Blizzard

It's a nice thing if you don't want to bother with events.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Taiine

I have to say this is the first running script I found that can use conditional branch's to detect if the player is or not. Plus be able to turn it on and off.
This is just what I needed for my game ;3

However can you set it so you can disable the run/sneak separately? I'd like to make items that if you have it equipted you can run, and another to stealth. However I only see away to turn them both on or off together.

G_G

October 29, 2009, 10:58:19 pm #6 Last Edit: October 29, 2009, 11:02:08 pm by game_guy
updated so you can disable running and sneaking.
TO do what you want to do make a parallel process to see if any actors are wearing the equipped thing then follow the syntaxes in the script.

@mods/blizz: I would move this but I'm not sure if it should.
Its been unmoved awhile before I became a mod so I figured it'd stay here. Move it if it should be moved though I wasnt sure.

Calintz

I was just about to say that this should be an event system, LMAO ...
Maybe I'll just have to add the sneak feature to CARJES!! Then what G_G!? XD!!

G_G

Hey I know this can be easily evented, I just prefer it when scripting makes it easier. Go ahead and add it to CARJES. lol
I just like it when scripts make my eventing life easier.

Calintz

Haha, I on the other hand find eventing much easier.
The ability to do things may be limited in some ways, but it's all laid out for you.

No surprises ...
Use the interface to point and click. This does that. If this, then that.

Scripting goes to the roots. Takes memorization of codes, and the ability to comprehend the coding. Without somebody teaching me, I doubt I will ever learn. I need help for things that are relatively unknown to me if I wish to master them.

I can edit code, but as far as writing my own ... out of the question.

Taiine

October 29, 2009, 11:39:55 pm #10 Last Edit: October 29, 2009, 11:48:43 pm by Taiine
Edit: was a small conflict with another script, had to move things around.
and it was from a new game :P

G_G

Try starting a new game. I dont get the error thats odd.

You cant do this from a loaded game thats probably why.

@calintz: Get me back into eventing D: I find it boring and hard to get into, especially when you know how to script and pretty much can event with scripting.

Taiine

October 29, 2009, 11:48:08 pm #12 Last Edit: October 29, 2009, 11:51:39 pm by Taiine
The off switch causes the play to be stuck in place now >.< I have an event that you can walk over to turn it on and off. it worked in the other! But now walking over the off one gets the player stuck in place.

Also if I use a conditional branch to change sprites if running/sneaking rather default that way or if you have/don't have the item to do it, or even if it's set to off, the speed wont change, however the sprites will :/

G_G

@Taiine: I'll look into it tomorrow, upload a demo so I can see the bugs, and I'll fix it. Its pretty late over here so I probably made some scripting mistakes.

Taiine

Okay I'll put together a test game with it to show the issue.

Calintz

Well, if anything will do the trick, it's gonna be my evented snowboard minigame.

Blizzard

*looks at template* *looks at this topic* It's a match, ready to move. *pulls G_G's arm and points to the move button*
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Taiine

October 30, 2009, 05:08:16 am #17 Last Edit: October 30, 2009, 09:05:48 am by Taiine
http://www.easy-share.com/1908292360/DanStest.exe

Theres the example.

The top two plants are the 'off' switches and freaze the player in place if walked over.
The path over the water checks if you are running and if so jump it.
the bottom plans are the 'on' switches that.. can't be tested cause off freazes you :/

Edit: I also just tried it in a parallel process to have it off at game start, that and even an auto run/self off switch and it will still freaze the player in place and not allow them to walk.

G_G

Have no idea why it just freezes like that. But I'm going to completely remake the script and carefully make sure I dont mess up anything.

Aqua

Autoruns don't allow the player to move - they're mostly used for cutscenes.

Parallel process allows the player to move. You should be using these for the events.