Futuristic

Villager
Member
Joined
Jan 27, 2014
Messages
5
Reaction score
0
First Language
English
Primarily Uses
What might be causing this script call to fail? 

$game_map.events[2].set_graphic($game_actors[$game_variables[17]].character_name, 

$game_actors[$game_variables[17]].character_index)

 

Alternatively, I also used this variation that failed also

 

v = $game_variables

$game_map.events[2].set_graphic($game_actors[v[17]].character_name,

$game_actors[v[17]].character_index)
 

PNG5.png


It is intended to set the graphic of Event 2 on a map to that of a game actor, determined by the variable 17 (which is set to equal an actor's ID).

I've tried it by itself on an otherwise empty event that just sets the value of Variable 17 and then runs the script call, and it worked fine. Yet when put into a longer running event or into a called common event, it gives the error message. I've done debug tests to find that every process before it gets to this script call works as intended, the script call by itself seems to work as intended, yet the error occurs when the script call is used with the rest of the event (It's the last process in the event, at that) 

Any help? Should I post the event processes prior to the script call also?
 

Yato

(aka Racheal)
Veteran
Joined
Mar 17, 2012
Messages
825
Reaction score
347
Primarily Uses
My guess is the variable is not getting set to a valid actor id for some reason. Try a call of p v[17] (or p $game_variables[17]) after the first line and see what is displayed in the console.
 
Last edited by a moderator:

Futuristic

Villager
Member
Joined
Jan 27, 2014
Messages
5
Reaction score
0
First Language
English
Primarily Uses
My guess is the variable is not getting set to a valid actor id for some reason. Try a call of p v[17] (or p $game_variables[17]) after the first line and see what is displayed in the console.
I did a check of variable 17 before the script call activates, and you're right, it comes out as the wrong number

Earlier in the event, I did 

$game_variables[45] = $game_variables[17] += 200

to make variable 45 = whatever the actor's ID was + 200. However, that script call appeared to make both variables the same # because of the '+=' which I used after seeing it written like that with the Control Variable event functions when you used addition on a variable. So if the Actor's ID (and so V17) was 3, then both Variable 45 and 17 were changed to 203, whereas I only wanted variable 45 to equal the value of V17 + 200. I've changed the previous script call to 

$game_variables[45] = $game_variables[17] + 200
and now I'm getting the right # for the actor ID. Thanks for your help  :D
 
Last edited by a moderator:

ViperX420

Veteran
Veteran
Joined
Mar 28, 2014
Messages
62
Reaction score
23
First Language
English
Primarily Uses
hey Viper, I'm moving that to RGSSX support boards since that is HUGE.
well the part i am modifying is small its the second spoiler

EDIT: i figured i'd include the full script above incase someone needed to reference it for any reason :)
 
Last edited by a moderator:

Archeia

Level 99 Demi-fiend
Staff member
Developer
Joined
Mar 1, 2012
Messages
15,215
Reaction score
15,628
First Language
Filipino
Primarily Uses
RMMZ
You're asking for custom script related help. not script call equivalent of default scripts/events help.
 
Last edited by a moderator:

ViperX420

Veteran
Veteran
Joined
Mar 28, 2014
Messages
62
Reaction score
23
First Language
English
Primarily Uses
You're asking for custom script related help. not script call equivalent of default scripts/events help.
oh i wasn't sure how this thread worked since it was new :) thanks for moving it to its appropriate place.
 

ViperX420

Veteran
Veteran
Joined
Mar 28, 2014
Messages
62
Reaction score
23
First Language
English
Primarily Uses
ok i got one for you that is appropriate for this thread.

Fiber.yield while $game_map.scrolling? # Add this if just the script call below doesn't work.$game_map.start_scroll(direction, distance, speed)# Direction = [2]Down [4]Left [6]Right [8]Up# Distance = How many tiles you want it to scroll# Speed = [1]8x Slower [2]4x Slower [3]2x Slower [4]Normal [5]2x Faster [6]4x Fasterso i'm trying to currently figure how the above works and how it would in turn get scripted together with an input triggers so when i push up down left or right while the scroll map is triggered it'll move around the map like it should. I figured it out using conditional branches with events but the scripting side of it is another story.

First i need to understand how the setup would be done below.

Would it all be together like this?

Fiber.yield while $game_map.scrolling? # Add this if just the script call below doesn't work.$game_map.start_scroll(direction, distance, speed)Direction = [2, 4, 6, 8] # [2]Down [4]Left [6]Right [8]UpDistance = 1 # How many tiles you want it to scrollSpeed = [6] # [1]8x Slower [2]4x Slower [3]2x Slower [4]Normal [5]2x Faster [6]4x Faster
or would each direction be seperated? like below.

Fiber.yield while $game_map.scrolling? # Add this if just the script call below doesn't work.#--------------# Down Scroll#--------------$game_map.start_scroll(direction, distance, speed)Direction = [2] # [2]Down [4]Left [6]Right [8]UpDistance = 1 # How many tiles you want it to scrollSpeed = [6] # [1]8x Slower [2]4x Slower [3]2x Slower [4]Normal [5]2x Faster [6]4x Faster#--------------# Left Scroll#--------------$game_map.start_scroll(direction, distance, speed)Direction = [4] # [2]Down [4]Left [6]Right [8]UpDistance = 1 # How many tiles you want it to scrollSpeed = [6] # [1]8x Slower [2]4x Slower [3]2x Slower [4]Normal [5]2x Faster [6]4x Faster#--------------# Right Scroll#--------------$game_map.start_scroll(direction, distance, speed)Direction = [6] # [2]Down [4]Left [6]Right [8]UpDistance = 1 # How many tiles you want it to scrollSpeed = [6] # [1]8x Slower [2]4x Slower [3]2x Slower [4]Normal [5]2x Faster [6]4x Faster#--------------# Up Scroll#--------------$game_map.start_scroll(direction, distance, speed)Direction = [8] # [2]Down [4]Left [6]Right [8]UpDistance = 1 # How many tiles you want it to scrollSpeed = [6] # [1]8x Slower [2]4x Slower [3]2x Slower [4]Normal [5]2x Faster [6]4x Faster 
if you could answer that it would point me in the right direction i know it still needs Input.triggers ect but i just need to know about this for now before i try connecting it to a boolean and connect it to my menui.
 
Last edited by a moderator:

ViperX420

Veteran
Veteran
Joined
Mar 28, 2014
Messages
62
Reaction score
23
First Language
English
Primarily Uses
https://www.mediafire.com/?li7tvm2u3uklnjl

here is a demo showing what i need the event is located at the top left of map

input.trigger?:)X) will start the event in-game then directional buttons will allow you to scroll around map and look around.
 

Archeia

Level 99 Demi-fiend
Staff member
Developer
Joined
Mar 1, 2012
Messages
15,215
Reaction score
15,628
First Language
Filipino
Primarily Uses
RMMZ
I should probably clarify. If you're doing anything script related or the Script Editor, you're better off in RGSSX boards. This board is for Event Scripting. Aka using script calls inside events.
 
Last edited by a moderator:

ViperX420

Veteran
Veteran
Joined
Mar 28, 2014
Messages
62
Reaction score
23
First Language
English
Primarily Uses
well i still need to figure it out on both ends i like to make the event version first before then getting it converted over to a script version later i did post a script support thread for the script version, but is there a way to reset the position of the map after scrolling around otherwise your character is offscreen.
 

ViperX420

Veteran
Veteran
Joined
Mar 28, 2014
Messages
62
Reaction score
23
First Language
English
Primarily Uses
It works the same as this, but you can't reset the camera. You need a script for that.
ya i'm working on the script now its actually a simple script to write i'm almost finished thanks for the reply though :) i'm gonna just use the event to run the scrolling map then use the script to return it back to center :)

UPDATE: done finished making the script half of it well at least for now eventually i'm gonna add the other half of the event to the script before releasing anything yet :) Thanks for all the help it really helped me understand what was going on at the time :)
 
