Field Abilities

Discussion in 'RGSS3 Scripts (RMVX Ace)' started by Vlue, May 24, 2014.

    Tags:
  1. Vlue

    Vlue Talent Extraordinaire Member

    Messages:
    589
    Likes Received:
    376
    Location:
    Canada
    First Language:
    English
    Field Abilities v1.0
    By Vlue
    Introduction
    Someone asked for this, so I made it! I can't remember who though, might have been me. I also couldn't think of a better name for it other than field abilities, but without much further ado: This script, Field Abilities, gives you options for throwing, grabbing, pushing, pulling objects, and jumping! Now you can leap gorges, toss pots, and drag heavy statues around, all in the name of justice! Or whatever you heroes are calling it now-a-days.

    Features
    - Pick up and toss certain events, including self-switch on throw for after thrown actions
    - Drag events around
    - Jump! Includes options to disable jump via switch, and to set regions where you can't jump to.

    How to Use
    Plug and play, set up events and regions as necessary. All instructions are available in the script itself.

    Script
    Pastbinz: http://pastebin.com/UuswnbHE

    FAQ
    N/A

    Credit and Thanks
    - By Vlue
    - Free to use in any project, commercial or otherwise, with credit given (though I would like to know!)

    Author's Notes
    I haven't had a Banana Cream Pie in forever...
     
    #1
  2. Dream3r

    Dream3r 90% Dreamer, 100% Dedicated Veteran

    Messages:
    530
    Likes Received:
    374
    First Language:
    English
    Can I pay you in banana cream pie?

    Also will more than likely be useful.

    Is pick up an option?  Like when you click on a lamp would you pick it up and walk with it?  I'm assuming even if it does work you'd need the artist to draw a verson of the sprite with a lamp in hand.
     
    #2
  3. Vlue

    Vlue Talent Extraordinaire Member

    Messages:
    589
    Likes Received:
    376
    Location:
    Canada
    First Language:
    English
    Hehe :p


    Yup, pick up is an option! You can't throw something if you can't pick it up! And events that have been picked up are displayed over the actor.
     
    #3
    Dream3r likes this.
  4. Probotector 200X

    Probotector 200X Probotect and Serve Veteran

    Messages:
    890
    Likes Received:
    146
    This is AWESOME. So simple to use, and enables lots of cool things...So many puzzle options made so much easier with this, thanks a bunch for making such a cool, simple to use script!

    Oh, but I ran into an error. I got stuck in my first attempt. I picked up an item, jumped over a hole, and threw the item back. The platform past the hole is only one panel, so, I got stuck. This was entirely my fault! But I worry others will run into this problem, and it effects how maps can be designed. I don't see a logical way for the script to solve this, so it's entirely up to the designer to avoid this kind of problem. I have a screenshot of where I got stuck.

    (the big white snowball is pickup-able)

    VXA DCB ss001 stuck with field ability script lol.png
     
    #4
  5. Dream3r

    Dream3r 90% Dreamer, 100% Dedicated Veteran

    Messages:
    530
    Likes Received:
    374
    First Language:
    English
    ^Not really a true fix but the script could make it where you jump into something the item will slide out of the way. Weird fix but only thing I can think of.
     
    #5
  6. Dream3r

    Dream3r 90% Dreamer, 100% Dedicated Veteran

    Messages:
    530
    Likes Received:
    374
    First Language:
    English
    Ran into an issue as well. Sometimes when I throw an item it turns invisible.  It still exist as when I go to walk where it landed I stop but it is no longer visible.

    edit: Issue #2.  When picking up an item that acts as a light such as a lantern or torch, the object is picked up but the light is left behind.  Might be specific to the scripts in my game so I'll have to work with you sometime on it
     
    Last edited by a moderator: May 28, 2014
    #6
  7. Rello

    Rello Rello Veteran

    Messages:
    206
    Likes Received:
    13
    Location:
    Deep in the Heaaart of Texaaas
    First Language:
    Profanity
    Maybe I'm misreading or just missed something, but is there a way to have triggers after being thrown "stack events" atop each other for certain triggers? In LoZ terms, think about tossing a pot and it breaks, or dragging a statue atop a pressure-sensitive switch.

    P.S.:

    This is really fun to just play around with. I've been tossing NPCs around for like 10 minutes.
     
    Last edited by a moderator: May 28, 2014
    #7
    Dream3r likes this.
  8. Vlue

    Vlue Talent Extraordinaire Member

    Messages:
    589
    Likes Received:
    376
    Location:
    Canada
    First Language:
    English
    What's going on on the event that just disappears?

    Haha, those NPC's! (They can pick you up to if you do it right!)


    If you plan it right you can do that yes. Events that are thrown turn on their D self switch, so if that event had a second page set to run when that self switch is turned on.. you can have a pot that breaks (which, aside from being a barrel, is the way it's demoed in the Steam Script Compilation.)
     
    #8
    SpacemanFive and Rello like this.
  9. Dream3r

    Dream3r 90% Dreamer, 100% Dedicated Veteran

    Messages:
    530
    Likes Received:
    374
    First Language:
    English
    Custom item might be the issue but it's just a lantern that I've tested it on so far.  You pick it up just fine but when you throw it it becomes invisible.  I'll take some screen shots tonight to show it
     
    #9
  10. SquallStorm

    SquallStorm Resident Persona 5 Hyper Veteran

    Messages:
    214
    Likes Received:
    134
    First Language:
    English
    So this script is actually something I was going to request either a tutorial for or commission as a script for my project.  Vlue, thank you thank you thank you so much!  Incidentally, I had a question for you.  Say I was going to have a puzzle where there are four switches just outside the players jump range and you're to throw objects at these switches to trigger them.  Would I use a method similar to a pressure plate where an events X and Y values are used to detect on/off conditions to check if the switch has been triggered?

    Edit:  Sorry to add more but I've noticed that it works oddly with followers.  I've tried to see about adding to the script to make followers jump as a single unit but I can't for the life of me fix the issue
     
    Last edited by a moderator: Jun 1, 2014
    #10
  11. Vlue

    Vlue Talent Extraordinaire Member

    Messages:
    589
    Likes Received:
    376
    Location:
    Canada
    First Language:
    English
    You would use the same method as the pressure plates x, y, blah blah, yes yes. That would be easiest.


    And yah, it doesn't play nice with followers, mainly because followers don't jump when you do. I couldn't think of a fix for it in the time I gave it, so I left it out... (I don't like followers btw :p )
     
    #11
  12. SquallStorm

    SquallStorm Resident Persona 5 Hyper Veteran

    Messages:
    214
    Likes Received:
    134
    First Language:
    English
    I realized now that followers were just a cosmetic thing and entirely preferential from the developer's standpoint, which is very rarely a good thing.  This script is absolutely fantastic though, Vlue and I really do have to thank you for this one in particular because it opened the door for a couple of dungeons I wouldn't be able to make otherwise.
     
    #12
  13. Engr. Adiktuzmiko

    Engr. Adiktuzmiko Chemical Engineer, Game Developer, Using BlinkBoy' Veteran

    Messages:
    14,640
    Likes Received:
    2,966
    Location:
    Philippines
    First Language:
    Tagalog
    Wow... This will really make life easier for a lot of people... :)
     
    #13
  14. MrPurpleDreadlocks

    MrPurpleDreadlocks Veteran Veteran

    Messages:
    159
    Likes Received:
    19
    First Language:
    English
    Hi Vlue,

    It's me again. :)

    I was wondering if you can tie jumping to stamina (the stamina script is here: http://forums.rpgmakerweb.com/index.php?/topic/6299-dash-stamina/)

    I was able to get the stamina to decrease from pressing the jump button which I moved to :L (Q on keyboard, but I was wondering how I could make the stamina bar appear whenever you jumped. I don't know how. Haha ^^ ;)

    Thanks
     
    #14
  15. Sixth

    Sixth Veteran Veteran

    Messages:
    2,130
    Likes Received:
    800
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Forgot how Vlue handles jumps (I guess he uses the built in 'jump' method too), but try to do this:


    In the Dash Stamina Script, find this line:

    return if $game_player.dash?Replace it with this:
    Code:
    return if $game_player.dash? || $game_player.jumping?
    Then find this line a little below:
    Code:
    return unless $game_player.dash?
    And replace it with this line:
    Code:
    return unless $game_player.dash? || $game_player.jumping?
    This works for me with another jump system.
    This will show the stamina bar even if the jumping is a move route command for the player, so disable the stamina system when you want to do some eventing where the player jumps.
     
    #15
    Vlue likes this.
  16. MrPurpleDreadlocks

    MrPurpleDreadlocks Veteran Veteran

    Messages:
    159
    Likes Received:
    19
    First Language:
    English
    Great this works perfectly thanks so much!
     
    #16
  17. lol2dubs

    lol2dubs Warper Member

    Messages:
    1
    Likes Received:
    0
    First Language:
    English
    Maybe I'm confused. No one else seems to be having trouble....

    I've got my map all set up. I move my event (small person) over the rock event and stop him on the other side. Once he stops, the movement event turns on a switch that tells the little guy event to pick up the rock.

    At this point, the rock disappears. It is not over his head. If I hit the action button, nothing happens.

    Any idea?

    *End of first script*

    "Set Move Route Turn Right"

    "Set Move Right Char 2 Turn Right"

    "Control Switches: {0014:ThrowRock] = ON"

    Branch End (end of conditional block)

    *Once ThrowRock comes on*
    **Rock with Event Graphic trigged as Parallel**

    "Conditional Branch: Switch [0014: ThrowRock] == ON

    "script: pickup"

    "Control Switches: [0014: ThrowRock] = OFF
    Branch End

    So... after the char moves it triggers the throwrock switch which triggers the pickup script in the parallel event waiting for the switch to turn on. The rock disappears from the map, but does not appear over the characters head, nor does it throw when I hit a key.

    What am I missing?

    2dubs
     
    #17
  18. Zarsla

    Zarsla Veteran Veteran

    Messages:
    688
    Likes Received:
    202
    First Language:
    English
    Hey Everyone,
    I've alter the script a bit, so that a running jump is added, as well as the ability to alter how many tiles you can jump.
    I'm not uploading the entire script until Vlue gives a yay or nay on me or him uploading it so for now here's the script parts you need:

    replace this part of the script:

    1. #The button to be used for jumping:
    2. JUMP_KEY = :SHIFT
    with this

    module JE

       JU = -2          # use negative number. This is the ammount you want in tiles

                          # for a regular jump, facing up.

                         

       JD = 2           # use postive number. This is the ammount you want in tiles

                          # for a regular jump, facing down.

                         

       JR = 2           # use postive number. This is the ammount you want in tiles

                         # for a regular jump, facing right.

                         

       JL = -2          # use negative number. This is the ammount you want in tiles

                         # for a regular jump, facing left.

       

       SJU = -4          # use negative number. This is the ammount you want in tiles

                               # for a running jump, facing up.

                         

       SJD = 4           # use postive number. This is the ammount you want in tiles

                              # for a running jump, facing down.

                         

       SJR = 4           # use postive number. This is the ammount you want in tiles

                               # for a running jump, facing right.

                         

       SJL = -4        # use negative number. This is the ammount you want in tiles

                             # for a running jump, facing left.

      

       RJB = :SHIFT      # this is the button you press for a running jump. the deafult

                                    # is shift

      

    end

     

    #The button to be used for jumping:

    JUMP_KEY = :X
    As well as replace this:

    1.  def jump_forward_field
    2.     return jump_straight(0,2)  if @direction == 2
    3.     return jump_straight(-2,0) if @direction == 4
    4.     return jump_straight(2,0)  if @direction == 6
    5.     return jump_straight(0,-2) if @direction == 8
    6.   end
    with this

    def jump_forward_field

       if !Input.press?(JE::RJB) then return jump_straight(0,JE::JD)  if @direction == 2 else return jump_straight(0,JE::SJD)  if @direction == 2 end

       if !Input.press?(JE::RJB) then return jump_straight(JE::JL,0)  if @direction == 4 else return jump_straight(JE::SJL,0)  if @direction == 4 end 

       if !Input.press?(JE::RJB) then return jump_straight(JE::JR,0)  if @direction == 6 else return jump_straight(JE::SJR,0)  if @direction == 6 end

       if !Input.press?(JE::RJB) then return jump_straight(0,JE::JU)  if @direction == 8 else return jump_straight(JE::SJU,-4)  if @direction == 8 end

      end
    Also I'm really in love with this script
     
    #18
  19. Diretooth

    Diretooth Lv. 23 Werewolf Veteran

    Messages:
    1,197
    Likes Received:
    435
    Location:
    Earth
    First Language:
    English
    Primarily Uses:
    RMMV
    I just had a brilliant idea that can add on to this script. Accessories that allow jumping, even when the switch is off. This way, without the item, you can't jump.

    As a side note, I've noticed that I can jump on top of walls, which while hilarious, means a more liberal use of the no jumping region.
     
    #19
  20. plasmatorture

    plasmatorture Warper Member

    Messages:
    4
    Likes Received:
    0
    First Language:
    English
    If I wanted the throw command to go three spaces instead of two, how would I accomplish that? I've been staring at the code for a bit and can't figure out what defines the movement speed. Jumping was easy to figure out, on the other hand.
     
    #20

Share This Page