Quest help and help with NewGame+ option?

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

Post Reply
User avatar
Xer0.the.Dark
Slime
Posts: 22
Joined: Mon Dec 19, 2016 6:21 am

Quest help and help with NewGame+ option?

Post by Xer0.the.Dark »

Hi! I've lurked here and I've been learning many things for quite a while...
but I've finally decided to ask for help because there are a few things that I can't seem to be able to script properly...if they're even possible at all...

I still don't quite understand scripting...I've gotten lucky a few times and have used individual commands successfully...but when I try to put different commands together it never seems to work out.

So...what I'm trying to do for quests(or at least this quest) is to require a specific quantity of an item.

I have an NPC with a text box, who says something which basically means "You don't have the quest item."
He's supposed to say something like "You got the quest items!" when you get 5 of them...then you get a reward...but that doesn't happen.

I've tried many different things, but I've deleted and re-written it repeatedly.
Currently, it looks like this:

Code: Select all

plotscript, MALLYQUEST1, begin
 if (inventory (63) ) then (
  show text box (127)  # "I thank you for visiting..."
) else (
  show text box (242)  # "Oh...hello. Why are you loitering..."
)
 delete item(63,5) 
end
I was trying to get it to check for 5 of the item, but it doesn't even work with 1 of the item.

The other thing that's been driving me crazy is that I've been trying to make a "NewGame+" feature similar to the ones in the Tales series(Tales of Symphonia, etc) and Chrono Trigger. I got it to kind of work...but not really. "Reset game" doesn't work...because it erases everything as if no first playthrough ever happened...
One of the major problems is that I have a lot of potential party members...and I tried different ways of getting them to leave the party...but I can't figure out a way to get them all to leave. All party members are optional, so I can't use "delete hero" because I don't know which party members the player will choose. I was hoping to find a "delete all party members" command...but it doesn't seem to exist (at least not yet?)...

Anyway...this is the script I managed to come up with:

Code: Select all

plotscript, newgameplus, begin
  reset map state (mapstate:all)
  teleport to map (0, 12, 5)
  open menu(18)  
  use door(0)    #back to starting map
  show text box (168)   #opens reward menu
  wait for text box
  resume player
end
The menu(18) lets you choose to play as a new character, but with perks. (1000 gold, some xp, increased stats, etc)
I got all the "perks" to work perfectly fine...just can't figure out how to reset the game without actually having to use "reset game". D:

Any help/advice would be greatly appreciated!!
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Re: Quest help and help with NewGame+ option?

Post by TMC »

The 'inventory' command returns how many of the item you have. And you should only delete those items if the quest is successful, otherwise if you have 4 you'll lose them all! the script looks like this:

Code: Select all

plotscript, MALLYQUEST1, begin
 if (inventory (63) >= 5) then (
   delete item(63,5) 
   show text box (127)  # "I thank you for visiting..."
 ) else (
   show text box (242)  # "Oh...hello. Why are you loitering..."
 )
end
Regarding newgame+, do you want to preserve data from the previous game, or start a completely new game, with a different new-game script? These are completely different. In the first case it's not just the heroes that you have to reset, but also tags, inventory, gold, one-time-use npcs, possibly map states, and maybe more. So I think that you really do want to use "reset game".

Also, you can't actually remove all heroes from the party, because the active party must always have at least hero. So actually you need to add the new starting hero before you delete the last hero from the old party.

Are you using nightly builds? There's a new feature in the next release which makes newgame+ easy: you can now pass an argument to the newgame script by giving it to the resetgame command. So you just need to tell your newgame script that this is a newgame+ instead of a regular newgame:

Code: Select all

plotscript, good ending, begin
  #... whatever happens here
  # Then start a newgame+
  reset game (true)
end

plotscript, newgame script, plus, begin
  if (plus) then (
    newgameplus
    exit script
  )
  # Otherwise, 'plus' is false, and this is just a regular new game.
  # So put the regular newgame script here...
end

script, newgameplus, begin
  open menu(18)  
  show text box (168)   #opens reward menu
  wait for text box
end
If you're not using a nightly build, or if you also want the regular "New Game" option on the load game menu to start a newgame+, then you need to instead set a variable to indicate that the player has unlocked this feature. The way to do that is to use the "import globals" and "export globals" commands, which let you use global variables in a hidden save slot for things like high scores, where you can access them without having to load that save slot. Let's say you use save slot 32 (so you can only enable 31 save slots for the player to use) and global variable 1000:

Code: Select all

global variable(1000, newgameplus unlocked)

