"Refresh" data variables?

Status
Not open for further replies.

Meoix

Villager
Member
Joined
Jan 24, 2013
Messages
18
Reaction score
1
First Language
English
Primarily Uses
Hello everyone, I have a question, I'm quite new at using the scripting system. 

Trying to get a generic quest generator going using Modern_Algebra's quest system.
The issue is, I'm using the event systems random number to figure out which enemy to "hunt".
And another random number for the number of said enemys' drops.

However, though the variables do randomize with each iteration, the name of the drop and enemy remain the same.
They only successfully "randomize" at the initial iteration. 

Is there some form of "refresh" script call I have to make to i don't know "re-synchronize" the database?

I would like to use this script for one of several repeatable side-quests so having a new result per call would be ideal.

I posted screens below and before you laugh at my very likely odd and sloppy workaround methods for achieving this, note I'm still new at Ruby haha.

Here are the screens:


This screen shows the first iteration of the common event with the above code


Here is the second iteration, note the change in enemyID which belongs to "Spider" enemy


 
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Do you have a link to the script?
 

Meoix

Villager
Member
Joined
Jan 24, 2013
Messages
18
Reaction score
1
First Language
English
Primarily Uses
It's all in the screen shot, I did it all in the common event: Here it is copy and pasted: (Note, I'm still unsure how word wrap effects the code, seems to give me issues, maybe I'm being stupid though, but that's why I created vars to store strings)
 

$data_actors[20].name = $data_enemies[$game_variables[1]].name

name = $data_items[$data_enemies[$game_variables[1]].drop_items[0].data_id].name

$data_actors[21].name = name

s2 = "deal with them and collect " + $data_actors[21].name  + "s as proof."

s1 = "The city is dealing with alot of " + $data_actors[20].name + "s lately, " + s2

s4 = "s from " + $data_actors[20].name + "s"

s3 = "> Collect " + $game_variables[2].to_s + " " + $data_actors[21].name
 

this part is just for Modern_A's quest script, I doubt his script is effecting this at all.

quest(2).name = "Eliminate " + $data_actors[20].name + "s"

quest(2).description = s1

quest(2).objectives[0] = s3 + s4
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
What do you mean, "the name of the enemy and the drop remain the same" - in the message, or when you look at the quest?


I'm not sure if you're asking for help with variables or with the script, and usually when you want help with a script, it helps US if you provide a link to it.


mmm ...


You shouldn't be changing $data_<anything>. And you don't need to set an actor name to a variable and then pass in the actor name to the script. Just use $game_variables[id] and ditch the actor stuff.
 

Meoix

Villager
Member
Joined
Jan 24, 2013
Messages
18
Reaction score
1
First Language
English
Primarily Uses
What do you mean, "the name of the enemy and the drop remain the same" - in the message, or when you look at the quest?
The name "Hornet" in the final screen should display "Spider". Also the name "Stinger" should display "Snake Fang"

I'm not sure if you're asking for help with variables or with the script, and usually when you want help with a script, it helps US if you provide a link to it.
Don't need help with Modern_A's script I know how to use that. Just need help with the variables

You shouldn't be changing $data_<anything>. And you don't need to set an actor name to a variable and then pass in the actor name to the script. Just use $game_variables[id] and ditch the actor stuff.
You're absolutely correct, it's sloppy and bad practice, but then how do I display the name of the "Monster to Kill." and the "Monsters First Drop" in the message box? That's why I used actor[20] and actor[21] as more or less, string variables. So I can use \n[20] and \n[21] in the message box.
 

ShadowLurk

Tanoshii~
Veteran
Joined
Feb 14, 2014
Messages
226
Reaction score
53
Primarily Uses
If you want to use \n[20] or \n[21], then don't change $data_actors[20].name, change $game_actors[20].name. Most $data_<stuffs> stuffs are meant to be static. A character ($game_actors) name is copied from the corresponding $data_actors at initialization only.
 

Meoix

Villager
Member
Joined
Jan 24, 2013
Messages
18
Reaction score
1
First Language
English
Primarily Uses
Oh I didn't realized that. Sounds like a simple enough solution. Thank you Tanoshii~ and Shaz.

Update: 

name1 = $data_enemies[$game_variables[1]].name

name = $data_items[$data_enemies[$game_variables[1]].drop_items[0].data_id].name

name2 = name

s2 = "deal with them and collect " + name2  + "s as proof."

s1 = "The city is dealing with alot of " + name1  + "s lately, " + s2

s4 = "s from " + name1 + "s"

s3 = "> Collect " + $game_variables[2].to_s + " " + name2

quest(2).name = "Eliminate " + name1  + "s"

quest(2).description = s1

quest(2).objectives[0] = s3 + s4

Worked great, and to reveal the quest to the player I simply used
call_quest_journal(2) from the Journal script to open it up.
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Again, you DON'T need to do anything with actors. JUST use variables: $data_enemies[$game_variables[2]].name. You didn't actually answer my question ... is the problem with the script itself (when you go to see what quests you have), or just with your message that you display? Do they change in either of those?
 

ShadowLurk

Tanoshii~
Veteran
Joined
Feb 14, 2014
Messages
226
Reaction score
53
Primarily Uses
Well, he also want to show text in a convenient way... and one method to do that is by storing the name into an actor's name and use \n[actor_id].
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
$game_variables[1] = $data_enemies[5].name


\v[1]


would do the same thing. He's already put it into a variable. Putting it into an actor's name is just an additional, unnecessary step.
 

Meoix

Villager
Member
Joined
Jan 24, 2013
Messages
18
Reaction score
1
First Language
English
Primarily Uses
I didn't realize $game_variables could store string type.

Again, you DON'T need to do anything with actors. JUST use variables: $data_enemies[$game_variables[2]].name. You didn't actually answer my question ... is the problem with the script itself (when you go to see what quests you have), or just with your message that you display? Do they change in either of those?
I stopped using actors, note my last post.
Technically it was both, in the message and when the quest screen was displayed. They didn't change in either. I didn't know $data_<stuff> wasn't dynamic. 
I believe the issue precisely was, at first I changed the name of actor 20 and 21, and it worked, but the second time I tried it failed, because maybe it locked in the first names given. The the message I used \n[20] and \n[21] and in the quest string I used $data_actors[20].name and $data_actors[21].

But I updated the code to what I said in my previous post and everything works now the way it should expect. 

Thank you both for your help, I appreciate it.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Yeah, just don't try to do any math on them :)


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

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

Latest Threads

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
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.

Forum statistics

Threads
105,868
Messages
1,017,078
Members
137,580
Latest member
Snavi
Top