RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
How to insert scripts Calls? Like, in this Dash script...

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 88
I hate to hate things.
I've just added a Dash script in my game - he is simple and small, but with him is possible to control character speed pressing C button. I'd like to insert a script call on the script to control the speed (like, when character is in the world map scenario, his sprites are smaller and he would walk slower.).
 I tried, following some script examples around, but the game crashes complaining of 'no defined method for nil:nill class' or something (i usually see this errors in beta scripts).
 What is this damn 'nill' class? How do you define it? I added the two scripts here, so the scripters could have an idea of what i did...
Any help is welcome... thanks in advance.

Simple DASH Script

Code: [Select]
==============================================================================
# Game_Player Dash
#
# created by NECROFEAR - www.dubealex.com
#==============================================================================
class Game_Player
  alias xrxs25_update update
  def update
    unless moving? or $game_system.map_interpreter.running? or
           @move_route_forcing or $game_temp.message_window_showing
      if Input.press?(Input::C)
         @move_speed = 5
      else
         @move_speed = 4
      end
    end
    xrxs25_update
  end
end


This is mine: i inserted the 'Speedtrue' script calls for control, BUT...  :-[

Code: [Select]
#==============================================================================
# Game_Player Dash
#
# created by NECROFEAR - www.dubealex.com
# Switches added by Ericmor
# Usage: Game_Player.Speedtrue
#             Game_Player.Speedfalse
#==============================================================================
class Game_Player
  alias xrxs25_update update
 
  def Speedtrue
      @Speedtrue_switch  = true
  end
 
  def Speedfalse
      @Speedtrue_switch  = false
  end
 
  def update
    unless moving? or $game_system.map_interpreter.running? or
           @move_route_forcing or $game_temp.message_window_showing
           
    if $Speedtrue.Speedtrue_switch == true         
      if Input.press?(Input::C)
         @move_speed = 5
      else
         @move_speed = 4
      end
    else
         @move_speed = 2
      end
    end
    xrxs25_update
  end
end   

« Last Edit: September 20, 2006, 02:14:02 PM by Ericmor »
I need some real WORKING AVI script in RMXP!
3D ANIMATIONS:
http://www.youtube.com/profile?user=Ericmor
3D and 2D anime ART:
http://ericmor.deviantart.com/gallery/

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
Didn´t I reply here already? Anyways...

What exactly do you need? A script or a mod or instructions how to mod it...?
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

***
Rep:
Level 88
I hate to hate things.
Hi, Blizzard! Thanks for answering, man. I'd like to get instructions how to mod it. With all the scripters around, i thought it would be a simple question to answer.

I also placed a request on your forum for a script call that DEFINES both the dash speed and the normal speed on one call, wich is harder (not for you, i think...).
 Oh, and you didn't answered my question there - but then again, those are different questions, i just using the same script.

 What i want here is simple: I made the second script, but it doesn't work, so i wanna know WHY the script call i placed there doesn't work, and HOW i make it work. I receive an error message with the alterations i did, and i only wish to know why.
 The script follows a simple call logic, but there's some code detail that must be followed for it to work. I wanted to know what must be done for it to work, that's all...

All i did on the DASH script was insert two definions on a switch, and use them for a filter inside the script. I added this:

Code: [Select]
  def Speedtrue
      @Speedtrue_switch  = true
  end
 
  def Speedfalse
      @Speedtrue_switch  = false
  end

Theorically, the script should accept the following filter:

Code: [Select]
if $Speedtrue.Speedtrue_switch == true         
   #....something happens!
      else
   #... other thing happen!
      end

 This line breaks when you run it:

"if $Speedtrue.Speedtrue_switch == true "   

...gives the following error message:

'Script 'Dash', line 24: NoMethodError occcurred'
' undefined method 'Speed_true_switch' for nil:NilClass'

With the script call i placed, the character would have @move_speed=2 when i called Game_Player.Speedfalse from inside the game's script callthat doesn't happen... why?
I need some real WORKING AVI script in RMXP!
3D ANIMATIONS:
http://www.youtube.com/profile?user=Ericmor
3D and 2D anime ART:
http://ericmor.deviantart.com/gallery/

********
EXA
Rep:
Level 92
Pikachu on a toilet
Project of the Month winner for April 2007
You need to inititliaze in the Scene_Title your $Speedtrue first before you can use it. But I think I have something a lot more simple for you. I use it for a debug dash.

Code: [Select]
class Game_Player < Game_Character

  attr_accessor :move_speed
 
end

Use the script call and type

Code: [Select]
$game_player.move_speed = 4

or something like that. You can also just use the conditional branch and a script condition like

Code: [Select]
$game_player.move_speed == 4

to check the speed.
If it´s that what you actually wanted.
Get King of Booze for Android, for iOS, for OUYA or for Windows!
Visit our website.
You can also love/hate us on Facebook or the game itself.


Get DropBox, the best free file syncing service there is!

***
Rep:
Level 88
I hate to hate things.
ALL RIGHT!!! Works!!! Blizzard... you're tha man!!! :D

It work's perfectly. So, "attr_accessor" inside class Game_Player< Game_character, eh? I would NEVER know...
 Cool!  ;D
 With this, the character speed can now be controlled by event calls. We should think of what else doesn't exist inside the editor's event's to make more script calls...
 Again, thanks Blizzard!  :D
I need some real WORKING AVI script in RMXP!
3D ANIMATIONS:
http://www.youtube.com/profile?user=Ericmor
3D and 2D anime ART:
http://ericmor.deviantart.com/gallery/