Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Character-Moving Platforms Script

This should be very simple... I don't have a clue how to get this on, though ^_^ The idea is that every event with a... let's say, a ~ in the event name this time ^_^ is considered being a platform where the hore can stand on. The script checks if the actor has the same coordinates and if the platform moves, it moves the hero in the same direction (without turning or animating, of course), too.
I bet this is going to be most easy when placed in the move script for objects... right?
 
Ok, why not make a script that reads the hero x and y, and when they are the same they lock actor facing and moving animation, and when that changes to
Code:
if @eventy < $game_player.y 
move_down
elsif @eventy> $game_player.y
move_up
end
Btw you would need to edit game_event so that it returned the event ID.
And so on with the x.
I think that would work... but i can't do it because i too busy with my own scripts...Hope that helps though.
 
Hope you don't mind if it is read in the event comments but here it is.


Code:
class Game_Event < Game_Character
    #--------------------------------------------------------------------------
    alias chaosg1_platformer_game_event_update update
    #--------------------------------------------------------------------------
    def name
      return @event.name
    end
    #--------------------------------------------------------------------------
    def id
      return @id
    end
    #--------------------------------------------------------------------------
    def update
      chaosg1_platformer_game_event_refresh_set_page      
      $game_player.event_decoder(self, @list, @character_name)
    end
  end

Since I find SDK easier to use for this kind of things, here is a part of the sdk.
Create a new script a copy paste this.


Code:
module EVE
def self.event_comment_input(*args)
    parameters = []
    list = *args[0].list
    elements = *args[1]
    trigger = *args[2]
    return nil if list == nil
    return nil unless list.is_a?(Array)
    for item in list
      next if item.code != 108
      if item.parameters[0] == trigger
        start = list.index(item) + 1
        finish = start + elements
        for id in start...finish
          next if !list[id]
          parameters.push(list[id].parameters[0])
        end
        return parameters
      end
    end
    return nil
  end
end

This reads the comment in the event and if it says platform does the action next.
Code:
  def event_decoder(event, list, character_name)        
    return if character_name == ""       
    return if list == nil
    parameters = EVE.event_comment_input(event, 1, "platform")    
    return if parameters.nil?    
#do things here
  end
an explanation in how the sdk method work copyed from the sdk of course lol
5.5 – Standard Event Comment Input

Any script that requires input from an event comment should use the
following:

SDK.event_comment_input(event, elements, trigger)

where:
event = an object of the event
elements = the number of elements the method is to process
trigger = the text value triggering the script to start processing

or

SDK.event_comment_input(page, elements, trigger)

where:
page = an object of the event.page
elements = the number of elements the method is to process
trigger = the text value triggering the script to start processing

The method returns nil if the trigger can not be found; otherwise, it
returns a list of the parameters from the event.
This is just a way of doing things there are other though, but I found this one simpler(for me)..

If you need help just ask.. I am still learning too but i think i can help you with this :)
 
ya I forgot that... it was from a script of mine... And I was using the sdk lol,
change that to
Code:
chaosg1_platformer_game_event_update
.
Of course don't used my alias lol use your own!That's mine, and i don't want your dirty hands on it! J/K
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top