Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Problems with input
squidgy617
post Nov 21 2011, 06:45 PM
Post #1


Level 1
Group Icon

Group: Member
Posts: 5
Type: None
RM Skill: Undisclosed




Hi guys. Let me just say, I'm new here, but I've been trying to get this question answered for a few months and haven't found help anywhere. I've asked on multiple forums and nobody has managed to answer this. I'm hoping someone here is experienced enough to help with the problem.

Anyway, I'm working on a game using bits and pieces of different scripts. One of which is Vampyr's ABS. In it, your party member's follow you, and you can switch between which you control. I managed to make it so that the party members do not always follow you, but I am attempting to make a button to toggle whether they do or not. Here are some scripts I'm using:
This script gives is the one in Vampyr's ABS that has the party member's following you.
CODE
def update_movement
    return if $game_map.interpreter.running?
    return if moving?
    return if self.freeze or (self.anime_attack/2) > 0
    if $game_player.dash? and self.target == $game_player
      @move_speed = 5
    else
      @move_speed = self.original_move_speed
    end
    if @target.nil? or @command >= 2
      self.target = $game_player
    else
      for monster in $game_monsters.compact
        next if monster.actor.dead?
        if in_range?(self, monster, 3) and !self.lock_target
          self.target = monster
          self.lock_target = true
        elsif !self.lock_target
          self.target = $game_player
        end
      end
      for event in $game_map.events.values
        if event.in_battle and in_range?(self, event, 3) and !self.lock_target
          next if event.object or event.puzzle
          self.target = event
          self.lock_target = true
        elsif !self.lock_target
          self.target = $game_player
        end
      end
    end
    move_toward(self.target)
  end

More specifically, this portion is the one that controls it:
CODE
move_toward(self.target)


Someone helped me by making a script to toggle whether they follow the player or not. This is the script: in it, pressing X is supposed to make the characters follow you.
CODE
class Game_Ally < Game_Character
  
  Moving_Switch_Button = Input::X
  
  alias __initialize_old__ initialize unless $@
  def initialize(*args,&block)
    __initialize_old__(*args,&block)
    @moving_allowed = true
  end
  
  alias __update_old__ update unless $@
  def update(*args,&block)
    __update_old__(*args,&block)
    @moving_allowed = !@moving_allowed if Input.trigger?(Moving_Switch_Button)
  end
  
  alias __move_toward__ move_toward unless $@
  def move_toward(*args, &block)
    return unless @moving_allowed
    __move_toward__(*args, &block)
  end
end

The problem is that no matter what I change "Input::X" to, it does nothing. I intend to use ALT as the toggle key in my script. No matter what I do, absolutely nothing happens upon pressing the key. I don't know what the problem is at all.

To help you guys help me, I'm providing my project here too:
Download
Thanks in advance for help. I've been waiting months to have this question answered. Let me know if you need additional information.
Go to the top of the page
 
+Quote Post
   
Penguin
post Nov 21 2011, 08:26 PM
Post #2


I'll evolve any time now.
Group Icon

Group: Revolutionary
Posts: 225
Type: Event Designer
RM Skill: Masterful




"X" isn't actually the X key. It matches up to another key. Press F1, and it will show what it matches up to on the second tab.


__________________________
Go to the top of the page
 
+Quote Post
   
Night5h4d3
post Nov 22 2011, 01:51 PM
Post #3


The past tense
Group Icon

Group: +Gold Member
Posts: 1,199
Type: Scripter
RM Skill: Undisclosed




You need to put the comment "Follow" in your events if you want them to follow at all. I believe


__________________________
Got 30 minutes? Then you've enough time to play this awesome game:

- potentially promising project page
- thanks holder
My growing space of user-bars:

about me:







I made the following!





Go to the top of the page
 
+Quote Post
   
squidgy617
post Nov 22 2011, 01:55 PM
Post #4


Level 1
Group Icon

Group: Member
Posts: 5
Type: None
RM Skill: Undisclosed




Either way, that's not the problem. No matter what I change it to, it does nothing. If its set to X, then A does nothing. If its set to ALT, alt does nothing. My goal is to make it work by pressing alt, but for whatever reason, no matter what I do, it does nothing.
EDIT: Ninja'd. I'll try that. I'm not sure it will work, however, as its not events I'm trying to make follow.

EDIT: Didn't work. I don't know how exactly Vampyr's ABS does it, but it creates the party members following you. I'm not sure if they're events or not, but if they are, I don't know how to edit them as they are not on the map until you add them to your party.

This post has been edited by squidgy617: Nov 22 2011, 01:58 PM
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Nov 22 2011, 03:40 PM
Post #5


Level 50
Group Icon

Group: +Gold Member
Posts: 1,525
Type: Scripter
RM Skill: Undisclosed




First thing to do is to put
CODE
    move_toward(self.target)

back inside the update_movement script, if you take it out then your allies will never follow anything.

Actually, that's all you need to do..


__________________________
K.I.S.S.
Want help with your scripting problems? Upload a demo! Or at the very least; provide links to the scripts in question.

Most important guide ever: Newbie's Guide to Switches
Go to the top of the page
 
+Quote Post
   
squidgy617
post Nov 22 2011, 06:06 PM
Post #6


Level 1
Group Icon

Group: Member
Posts: 5
Type: None
RM Skill: Undisclosed




...Wow. That was REALLY simple. Thank you so much! I've been waiting for such a long time.

This pretty much solves my problem, but while I'm at it, I might as well ask: Is there a way I could possibly make it so upon pressing a key, your party members teleport to you?
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 23rd May 2013 - 03:53 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker