Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

> How to make a variable control a number in script?
HeartBorne
post Feb 8 2012, 10:13 AM
Post #1



Group Icon

Group: Member
Posts: 3
Type: Event Designer
RM Skill: Skilled




Hey guys smile.gif
The subject is pretty much self explanatory.

I have this line to control the difficulty of the battle system i use:

@ai_level = 2

How can I make a variable control that number?
I've tried some things but none worked, anyone can help?
Go to the top of the page
 
+Quote Post
   
 
Start new topic
Replies
Resource Dragon
post Feb 9 2012, 03:28 PM
Post #2


Dragon has RAWR. So... RAWR.
Group Icon

Group: Local Mod
Posts: 984
Type: Developer
RM Skill: Masterful
Rev Points: 95




@ai_level = $game_variables[5]

This should work fine, as long as you take out the @ sign, so it should be;

ai_level = $game_variables[5]

I see no reason why this wouldn't work, as long it is in the same script your already using it in.

You might have to predefine the variable, thus making it like this;

ai_level = 5
ai_level = $game_variables[5]

Or maybe doing this;

ai_level = 5
ai_level = $game_variables[5].to_i



This post has been edited by Resource Dragon: Feb 9 2012, 03:32 PM


__________________________
click me ->Signup for Digital Hijinks!<- click me
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: 18th June 2013 - 07:08 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker