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.

Calling Switches from Scripts

Heya all. I have a char gen script. When a user selects a specific Profession, i want to be able to call in game switches with their selected profession..

What i would like to do, if someone selects FIGHTER.. It would make it, so when they enter the game they have Switches 101 200 and 316. Those switches activate a certain line of profession exclusive quests that give an introduction on game play mechanics as they directly affect their character.

What i would like to do, is edit the char generator, so if they select fighter, it auto calls the scripts.. Anyone have any suggestions? Prehapes this can be acomplished without editing the scripts at all..

Any advice?

Thanks

michael
 
Ok maybe you can help, basicly my script looks like this.

when "Male"
$data_classes[1].graphic = ["char 1"]
$data_classes[2].graphic = ["char 1"]
$data_classes[3].graphic = ["char 1"]

when "Female"


$data_classes[1].graphic = ["char 1"]
$data_classes[2].graphic = ["char 1"]
$data_classes[3].graphic = ["char 1"]

This is what i got, minus the chars names.. If i wanted when you selected Male Graphic char 1. I want switch 172 to load.. What would be the best way to write this
 
when "Male"
$data_classes[1].graphic = ["char 1"]
$data_classes[2].graphic = ["char 1"]
$data_classes[3].graphic = ["char 1"]

when "Female"


$data_classes[1].graphic = ["char 1"]
$data_classes[2].graphic = ["char 1"]
$data_classes[3].graphic = ["char 1"]

I tried putting it like this

$data_classes[1].graphic = ["char 1"]
$game_switches[switch number] = true

and it would crash.. Just to be clear. This game switch isnt launching from a script IN GAME. Its launching from a script in RGSS above main..
 
They use the same syntax, so something is wrong with your script <_<

Now that I think about it...

Classes do not have graphics.
Graphics are not arrays, it'd be RPG::Cache. something, or the graphic name....

Also, your script is setting the nonexistant graphics to the same thing regardless of if male/female is chosen.

$game_switches[switch number] = true/false is the correct syntax, another person told you the same thing over at the CA, your script for whatever it is is most likely the problem <_<;
 
well what do you purpose to be more effective.. Really all the script does, is allow the players to select say a fighter class, then have 15 avatars to choose from, in order to play, i just want to launch the script from any of their 15 deciesions to load a single script, i dont want to load the script in game, but more or less its launched within the char gen itself.
 

TheOrc

Member

I've just started scripting in RGSS, but I believe it should work like this:

If $game_switches[switch number] = true/false
#Code
Else
#Code
end

Something like that.
 
well in my char gen script under edit scripts..

i put something like this

$data_classes[1].graphic = ["char 1"]
$game_switches[switch number] = true

i get this error

undefined local vartible or method 'number' for #<rpg::update:0x6d3eb30.
 
I know that i just cut and pasted one of the earlier threads, i tried all the switch numbers, the right ones, lik e 176-187 range..

That was just a bad cut and paste, switch number just sez 172
 

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