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

Slippery floor system

Question

I'm looking for a script for an ice floor similar to the one in pokemon games. I've tried using terrain tags and common events, but i can still change directions while sliding on the ice. the only way i've managed to this is with a ton of events, but that causes a lot of lag. I would use scripts, but I can't seem to figure out how it would be done. any suggestions?

Share this post


Link to post
Share on other sites

22 answers to this question

Recommended Posts

  • 0

hey bob, I actually wrote a small script that does this a while back when I was messing around with the pokemon starter kit, its pretty simple:

class Game_Character
  SLIDE_TAG = 5
  alias init_ice initialize
  def initialize
    init_ice
    @sliding = false
  end
end
class Game_Player < Game_Character
  alias update_ice update
  def update
    if @sliding
      unless moving? || $game_system.map_interpreter.running? ||
          @move_route_forcing || $game_temp.message_window_showing
          case @direction
          when 2
            if $game_map.terrain_tag(@x, @y) == SLIDE_TAG && $game_map.passable?(@x, @y + 1, 8)
              move_down
            else
              @sliding = false
            end
          when 4
            if $game_map.terrain_tag(@x, @y) == SLIDE_TAG && $game_map.passable?(@x - 1, @y, 6)
              move_left
            else
              @sliding = false
            end
          when 6
            if $game_map.terrain_tag(@x, @y) == SLIDE_TAG && $game_map.passable?(@x + 1, @y, 4)
              move_right
            else
              @sliding = false
            end
          when 8
            if $game_map.terrain_tag(@x, @y) == SLIDE_TAG && $game_map.passable?(@x, @y - 1, 2)
              move_up
            else
              @sliding = false
            end
          end
      end
    else
      case Input.dir4
      when 2
        if $game_map.terrain_tag(@x, @y + 1) == SLIDE_TAG
          @sliding = true
        end
      when 4
        if $game_map.terrain_tag(@x - 1, @y) == SLIDE_TAG
          @sliding = true
        end
      when 6
        if $game_map.terrain_tag(@x + 1, @y) == SLIDE_TAG
          @sliding = true
        end
      when 8
        if $game_map.terrain_tag(@x, @y - 1) == SLIDE_TAG
          @sliding = true
        end
      end
    end
    update_ice
  end
end

 

this only manages sliding for the player, it would probably be pretty easy to implement for events too, just let me know if you need events to slide around and ill look into adding that to it :)

Share this post


Link to post
Share on other sites
  • 0

thanks, it looks like it's actually set to the same terrain tag i was using anyway lol

 

edit: It doesn't seem to be doing anything...

 

and i can already do it for events with eventing :P

Edited by Bob423

Share this post


Link to post
Share on other sites
  • 0

its definitely working for me, just put it in a fresh project to make sure it had no other dependacies, I know that you use blizz abs and other scripts so maybe one of them are messing it up somehow, make sure you have got your terrain tags right, if thats not the case pm me a demo and ill see whats up

Share this post


Link to post
Share on other sites
  • 0

yea, that's the problem. too many scripts :(

also can you make it so the player's move animation is turned off while sliding?

Edited by Bob423

Share this post


Link to post
Share on other sites
  • 0

you can never have TOO many scripts, its whether the scripts are structured to support each other, what script conflicts? it could be a simple case of that the author of said script/s are not aliasing methods i am using, and a simple fix to that would be to place my script below theres, anyway yes Ill add that feature now, it does look a bit wierd the character walking :P

edit:

alright I added it so the animation is of, right now it just freezes at the frame from when the player stepped onto the surface, I think it looks pretty cool like that, but depends what you think, if you need it to I can make the frame reset to the default

class Game_Character
  SLIDE_TAG = 5
  alias init_ice initialize
  def initialize
    init_ice
    @sliding = false
    @old_walk_anime = true
  end
end
class Game_Player < Game_Character
  alias update_ice update
  def update
    if @sliding
      unless moving? || $game_system.map_interpreter.running? ||
          @move_route_forcing || $game_temp.message_window_showing
          case @direction
          when 2
            if $game_map.terrain_tag(@x, @y) == SLIDE_TAG && $game_map.passable?(@x, @y + 1, 8)
              @walk_anime = false if @walk_anime
              move_down
            else
              @sliding = false
              @walk_anime = @old_walk_anime
            end
          when 4
            if $game_map.terrain_tag(@x, @y) == SLIDE_TAG && $game_map.passable?(@x - 1, @y, 6)
              @walk_anime = false if @walk_anime
              move_left
            else
              @sliding = false
              @walk_anime = @old_walk_anime
            end
          when 6
            if $game_map.terrain_tag(@x, @y) == SLIDE_TAG && $game_map.passable?(@x + 1, @y, 4)
              @walk_anime = false if @walk_anime
              move_right
            else
              @sliding = false
              @walk_anime = @old_walk_anime
            end
          when 8
            if $game_map.terrain_tag(@x, @y) == SLIDE_TAG && $game_map.passable?(@x, @y - 1, 2)
              @walk_anime = false if @walk_anime
              move_up
            else
              @sliding = false
              @walk_anime = @old_walk_anime
            end
          end
      end
    else
      case Input.dir4
      when 2
        if $game_map.terrain_tag(@x, @y + 1) == SLIDE_TAG
          @sliding = true
          @old_walk_anime = @walk_anime
        end
      when 4
        if $game_map.terrain_tag(@x - 1, @y) == SLIDE_TAG
          @sliding = true
          @old_walk_anime = @walk_anime
        end
      when 6
        if $game_map.terrain_tag(@x + 1, @y) == SLIDE_TAG
          @sliding = true
          @old_walk_anime = @walk_anime
        end
      when 8
        if $game_map.terrain_tag(@x, @y - 1) == SLIDE_TAG
          @sliding = true
          @old_walk_anime = @walk_anime
        end
      end
    end
    update_ice
  end
