Scripting Help

Joined
Sep 16, 2013
Messages
28
Reaction score
0
First Language
English
Primarily Uses
Hey everyone, I need help with my game. I am running a script [http://www.rpgmakervxace.net/topic/16399-common-event-on-battle-end/] that at the end of battle processes a common event that reverts the player back from a transformed state. It works well later in the game where you use said ability in battle and need to change back at the end. However, in the beginning of the game, there is a sequence where you are supposed to remain in a transformed state for the entire dungeon, through battle and all. 

My question is, is there a way that I can change the value of the script here:



In game so that after a certain point the script takes hold as opposed to having to wipe this entire opening sequence from the game and starting fresh? :(
 
Last edited by a moderator:

Alexander Amnell

Jaded Optimist
Veteran
Joined
Mar 17, 2012
Messages
3,404
Reaction score
1,733
First Language
English
Primarily Uses
N/A
You see the part you have highlighted that says ENABLE_SWITCH_ID? go into the event editor and turn the switch with that id off and according to the scripts documentation it should prevent the game from processing the common event after battle until after you turn the switch back on.

For future reference: When you ask for script help it is always best to link to the page where you got the script from (don't post the whole script, just link to the url of the page where the author posted it.) because a single screenshot will rarely have the information you need to figure these kinds of questions out and not everyone knows and is familiar with the same scripts.
 
Last edited by a moderator:

Zoltor

Veteran
Veteran
Joined
Jan 18, 2014
Messages
1,550
Reaction score
211
First Language
English
Primarily Uses
This is one of those situations, where It's way, way, way better to just use eventing for this whole system.

As formaking the Opening scenes's allow you to stay transformed, that's simple as well, you need to make another spell or whatnot that transforms the player in the exact form, just don't make this version of the tranformation spell, turn on a switch, so the common event wont revert form. Now the char will remain transformed after battle.

After all the cut scenes are done, you can remove that spell from the char, and give it the reg version of the spell.
 
Last edited by a moderator:
Joined
Sep 16, 2013
Messages
28
Reaction score
0
First Language
English
Primarily Uses
You see the part you have highlighted that says ENABLE_SWITCH_ID? go into the event editor and turn the switch with that id off and according to the scripts documentation it should prevent the game from processing the common event after battle until after you turn the switch back on.

For future reference: When you ask for script help it is always best to link to the page where you got the script from (don't post the whole script, just link to the url of the page where the author posted it.) because a single screenshot will rarely have the information you need to figure these kinds of questions out and not everyone knows and is familiar with the same scripts.
http://www.rpgmakervxace.net/topic/16399-common-event-on-battle-end/

This is the script that I am using here, I don't think that the switch is an editable one using events.

This is one of those situations, where It's way, way, way better to just use eventing for this whole system.

As formaking the Opening scenes's allow you to stay transformed, that's simple as well, you need to make another spell or whatnot that transforms the player in the exact form, just don't make this version of the tranformation spell, turn on a switch, so the common event wont revert form. Now the char will remain transformed after battle.

After all the cut scenes are done, you can remove that spell from the char, and give it the reg version of the spell.
The problem is that the skill calls a common event that changes all the stats, gives new abilities and a few other things, and the common event called on the battle end basically reverts those changes, it's not as easy as making a new spell as the script will still run the common event that changes you back regardless.
 

Alexander Amnell

Jaded Optimist
Veteran
Joined
Mar 17, 2012
Messages
3,404
Reaction score
1,733
First Language
English
Primarily Uses
N/A
The switch is editable, that's why it is defined the way it is. That reference links back to the switches used in the eventing system: (Open up an event/common event: right click and press insert/control switches/single and find the switch id (1 by default, but you can change that if you want in the script, that's why it is configurable.) A lot of scripts do this with their features because there are times when you don't want to run them and usually scripters will account for that by having the script reference a switch to determine whether or not to run.
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
I don't think that the switch is an editable one using events.
Then you're thinking wrong - the entire reason for that line is to make the script controllable by event commands, so of course the ID programmed there correspondences with the IDs of the general switches.However, I suggest changing that ID to another one before using the switch - a lot of scripts use the default ID=1 for the switches, and you need to have every such script controlled by different switches, or one control switch event command would change every script...

I suggest going to your event switch list, look for a switch that is still unused, name that switch for the script function and then place that switch's ID number into the script.
 
Joined
Sep 16, 2013
Messages
28
Reaction score
0
First Language
English
Primarily Uses
The Enable_Switch doesn't have an ID, that 1 is a Boolean, it just means it's on, not corresponding with an switch.
 
Last edited by a moderator:

Alexander Amnell

Jaded Optimist
Veteran
Joined
Mar 17, 2012
Messages
3,404
Reaction score
1,733
First Language
English
Primarily Uses
N/A
The Enable_Switch doesn't have an ID, that 1 is a Boolean, it just means it's on, not corresponding with an switch.
No, it isn't. It is a reference to a boolean(a switch) but it itself is not one. This script is very simple, look at this part.

class <<self;alias hbk_ssceobe_process_victory process_victory;enddef self.process_victorySceneManager.scene.process_common_event(HBK::BattleEnd::Victory_Common_Event_ID) if $game_switches[HBK::BattleEnd::Enabled_Switch]hbk_ssceobe_process_victoryendSee where it says "If $game_switches[HBK::BattleEnd::Enabled_Switch]?

$game_switches references the id of the in game switches, and compares it to Enabled_Switch to get an id to check. The reason that setting the id to 0 cuts off the script isn't because the value of Enabled_Switch is a boolean (though it returns one) but because switch id 0 means that it doesn't have a switch to even check, thus it will always come up false.
 
Last edited by a moderator:
Joined
Sep 16, 2013
Messages
28
Reaction score
0
First Language
English
Primarily Uses
No, it isn't. It is a reference to a boolean but it itself is not one. This script is very simple, look at this part.

class <<self;alias hbk_ssceobe_process_victory process_victory;enddef self.process_victorySceneManager.scene.process_common_event(HBK::BattleEnd::Victory_Common_Event_ID) if $game_switches[HBK::BattleEnd::Enabled_Switch]hbk_ssceobe_process_victoryendSee where it says "If $game_switches[HBK::BattleEnd::Enabled_Switch]?

$game_switches references the id of the in game switches, and compares it to Enabled_Switch. The reason that setting the id to 0 cuts off the script isn't because the value of Enabled_Switch is a boolean (though it returns one) but because switch id 0 means that it doesn't have a switch to even check, thus it will always come up false.
So I should create a Switch and name it "Enabled_Switch" and set it to off and that should disable the script?
 
Joined
Sep 16, 2013
Messages
28
Reaction score
0
First Language
English
Primarily Uses
Success! Thanks so much for all your help! I'm sorry I'm an idiot guys! 

Nevermind, I spoke prematurely. 
 
Last edited by a moderator:

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
So I should create a Switch and name it "Enabled_Switch" and set it to off and that should disable the script?
You do not create a switch, they are already created - you just need to use the event windows to name it and make sure that the ID you're using is not yet used by something else. The last part is neccessary because you cannot create those switches, they're defined in the event system and can be used by events or scripts as however an eventer or scripter wants to.
 
Joined
Sep 16, 2013
Messages
28
Reaction score
0
First Language
English
Primarily Uses
I named a switch "Enabled_Switch" on Switch ID 100. I turned it off, and then after the even turned it on. however it is not activated now and the script doesn't run.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
DogGirlKari, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


If you want to add something, and the last post in a topic is your own, then edit that post - don't add another post.


To your problem:


Have you changed the configuration line to


Enabled_Switch = 100


when you decided to use switch 100 for this?


And have you made a new game or loaded an old game when testing? You'll need a new game when you change scripts, because part of the script data is in saved games, and loading an old savegame after script changes will also load the old configuration data...


Edit:


And it is much better if you name the switch after the script, NOT simply "enabled switch" - you'll never know which switch is used by script if you don't use unique names, and the script can't read the switch's name anyway, that name is just for human convenence...
 
Last edited by a moderator:
Joined
Sep 16, 2013
Messages
28
Reaction score
0
First Language
English
Primarily Uses
DogGirlKari, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.

If you want to add something, and the last post in a topic is your own, then edit that post - don't add another post.

To your problem:

Have you changed the configuration line to

Enabled_Switch = 100

when you decided to use switch 100 for this?

And have you made a new game or loaded an old game when testing? You'll need a new game when you change scripts, because part of the script data is in saved games, and loading an old savegame after script changes will also load the old configuration data...

Edit:

And it is much better if you name the switch after the script, NOT simply "enabled switch" - you'll never know which switch is used by script if you don't use unique names, and the script can't read the switch's name anyway, that name is just for human convenence...
I just did a new playthrough and the same issue, I renamed the Switch, I double triple checked that they are all reading ID=100 and made sure that the switch was being turned on, still nothing.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
I double triple checked that they are all reading ID=100
What did you mean "ALL"???There is a single line where you should have placed the 100.

Please provide the current configuration screenshot for the script, similiar to the screenshot you did in your original post (#1).

Script line 38 is the critical line
 
Joined
Sep 16, 2013
Messages
28
Reaction score
0
First Language
English
Primarily Uses
What did you mean "ALL"???

There is a single line where you should have placed the 100.

Please provide the current configuration screenshot for the script, similiar to the screenshot you did in your original post (#1).

Script line 38 is the critical line
By "all", I simply meant the Switch controls in the events in game were modifying Switch ID 100, only line 38 of the Script has ID 100 listed for the Enable Switch, the rest are set to Comment Event 008.

 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
31,365
Reaction score
7,675
First Language
German
Primarily Uses
RMMV
I've reread your previous posts, and I think you're going at it in the wrong way.


You don't need to shut off this script - you need to change your common event #8 in a way that it detects the maps where it should not re-transform the player, nothing more.


You should keep the change to switch ID 100 to prevent other scripts (who might use switch 1 by default as well) from being mixed up in the logic, but simply turn switch 100 ON at the beginning of the game and then ignore it.


But please post a screenshot of your common event #8, so that we can change that to check for an additional switch...
 

Celianna

Tileset artist
Veteran
Joined
Mar 1, 2012
Messages
10,557
Reaction score
5,592
First Language
Dutch
Primarily Uses
RMMV
I've moved this thread to script support. Please be sure to post your threads in the correct forum next time. Thank you.
 
Joined
Sep 16, 2013
Messages
28
Reaction score
0
First Language
English
Primarily Uses
I don't think you really understand the issue I've having here, since I can't just tell it not to work on certain maps, as it need to be able to happen all the time, except for after one sequence. I cannot get the script to work at all now, trying to fix this has completely broken the intro to my game which I've put nearly 200 hours into, and I don't know how to fix it.

I'm going to go cry for a bit now, when I come back I'll decide whether or not to scrap it...
 

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

Latest Threads

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,868
Messages
1,017,066
Members
137,576
Latest member
SadaSoda
Top