Post new topic    
Metal Slime
Send private message
Plotscript: simulate a yes/no questio dialogue 
 PostTue Jul 08, 2014 12:10 pm
Send private message Reply with quote
It's plotscripting question time...

The plotscript should be uesed so simulate a dialogue between player and Teacher-NPC.

The Teacher tells the Player to get ready.
Next time Player talks to him, he asks the Player to confirm if he's ready.
If the player is ready the next cutscene is called by the script ToCraftersVillage().
If not the player get a hint what to do (Textbox 48).

The textbox 46 should only be shown once, so I added the tag 58 to ckeck if it was shown or not.
Tag 56 is for the yes response, and tag 57 is no.

For some reason only textbox 46 is shown. Confused
Am I using the && and || incorrectly?

Thanks for your help! Smile
Code:

plotscript,TeacherNPCIntro, begin
# EXAMPLE: check tag (tag:initialised) == OFF


if (checktag (56) == ON && checktag (57) == OFF ) then (
    show text box (49)  # yes, ready to go and start next cutscene
   set tag (56, OFF)
   set tag (57, OFF)
   ToCraftersVillage() # calles the plotscript ToCraftervillage

 ) else if (checktag (57) == ON && checktag (56) == OFF )  then (
   show text box (48)  # Not ready
    wait for textbox
   set tag (56, OFF)
   set tag (57, OFF)
   TeacherNPCIntro () # calles the plotscript ToCraftervillage

 ) else if ( checktag (58) == OFF && checktag (57) == OFF || checktag (56) == OFF ) then (
     show text box (46) # Go and get epuipment
    wait for textbox     
    set tag (58,ON)
   
 )
else if (checktag (57) == OFF || checktag (56) == OFF &&  checktag (58) == ON) then (
     show text box (47)  # Ready to go?
    wait for textbox
)

end
Metal King Slime
Send private message
Re: Plotscript: simulate a yes/no questio dialogue 
 PostTue Jul 08, 2014 12:57 pm
Send private message Reply with quote
After getting clarification in IRC, I think this is what was wanted.

The check conditions in your original script are very complicated. I suggest writing the script in chronological order, and trying to check only one tag at a time. If you drew up a flow chart for the dialogue it would go "Have I talked to the NPC before? If so, show this and stop. Otherwise, ..."

Code:
plotscript, TeacherNPCIntro, begin
  if (checktag (58) == OFF) then (
    # First time you talk...
    show text box (46) # Go and get epuipment
    wait for textbox
    set tag (58,ON)
  ) else if (checktag (56) == OFF) then (
    # Next time; haven't answered "yes" yet
    show text box (47)  # Ready to go?
    # Choice box sets either tag 56 (yes) or 57 (no)
    wait for textbox
    if (checktag (56) == OFF)  then (
      # Didn't say yes
      show text box (48)  # Not ready
      wait for textbox
    )
  )

  if (checktag (56) == ON) then (
    # Once you've answered yes, you always get this response from then on.
    show text box (49)  # yes, ready to go and start next cutscene
    ToCraftersVillage()
  )
end
Display posts from previous: