Thank you very much.
Script Call Support Boards
RPG Maker VXAce SupportEDIT
Using that call throws this error message
Script 'Game_Interpreter' line 450: NameError occurred.
undefined local variable or method 'id' for
#<Game_Interpreter: 0x9ca921c>
I can't use a player touch, because this is a moving spike puzzle. If it is set to player touch and the player is on the tile before the spike comes up then it doesn't trigger the common event. It therefore has to be set to parallel process. Is it that which is causing the problem?
EDIT AGAIN
Sorry, mods, for double posting, I thought I was editing my previous post, not starting a new one.
Using that call throws this error message
Script 'Game_Interpreter' line 450: NameError occurred.
undefined local variable or method 'id' for
#<Game_Interpreter: 0x9ca921c>
I can't use a player touch, because this is a moving spike puzzle. If it is set to player touch and the player is on the tile before the spike comes up then it doesn't trigger the common event. It therefore has to be set to parallel process. Is it that which is causing the problem?
EDIT AGAIN
Sorry, mods, for double posting, I thought I was editing my previous post, not starting a new one.
You have to change [id] by [15] or whatever event id you want.
Ah, I'm an idiot. Some things never change.
Thank you.
Thank you.
Also, you can use "event_id" to use the current event's id.
@Iavra
That's what I thought I was doing with the first suggestion. This, however, is exactly what I'm looking for so that I can just copy/paste many of them without having to edit each one individually.
thank you
That's what I thought I was doing with the first suggestion. This, however, is exactly what I'm looking for so that I can just copy/paste many of them without having to edit each one individually.
thank you
It depends on what you want it to do. I have a similar this that I do with events changes the save access on the main menu. If you were to simple use event.touch then you can touch the event and walk away without the event refreshing itself.
$game_player.x == $game_map.events[id].x && $game_player.y == $game_map.events[id].yThis is the exact same thing you do with the variables, but you may need a way of refreshing it, so keep that in mind.
You could also call game variables via script. n = variable number, NOT the name. And id, is the event id, NOT the name.
$game_variables[99] = $game_player.x
$game_variables[98] = $game_player.y
$game_variables[97] = $game_map.events[id].x
$game_variables[96] = $game_map.events[id].y
if $game_variables[99] = $game_variables[97] $$ $game_variables[98] = $game_variables[96]
(do code)
else
(do other code)
end
@HollowMonty
That looks an interesting solution, and I can think of a couple of things that it might be useful for, so thank you. I shall put it into my storehouse of script calls.
In this instance the earlier suggestion (with the clarification about event_id as the [id] ) works well, and has the merit of simplicity.
That looks an interesting solution, and I can think of a couple of things that it might be useful for, so thank you. I shall put it into my storehouse of script calls.
In this instance the earlier suggestion (with the clarification about event_id as the [id] ) works well, and has the merit of simplicity.
Glad to be helpful. If you want a handy little list of common script calls, here ya go "Here"
It's been pretty helpful to me.
@HollowMonty
Thank you, yes, I have that thread bookmarked too. It's been something of a life saver on more than one occasion.
Thank you, yes, I have that thread bookmarked too. It's been something of a life saver on more than one occasion.
I'm trying to use an extensive if, elsif statement to change the name in a variable, but i keep this getting error

this is script I am using

this is script I am using
Code:
If $game_variables[67] = 1 $game_variables[68] = "Just Another Fetch Quest"elsif $game_variables[67] = 2 $game_variables[68] = "Revenge"elsif $game_variables[67] = 3 $game_variables[68] = "Out of Control"elsif $game_variables[67] = 4 $game_variables[68] = "Leave Me Alone"elsif $game_variables[67] = 5 $game_variables[68] = "Flowers for Mom"elsif $game_variables[67] = 6 $game_variables[68] = "Healing Burns"elsif $game_variables[67] = 7 $game_variables[68] = "Epic Lootz"elsif $game_variables[67] = 8 $game_variables[68] = "Scavenger Hunt"elsif $game_variables[67] = 9 $game_variables[68] = "Finding a Tenant"elsif $game_variables[67] = 10 $game_variables[68] = "Dessert in the Desert"end
You have to Initialize the first variable.
If that variable has no value then none of those statements are true.
Either make another elsif $game_variables[67] = nil
or set the variable prior to calling this script.
nil means "no value" It's what all variables are set to when starting a project.
EDIT:
Also notices your first "if" has a capitol "I" things are case sensitive and it wont work unless it's lowercase.
Woooooooooooow, thank you so much. That capital letter at the beginning was what was messing everything up!
I always feel like such a noob when I make mistakes like that
Comparisons are done with "==", you are setting the variable inside your if. This will interpret the new value as a boolean, which always returns true.
Yeah I just went and tested his script and it was so funky. Here what I ended up changing it to.
if $game_variables[67] == 1 $game_variables[68] = "Just Another Fetch Quest"endif $game_variables[67] == 2 $game_variables[68] = "Revenge"endif $game_variables[67] == 3 $game_variables[68] = "Out of Control"endif $game_variables[67] == 4 $game_variables[68] = "Leave Me Alone"endif $game_variables[67] == 5 $game_variables[68] = "Flowers for Mom"endif $game_variables[67] == 6 $game_variables[68] = "Healing Burns"endif $game_variables[67] == 7 $game_variables[68] = "Epic Lootz"endif $game_variables[67] == 8 $game_variables[68] = "Scavenger Hunt"endif $game_variables[67] == 9 $game_variables[68] = "Finding a Tenant"endif $game_variables[67] == 10 $game_variables[68] = "Dessert in the Desert"endIt checks each individually so it's more straightforward. In coding, the more simplistic the answer is, the better it is. In my book anyway.
I had to split it up into 2 script sections in an event, and when I tested it, it doesn't like using event calls to change variable 67 so I ended up replacing the event call with just a simple $game_variables[67] = 1 or whatever it was, for whatever choice. Everything will run pretty smooth with that, As far as I could tell anyway. Only tested a little bit.
No worries buddy. I only started scripting about a week or so ago. If you dive into it with a bit of interest, it's not so hard. Try following this guys intro, helped me a bunch. "Here" just hit the 'Programming and Mathematics' button at the top of that page to look at the other parts.
thanks again for the help, i've implemented the changes and it run fine now 🙂
No problem.
You can also use case for better readability
Code:
$game_variables[68] = case $game_variables[67] when 1 "Just Another Fetch Quest" when 2 "Revenge" when 3 "Out of Control" when 4 "Leave Me Alone" when 5 "Flowers for Mom" when 6 "Healing Burns" when 7 "Epic Lootz" when 8 "Scavenger Hunt" when 9 "Finding a Tenant" when 10 "Dessert in the Desert" end
That does make it a lot easier to read, I might have to consider that format as well
If you are going this way, i would split configuration and logic and do it like this:
Configuration somewhere in a module:
MAPPING = { 1 => "Just Another Fetch Quest", 2 => "Revenge", ...}
Actual call:
Configuration somewhere in a module:
MAPPING = { 1 => "Just Another Fetch Quest", 2 => "Revenge", ...}
Actual call:
Code:
$game_variables[68] = <module_name>::MAPPING[$game_variables[67]] || $game_variables[68]
Original thread: https://forums.rpgmakerweb.com/threads/script-call-support-boards.25767/