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
> Using "script" in a battle event, Breaks every time
Turkwise
post Jul 6 2011, 02:51 PM
Post #1


Level 5
Group Icon

Group: Member
Posts: 64
Type: Musician
RM Skill: Intermediate




Okay, so here's my problem: using the "Script" button to write a script into an event breaks my battles every time. Even this simple script::

$game_temp.fight_only=true

seems to break my game. That's a custom variable, it affects nothing. (it will later when I figure out how to make a simple switch not break it) What am I doing wrong here? It simply freezes up, no error box or anything.


__________________________
My music thread:

http://www.rpgrevolution.com/forums/index....showtopic=51371

Please feel free to listen, comment, and download. You can use of tracks that are downloadable in your games if you wish.

Go to the top of the page
 
+Quote Post
   
Atoa
post Jul 6 2011, 04:07 PM
Post #2


Level 11
Group Icon

Group: Revolutionary
Posts: 192
Type: Scripter
RM Skill: Masterful




the script call have a bug

if you make any call that returns false, the game will frezze.

There's an script to fix that (you could search for it), or make it return nil.
In most checks, nil will give you the same result as false, unless the check is 'variable == false'

so if you maker 'if variable' or 'if variable == true' the result will be the same for nil and false.

But if it happens even when you make the call return true or another value, maybe there's something conflicting with the code.


__________________________
Go to the top of the page
 
+Quote Post
   
Night_Runner
post Jul 11 2011, 05:42 AM
Post #3


Level 50
Group Icon

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




In the script editor, along the left look for and then click on Game_Temp

You want to add a section among all those attr_accessor bits,
CODE
attr_accessor :fight_only

That makes a section in game_temp called fight_only, and since you now have a section of memory put aside for your flag, you can set it to true/false.

One other thing you might like to do, is when you first make Game_Temp, you would like the fight_only to default to false.
If (while in Game_Temp) you scroll down to
CODE
def initialize
just after that line insert
CODE
@fight_only = false
it will default your flag to false smile.gif

Just be careful with that bug Atoa mentioned though, it causes a lot of grief....


__________________________
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
   

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: 25th May 2013 - 10:21 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker