Khas Blocking by value

LynX

Veteran
Veteran
Joined
Jan 6, 2014
Messages
81
Reaction score
8
First Language
Polish
Primarily Uses
HI I have a question im using SaS IV Saphire Battle system with aditional BLocking script and there is a setup at the begining of the script which looks like this:

 


module Block_Core
  
  # Key used to block (default is R, which means W on your keyboard)  
  Block_Key = Input::R
  
  # Sprite name
  # If the current character sprite is "Adam", when the hero is blocking
  # it's sprite will be "Adam_block"
  Block_Character_Name = ""
  
  # Sprite index
  Block_Character_Index = 0
  
  # Block duration (in frames)
  Block_Duration = 20
  
  # Block cooldown (in frames)
  Block_Cooldown = 1
  
end




and I wan to set up the Block_Duration to a specific value taken from variable
I tried using it like this: Block_Duration = $game_variables[5] but Im getting error... anyone knows how to put it in correct way?
Khas isnt answering any question so Im asking here...


 
 

Zalerinian

Jack of all Errors
Veteran
Joined
Dec 17, 2012
Messages
4,696
Reaction score
935
First Language
English
Primarily Uses
N/A
You can't do it like that, because it will try to get the current value of the variable when the game is starting up. However, the variables don't exist until after the game is done loading all the scripts in, and the values here are set while loading the scripts. That's why you're getting the error when trying to use the variables, they don't exist at this point. In order to use a variable to determine the block duration, parts of the script will need to be edited to account for the variable. You won't be able to do that with the default script.
 

LynX

Veteran
Veteran
Joined
Jan 6, 2014
Messages
81
Reaction score
8
First Language
Polish
Primarily Uses
You can't do it like that, because it will try to get the current value of the variable when the game is starting up. However, the variables don't exist until after the game is done loading all the scripts in, and the values here are set while loading the scripts. That's why you're getting the error when trying to use the variables, they don't exist at this point. In order to use a variable to determine the block duration, parts of the script will need to be edited to account for the variable. You won't be able to do that with the default script.
Yeah thanks... figured it out after 2h :p needed to add this $game_variable as a value of colddown :p now its working really good.

We can close it.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I should realize that error was produced by a outdated version of MZ so that's why it pop up like that
Ami
i can't wait to drink some ice after struggling with my illness in 9 days. 9 days is really bad for me,i can't focus with my shop and even can't do something with my project
How many hours have you got in mz so far?

A bit of a "sparkle" update to the lower portion of the world map. :LZSexcite:
attack on titan final season is airing tomorrow, I'm excited and scared at the same time!

Forum statistics

Threads
105,882
Messages
1,017,231
Members
137,607
Latest member
Maddo
Top