Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Quest Status - My First Script :D

Status
Not open for further replies.
*was blind* (people should post saying that they have an update when they update or something :P)

I'll take a look at it later (I will edit this post), but from a quick glance, I've seen
Alot of code which could have been condensed into smaller lines of code.
 
I don't think you need those when's. Since only the index changes, you might consider something like this (open these spoilers only if you don't know why!):

Code:
case index
when 0
A = B[0]
return
when 1
A = B[1]
return
#and so on until when 15? Copy-pasting them would be boring...
end

Code:
A = B[index]

the index in case is 1 less than your array's index, you can use
Code:
A = B[index + 1]
 
This is a neat script!, but im a little mentally retarted when it comes to scripting...What do these represent
Code:
  Start_Switch = {1 => 1, 2 => 3}
  # ****** Put the ending switch id of each quest here.
  End_Switch = {1 => 2, 2 => 4}

Why are there 2 numbers in between and such? I thought it mean, the 1=> Means the beggining
and th => 4 is the end, what are the two in between representing?
 
I haven't looked at the script, but I'm pretty sure it is like this:

Code:
End_Switch = {quest_id => switch_id, quest_id => switch_id, quest_id => switch_id ...}
 

destan

Member

Could you maybe make the script for 30 quests, cause i'm having trouble editing it. (i'm horrible in scripting)
 
Code:
if @quests == 1
    $cmd_window = Window_Command.new(160, [s1])
    end
    if @quests == 2
    $cmd_window = Window_Command.new(160, [s1, s2])
    end
    if @quests == 3
    $cmd_window = Window_Command.new(160, [s1, s2, s3])
    end
    if @quests == 4
    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4])
    end
    if @quests == 5
    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5])
    end
    if @quests == 6
    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
    end
    if @quests == 7
    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
    end
    if @quests == 8
    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8])
    end
    if @quests == 9
    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9])
    end
    if @quests == 10
    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10])
    end
    if @quests == 11
    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11])
    end
    if @quests == 12
    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12])
    end
    if @quests == 13
    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13])
    end
    if @quests == 14
    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14])
    end
    if @quests == 15
    $cmd_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15])
    end
I think this is the most poorly written part... to many 'if'... this will be simply reduce it (untested):
Code:
  quest = []  # Preparing an empty array for storing commands  
  for i in 0...@quest  # Looping in the number of quest
    eval "quest.push(s#{i + 1})"  # Adding commands to quest array
  end
  $cmd_window = Window_Command.new(160, quest)
also, you may want to change $cmd_window global variable to an instance one > @cmd_window....
 
Well, like Daniel said

Code:
End_Switch = {quest_id => switch_id, quest_id => switch_id, quest_id => switch_id ...}

But..
The starting switch triggers it to say "In Progress"

And the end switch triggers it to say "Completed"

And to everyone that helped with my script, thanks, I'll update it ASAP :)

@LegACy: Can I call an instance from a different scene though?
And when I tested your code, I get an error that says "Bad value for range"
on this line : for i in 0...@quest

And I will be working on the quest cap.
 
@LegACy: Can I call an instance from a different scene though?
And when I tested your code, I get an error that says "Bad value for range"
on this line : for i in 0...@quest
well, that means you haven't define the '@quest' ^^
 
I'm not 100% sure how it is I make quests.. do all the start/end switches increase between quests the same way every time? Also, how exactly do I turn a switch on from an event? And off?
 

Anonymous

Guest

This script is just what i need :)
But I need more then 15 solts.
And quest should be visible when they active

Beside that, great job :)
 
Hm... I believe that it's really easy to make it hold up to 50 quests...
But you need patience and basic/moderate knowledge about scripting.
Ex:
Starting from line 38 of the script:
end
def main
s1 = Quest::Names[1]
s2 = Quest::Names[2]
s3 = Quest::Names[3]
s4 = Quest::Names[4]
s5 = Quest::Names[5]
s6 = Quest::Names[6]
s7 = Quest::Names[7]
s8 = Quest::Names[8]
s9 = Quest::Names[9]
s10 = Quest::Names[10]
s11 = Quest::Names[11]
s12 = Quest::Names[12]
s13 = Quest::Names[13]
s14 = Quest::Names[14]
s15 = Quest::Names[15]
s16 = Quest::Names[16]
s17 = Quest::Names[17]
s18 = Quest::Names[18]
s19 = Quest::Names[19]
s20 = Quest::Names[20]...
And then it goes on...
But you will need to make this on everything (the "if" lines, the "when" lines, etc...), and after that, you will:

1) Have an 5x bigger script,
2) Enhanced your hand's muscle a lot,
3) Own an screwed keyboard...
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top