Last edited by a moderator:

dinhbat3

Veteran
Veteran
Joined
Feb 5, 2014
Messages
184
Reaction score
31
First Language
English
Primarily Uses
Hello Script Callers!

I want to check if a skill is learned through a common event during battle. Is this the correct script call?

if $game_party.members[x].skills.include?($data_skills[226])

I plan on running it with x=0-3 to check each of the active members in the party.

I am not sure I can use the method skills when referencing party members. If not is there any way around having to do a conditional to see if each possible PC is in party then doing an actor check of skill list?

~ Dinhbat
 

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,166
Reaction score
14,211
First Language
English
Primarily Uses
RMMV
$game_party.members[x].skill_learn?($data_skills[226])


You could use what you have, but internally only the skill id is saved. Your method requires ALL skill ids to be converted to RPG::Skills, then the skill objects being compared with what you send through.


The method I provided does not require anything to be converted - it simply looks for a skill id in the internal list that matches the skill id of what you send through.


It is also the method used by the Conditional Branch.


A more efficient way than looping like that would be this:

if $game_party.members.any? {|actor| actor.skill_learn?($data_skills[226]) }would give you true if ANY party member had that skill and false if NONE of them do.
If you're out of battle and you only want to look at the battlers in your party and not the reserve members, change it to this:

Code:
if $game_party.battlers.any? {|actor| actor.skill_learn?($data_skills[226]) }
If you're in battle, you could use either one, as $game_party.members only gives you the active battlers when you're in battle.
 
Last edited by a moderator:

dinhbat3

Veteran
Veteran
Joined
Feb 5, 2014
Messages
184
Reaction score
31
First Language
English
Primarily Uses
Ahh that makes much more sense. Thanks Shaz!

~Dinhbat
 

Thendon

Script Noob
Member
Joined
May 31, 2014
Messages
7
Reaction score
2
First Language
German
Primarily Uses
I searched a lot but couldnt find how to get the facing direction of the player or an event by script ._. any ideas?

~Thendon

Edit: okay, for now i saved the information in a variable and used this in the script. But thats kind of a temporary solution
 
Last edited by a moderator:

Shaz

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
41,166
Reaction score
14,211
First Language
English
Primarily Uses
RMMV
$game_player.direction


$game_map.events[id].direction
 

iNBee317

Villager
Member
Joined
Jun 10, 2014
Messages
15
Reaction score
0
First Language
English
Primarily Uses
I have what I hope is an easy question to answer... I am simply trying to assign a characters current parameter value to a variable in a script call. I used the method described in the reference above $game_variables[n] = $game_actors[n].atk though it spits out an error saying that atk is undefined. I also tried param(2) though i get a similar error for param. I tried creating a new project with no added scripts though end up with the same result.

Ultimately I am trying to use PK8's self data suite to assign parameter values to self variables, though I am trying to get over this initial hump first.
 

Latest Threads

Latest Posts

Latest Profile Posts

One feature that I'm missing is the ability to see Who is viewing a topic...

It was kinda nice to 'see' some faces, even if they don't say anything.
unnamed_image.jpg
SOMEONE'S SINGLE! HE DOES LIKE ALL GENDERS! SADLY, HE HAS NO NUMBER TO NOTE OF BECAUSE HE HAS NO USE FOR A PHONE, BECUASE SUMMONING WORKS MUCH BETTER AND DOES NOT COME WITH AN ITEMISED BILL.
I just found out that MZ regional price on Steam in my place is much cheaper than MV.
Our water started to work again, now i don't have to fill up our toilet with water again.

Forum statistics

Threads
108,887
Messages
1,040,314
Members
141,325
Latest member
alessandrochiper
Top