end
Edited by diagostimo

Share this post


Link to post
Share on other sites
  • 0

i know that you can't have too many scripts, and I know for a fact that blizz-abs plays with the classes you used in your script. also i put your script below everything and above main before testing the first time. i always do. rarely do new scripts need to be above older scripts.

Share this post


Link to post
Share on other sites
  • 0

Hey Bob, you said that you mastered this very function in another topic
http://www.gdunlimited.net/forums/topic/7191-trouble-with-an-icy-floor-mechanic/?hl=ice&do=findComment&comment=62300
 
Hehe.
 
Also there's this made by Arkbennett: http://www.gdunlimited.net/forums/files/file/238-arkbennetts-ice-sliding-deluxe/
 
@diagostimo: if you wanted to be really awesome, you could sumit your scripts into the archive, and then you could just link to that http://www.gdunlimited.net/scripts/create I see you've wrote several scripts in these types of topics, good work :thumbsup:

Share this post


Link to post
Share on other sites
  • 0

um...i...er...thought i did lol

i kinda meant that i do it all the time. I never figured out how to do it without lag though.

and thanks, i'll try that script out later

 

edit: it worked, but I have one problem. every time i go from left to right, and hit something in the middle of the ice, i can't move. and I'm 99.9999999999999% sure I did it right.

 

edit2: Ok this is really weird. the "ignore if cant move" thing doesn't work when i go to the right. works in the demo, but not my game...or somethingg. when I hold CTRL (to go through stuff), i go straight through the rock, even after having stopped. it wants to keep going, but can't

 

edit3: it's not just when going right. I have an ice floor that isn't square, and has corners and stuff, so some of the events have 2 conditional branches. and for some reason, it's not working when there's only one

 

edit4: i must be doing something wrong...hold on...doing more tests

 

edit5: Ok I have no idea what's going on, this is stupid.

Edited by Bob423

Share this post


Link to post
Share on other sites
  • 0

@bob, did you find out which script was conflicting with mine, it might be a really easy fix and save you the trouble of eventing it, @marked, ill go through all my script snippets iv posted and add those worthy within the next few days

Share this post


Link to post
Share on other sites
  • 0
i know that you can't have too many scripts, and I know for a fact that blizz-abs plays with the classes you used in your script. also i put your script below everything and above main before testing the first time. i always do. rarely do new scripts need to be above older scripts.

It's the only one that COULD be conflicting with your script. it does a lot of weird stuff with player movement and events, so i'm not really surprised that neither one of those systems worked.

if i was good enough at scripting, i'd find it myself, but blizz-abs is huge and confusing. you can download it and look through it if you want http://forum.chaos-project.com/index.php?topic=106.0

Share this post


Link to post
Share on other sites
  • 0

did you get an error when you tried using it bob? I downloaded the most recent version of blizz abs and was faced imediatly with an error, changing the class name too: 

class Game_Player < Map_Actor

solved the issue and it works fine, as in blizz abs it has its own sub classes and when I added to it I changed the child class that it used

Share this post


Link to post
Share on other sites
  • 0

@diagostimo you need to do something to get blizz-abs to work. it never works when you install it without doing anything.

what class did you change?

and no, i didn't get an error.

 

@bigace i'll try that now, thanks

edit: that script didn't do anything. :(

autotiles shouldn't effect anything right?

Edited by Bob423

Share this post


Link to post
Share on other sites
  • 0

works in a new project, must be the Blizz-ABS. I'll take a quick look but I'm not really good a fixing compatibility errors.

Share this post


Link to post
Share on other sites
  • 0

in my script change "class Game_Player < Game_Character" to "class Game_Player < Map_Actor", just the class name, I have it working in my project like that with blizz abs, that fix would probably work for bigace's too, autotiles shouldnt effect it as im using them

Edited by diagostimo

Share this post


Link to post
Share on other sites
  • 0

I think its demo time, must be something other than blizz abs as it works flawlessly for me, what version of blizz abs do you have, it is the most recent?

Share this post


Link to post
Share on other sites
  • 0

umm that's pretty weird, I replaced the scripts with yours and im sliding around like crazy, if your terrain tag is definitely right, what about save data? try it in a new game 

Share this post


Link to post
Share on other sites
  • 0

weird...it works now. i hate when this happens. well, at least i know it works. i'll do a full play test once im done with everything, so i can just skip testing this for now. thanks :D

Share this post


Link to post
Share on other sites
  • 0

no problem, but you will definitely need to keep the edit to the class name for the compatibility with blizz abs, always test new scripts on a new game, as initialization of a script only happens when the new game option is selected, basicaly if you ever see that a script plays with the initialize method of a class then it needs to be a fresh game for it to work properly

Share this post


Link to post
Share on other sites
  • 0

Well my game freezes when I combine the two and since diagostimo works for you I guess I don't have to worry about compatiblity. However diagostimo, your script now won't work without Blizz-ABS now right. I suggest using doing this instead.

 

name = $BlizzABS ? "BlizzABS::Controller" : "Game_Player < Game_Character"
eval_text = "
class #{name}

[put all of your Game_Player in your script here]

end"

or

name = $BlizzABS ? "Map_Actor" : "Game_Character"
eval_text = "
class Game_Player < #{name}

[put all of your Game_Player in your script here]

end"

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