plotscript, good ending, begin
  newgameplus unlocked := true
  # Save just this global variable. Or you could just export all of them, with "export globals(32)".
  export globals(32, @newgameplus unlocked, @newgameplus unlocked)
  reset game
end

plotscript, newgame script, begin
  newgameplus unlocked := import global(32, @newgameplus unlocked)
  if (newgameplus unlocked) then (
    newgameplus
    exit script
  )
  # Otherwise, 'plus' is false, and this is just a regular new game.
  # So put the regular newgame script here...
end
Last edited by TMC on Wed Mar 22, 2017 1:53 am, edited 1 time in total.
User avatar
Xer0.the.Dark
Slime
Posts: 22
Joined: Mon Dec 19, 2016 6:21 am

Post by Xer0.the.Dark »

Thank you so much!!!

They both worked exactly like I hoped they would!! :) Took a bit of fiddling around with things and, of course, testing. They were mostly just common sense things that took me much too long to catch and adjust. xD I'm happy with the outcome, though! :)

Yeah...the thought of having to reset/fix absolutely everything for the newgame+ did occur to me...and I was almost ready to attempt to do it that way...@.@ Yeah, reset game definitely worked for what I needed! I just misunderstood it. I thought that it was final and there was absolutely no way around it.

Well, I didn't mean delete all heroes...I didn't specify very well...sorry. So, the way my game works: The "starting" player character is just an arrow, starting map is a character selection map and you get to choose from three potential player characters. So what I was originally thinking was...if I could somehow switch the arrow back in, switch out whichever main player character was chosen (thereby resetting inventory, stats, etc) and clear out the party slots and reserve...I could teleport back to the starting map (character selection) and attempt to continue from there. Yeah...I have a tendency to do things the hard way...lol...

I'm not using nightly builds, but only because I'm overly cautious about new things...I'll probably just wait for the next update. Thank you for including both versions of the script, though! The nightly version of the script does seem much more simple...

I would have never even known to use "import globals" and "export globals". I didn't even know it was possible to use save slots in that way. o.o Thank you again!! :)
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

I guess it's one of those tricks that's hard to find in the plotscripting dictionary; maybe an FAQ on the wiki would be a good way to point it out. Especially since people also ask about how to implement a high score list and that sort of thing quite a lot (eg Willy just a few days ago), which has the same solution.
Last edited by TMC on Wed Mar 22, 2017 12:44 pm, edited 1 time in total.
User avatar
Xer0.the.Dark
Slime
Posts: 22
Joined: Mon Dec 19, 2016 6:21 am

Post by Xer0.the.Dark »

I think I might have done something wrong, actually...

I didn't catch it at first, but the reward menu for the NG+ comes up on a regular new game. It's delayed by something...but if you keep the screen idle for long enough it eventually comes up. I didn't catch it because I rushed through the game and got to the part where it resets and is supposed to start the NG+...

But NG+ doesn't seem to be happening at all for some reason...

Code: Select all

global variable(1000,newgameplus unlocked)

plotscript, good ending, begin
 suspend player #using credits here temporarily because I don't have cutscenes done yet.
 variable(credits)
 variable(credits2)
 variable(credits3)
 credits := load slice collection(1)
 wait for key
 free slice(credits)
 credits2 := load slice collection(2)
 wait for key
 free slice(credits2)
 credits3 := load slice collection(3)
 wait for key
 free slice (credits3)
  
  newgameplus unlocked := true
  export globals(32,@newgameplusunlocked, @newgameplus unlocked)
  reset game
end

Code: Select all

plotscript, newgame script, begin
  newgameplus unlocked := import globals(32, @newgameplus unlocked)
  if (newgameplus unlocked) then (
    newgameplus
    exit script
   ) else (
  regularnewgame)
end

Code: Select all

plotscript, regularnewgame, begin
 teleport to map(0,12,5)
 show map
 show text box(12)
 wait for textbox
end

Code: Select all

plotscript, newgameplus, begin
 regularnewgame
 open menu(16)     #got rid of menu 18 because didn't need to choose a character anymore 
                            #since game resets to character select
 wait for menu(16) #also switched from text box (168) to these menus directly
 open menu(17)     # Menu (16) and (17) are the reward menus
 wait for menu(17)
end
I might just be missing something...or I might have made an obvious mistake...I'm not sure. x.x
Last edited by Xer0.the.Dark on Thu Mar 23, 2017 6:06 pm, edited 1 time in total.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Note that once the newgame+ is unlocked, all new games will call the newgameplus script, because the exported variable is permanent. If you want to unset it again, you can either call "delete save(32)" or

Code: Select all

  newgameplus unlocked := false
  export globals(32,@newgameplusunlocked, @newgameplus unlocked) 
So if you only want the newgame+ to happen when you call resetgame from the "good ending" script, then you need to do the above in newgameplus.

But I'm not sure what else is going on in your case. Try pressing F10 to bring up the script debugger after starting a new game. That will show which scripts are running.

BTW, no need to call "exit script" from "newgame script" in your case.
User avatar
Xer0.the.Dark
Slime
Posts: 22
Joined: Mon Dec 19, 2016 6:21 am

Post by Xer0.the.Dark »

Note that once the newgame+ is unlocked, all new games will call the newgameplus script, because the exported variable is permanent.
Oh ok! That makes sense...

Ok, updated script...and took a screen shot of the script debug.

Image

I also used "check where scripts are used" and realized that I never deleted two text boxes that I was using with previous attempts to get New Game+ to work...I'm not sure if that would affect the new script since they weren't really attached to anything...but I turned off the conditionals anyway.[/img]
Last edited by Xer0.the.Dark on Sat Mar 25, 2017 12:37 am, edited 1 time in total.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

That shows that the rorrimmove1 script is running and has suspended the newgame script. Only one script can run at once. I'm guessing that it's the map autorun script for map 0, and unfortunately whichever script was triggered last (eg the autorun script when you enter a map) has priority. So you probably need to get that script to exit if it is called during the intro. For example, you could set a tag or a global variable at the start of the newgame script and put "if (starting new game) then (exit script)" at the beginning of rorrimmove1. Then turn that global/tag off again at the end of the newgame scripts.
User avatar
Xer0.the.Dark
Slime
Posts: 22
Joined: Mon Dec 19, 2016 6:21 am

Post by Xer0.the.Dark »

Oh ok! Yeah...I wasn't really sure what to do with that script. It's only purpose is to make the "guide" NPC animate on the character selection map instead of just standing still...but when I finished it and tested it, I noticed that it carried over to the next map (overworld). There's another copy of "Rorrim" on the overworld map, and I didn't think that script would affect it...but when it did, I decided it wasn't a major issue and that I could live with it. So that should definitely be do-able. I didn't realize it would have an effect on overworld map scripts. o.o

Actually...now that I'm looking back at it...I don't know why I didn't just set the npc to "wander" and use a zone to animate it...maybe I didn't know about that at the time that I wrote that script...xD I'm going to see what deleting the "Rorrimmove" script and adding a zone+wander animation does---

That seems to have fixed it!! (seriously this time!) I added another line to the "newgameplus" script "(set tag(?, on))" with a new npc that will only appear if the tag is on. (Makes it easier to tell the difference between Regular new game and New Game +.) Thank you again for taking the time to help me with this!! :) I still have a lot of learning to do...lol...
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Ah, in that case if you were using a "while(true) do (...)" loop, maybe you needed to change it to "while(current map == 0) do (...)"

Setting an NPC to "Right Turns" or "Left Turns" and then putting it in a box so it can't move anywhere is a common way to create an animation (toggling between the 4 directions as it turns in place), but you can't control the animation speed.
User avatar
Xer0.the.Dark
Slime
Posts: 22
Joined: Mon Dec 19, 2016 6:21 am

Post by Xer0.the.Dark »

Ah, in that case if you were using a "while(true) do (...)" loop, maybe you needed to change it to "while(current map == 0) do (...)"
I haven't experimented with "while" too much, yet. I think all I did was set the movements "set direction (East)" etc...but it ended too soon, so I kept copy/pasting the same commands over and over...and I think that's where I messed up with that one. I can definitely see how a "while" command would have made sense though!
Setting an NPC to "Right Turns" or "Left Turns" and then putting it in a box so it can't move anywhere is a common way to create an animation (toggling between the 4 directions as it turns in place), but you can't control the animation speed.
That's how I did it, actually. I surrounded "Rorrim" with invisible step-on NPCs. My more recent NPC animations have used "movement zones" with just one zone tile. I completely forgot to change "Rorrim"'s animation into that after I discovered it. xD
User avatar
Soule X
Red Slime
Posts: 86
Joined: Wed Sep 19, 2012 4:18 pm
Location: Indianapolis

Post by Soule X »

You may want to run through some tutorials, even if it's a tutorial about something you don't want to do. It's a good way to get somewhat acclimated to the language and see how different processes work.
Post Reply