Author Topic: Trouble with a complex event  (Read 1273 times)

Offline Winspector

  • Newbie
  • *
  • Posts: 18
Trouble with a complex event
« on: December 29, 2015, 09:12:17 AM »
Hi.

I am trying to do a chain of events that is something like the next, but I am not sure how to make it work.

Let say the player want to enter a city, but there is a guard that asks him for a permit card. Once the player shows the permit card, the guard will not ask him again nor even ask him for anything else.
The event flow could be like this:

1.- The player arrives at the city gate for the first time.
2.- The guard informs the player that a parmit is needed.
3.- The player leaves and acquires a pass permit.
4.- The player returns to the guard and shows the permit
5.- The guard accepts it.
6.- The player can now pass always without showing the permit or even having to talk to the gate guard at all: no event (that the player can actually see/realize) will trigger again.

The player never loses the permit once acquired, it will remain in the inventory all the time.

How can be this done?
Basically what I need is a way to deactivate an event when a certain condition is met (in this case, permit + guard accept it)

Thanks.

Offline ProphetSword

  • Mod Designer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2901
  • FRUA Lives!
    • Lands of Adventure
Re: Trouble with a complex event
« Reply #1 on: December 29, 2015, 11:03:50 AM »

1.- The player arrives at the city gate for the first time.
2.- The guard informs the player that a parmit is needed.
3.- The player leaves and acquires a pass permit.
4.- The player returns to the guard and shows the permit
5.- The guard accepts it.
6.- The player can now pass always without showing the permit or even having to talk to the gate guard at all: no event (that the player can actually see/realize) will trigger again.



This is how I would do it in FRUA (so it should translate to DC just fine).  It's pretty simple, and can be done with just two events at the city gate:


TEXT STATEMENT: (Happens if player DOES NOT have an item called "Pass Permit") - BACKUP ONE STEP
Guard tells PCs that they cannot enter the city until they have received a permit.  They are asked to leave and the party is moved back one step.

TEXT STATEMENT: (Happens if player DOES have an item called "Pass Permit") - DO ONLY ONCE
Guard accepts the permit and tells the PC that they can enter the city freely.  Will only fire one time, and future visits will not produce any text so long as the party still has the "Pass Permit" in their special inventory.
« Last Edit: December 29, 2015, 11:10:26 AM by ProphetSword »
LANDS OF ADVENTURE: An Old-School Style CRPG

More Information Here: http://landsadventure.blogspot.com/

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2235
Re: Trouble with a complex event
« Reply #2 on: December 29, 2015, 12:09:04 PM »
I suppose that if you want the Pass Permit to
be an ordinary item that the player can drop
but which allows entry after it has been
used once and forever after even if dropped,
then you would have to remember that it
has been used in some sort of global variable.
A quest stage, perhaps?

Offline ProphetSword

  • Mod Designer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2901
  • FRUA Lives!
    • Lands of Adventure
Re: Trouble with a complex event
« Reply #3 on: December 29, 2015, 01:03:23 PM »
I suppose that if you want the Pass Permit to
be an ordinary item that the player can drop


I don't think that's what the OP wanted, based upon this line of text:


Quote
The player never loses the permit once acquired, it will remain in the inventory all the time.
[/font]
LANDS OF ADVENTURE: An Old-School Style CRPG

More Information Here: http://landsadventure.blogspot.com/

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2235
Re: Trouble with a complex event
« Reply #4 on: December 29, 2015, 02:53:50 PM »
Based on this line:

Quote
The player can now pass always without showing the permit

I thought perhaps he wanted the _effect_ to last
forever, with or without the permit.  Ie: the
guard would remember him.

Offline Dinonykos

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2339
    • Dinonykos Dungeon Craft
Re: Trouble with a complex event
« Reply #5 on: December 29, 2015, 05:06:21 PM »
I thought perhaps he wanted the _effect_ to last
forever, with or without the permit.  Ie: the
guard would remember him.
In case that the permit can be dropped, you could indeed use another variable - a quest would be reasonable here. But then, the if conditions become relatively complex already, so I personally would use the simple approach (why would somebody want to take the permit from the party?).

Another possibility is to handle it via walls. You could just unblock the passage once the permit has been shown, and it would remain unblocked for the rest of the game.
Find four contributions to the Pre-Generated Character Mini-Module Design Contest on my homepage.
New: THE AMBASSADOR'S LETTER, my contribution to the 7-day-challenge.
DINONYKOS DUNGEON CRAFT DESIGN HOMEPAGE

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2235
Re: Trouble with a complex event
« Reply #6 on: December 29, 2015, 06:05:51 PM »
Quote
why would somebody want to take the permit from the party?

Perhaps he could trade it with a terrorist for
his girl friend's freedom. :angel:

Offline Winspector

  • Newbie
  • *
  • Posts: 18
Re: Trouble with a complex event
« Reply #7 on: December 30, 2015, 03:31:47 AM »
Putting things into pseudocode, I want this:

Code: [Select]
IF player.shown_permit = TRUE THEN
    EXIT SCRIPT
ELSE
    player_answer = guard.question("Do you have permit? If you dont, get outa here")
ENDIF

IF player_answer = FALSE THEN
    guard.say("Without permit you cannot pass. Now get out, citizen!")
    EXIT SCRIPT
ELSE
    IF player.has_permit = TRUE THEN
        guard.say ("So... you managed yo get a permit. I can let you freely pass always now")
        player.shown_permit = true
        unblock_walls()
        .....
    ELSEIF player.has_permit = FALSE then
        guard.say ("Well... Where is your permit then?")
    ENDIF
ENDIF

Basically, the player is asked for the permit all the time. Once he shows it, the guard lets him pass without asking anything.
The permit can stay in the inventory or not. It could be another variable like "permit_shown = true".
I did this with a quest, but the quest always remains visible, and I don't want the player to know that this is a quest, so I think I will try with global variables. Which in fact, I don't know why I didn't do this before  :(

Based on this line:

Quote
The player can now pass always without showing the permit

I thought perhaps he wanted the _effect_ to last
forever, with or without the permit.  Ie: the
guard would remember him.

Yes,  that would be ideal. I will play with variables.

I don't know if it is possible to do this via scripting with a simple if...else...end statement.


I thought perhaps he wanted the _effect_ to last
forever, with or without the permit.  Ie: the
guard would remember him.
In case that the permit can be dropped, you could indeed use another variable - a quest would be reasonable here. But then, the if conditions become relatively complex already, so I personally would use the simple approach (why would somebody want to take the permit from the party?).

Another possibility is to handle it via walls. You could just unblock the passage once the permit has been shown, and it would remain unblocked for the rest of the game.

The problem with your approach is that I need to deactivate the script of the "city guard" so it doesn't trigger everytime the player passes.
« Last Edit: December 30, 2015, 03:36:15 AM by Winspector »

Offline Dinonykos

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2339
    • Dinonykos Dungeon Craft
Re: Trouble with a complex event
« Reply #8 on: December 30, 2015, 06:42:43 AM »
The problem with your approach is that I need to deactivate the script of the "city guard" so it doesn't trigger everytime the player passes.

Not sure if this is a misunderstanding. The approach I suggested (and which would be similar in FRUA, as ProphetSword's post shows) would work that way:
Event: Text statement ("I see you have a permit... You may pass")
Event Trigger: If party has item (called "Pass Permit")
Once only marked!

If you mark the "once only" square, the event will only be triggered and executed once.

See screenshots below. (EDIT: I just saw I should have marked "backup party one step" in the first text statement...)

I did this with a quest, but the quest always remains visible, and I don't want the player to know that this is a quest, so I think I will try with global variables. Which in fact, I don't know why I didn't do this before  :(

Based on this line:

Quote
The player can now pass always without showing the permit

I thought perhaps he wanted the _effect_ to last
forever, with or without the permit.  Ie: the
guard would remember him.

Yes,  that would be ideal. I will play with variables.

I don't know if it is possible to do this via scripting with a simple if...else...end statement.

Note that quests are only visible when you run the editor at the same time! Otherwise, they are not shown.
« Last Edit: December 30, 2015, 06:46:22 AM by Dinonykos »
Find four contributions to the Pre-Generated Character Mini-Module Design Contest on my homepage.
New: THE AMBASSADOR'S LETTER, my contribution to the 7-day-challenge.
DINONYKOS DUNGEON CRAFT DESIGN HOMEPAGE

Offline Winspector

  • Newbie
  • *
  • Posts: 18
Re: Trouble with a complex event
« Reply #9 on: December 30, 2015, 09:14:16 AM »
The problem with your approach is that I need to deactivate the script of the "city guard" so it doesn't trigger everytime the player passes.

Not sure if this is a misunderstanding. The approach I suggested (and which would be similar in FRUA, as ProphetSword's post shows) would work that way:
Event: Text statement ("I see you have a permit... You may pass")
Event Trigger: If party has item (called "Pass Permit")
Once only marked!

If you mark the "once only" square, the event will only be triggered and executed once.

Thanks for your effort trying to explain.

The problem comes because the guard asks (Yes/No Question) if the player has the permit. The player must press either Yes or No.
If this is "only once" event, it wont work.

But anyway, I already solved with a quest.

Thanks.

Offline Dinonykos

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2339
    • Dinonykos Dungeon Craft
Re: Trouble with a complex event
« Reply #10 on: December 30, 2015, 04:42:11 PM »
The problem comes because the guard asks (Yes/No Question) if the player has the permit. The player must press either Yes or No.
If this is "only once" event, it wont work.

I see... so the player has the freedom not to show the permit even if she/he has it... that's more interaction than I would grant to the players... :D

In any case, great that you could get it to work the way you wanted.
Find four contributions to the Pre-Generated Character Mini-Module Design Contest on my homepage.
New: THE AMBASSADOR'S LETTER, my contribution to the 7-day-challenge.
DINONYKOS DUNGEON CRAFT DESIGN HOMEPAGE

Offline ProphetSword

  • Mod Designer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2901
  • FRUA Lives!
    • Lands of Adventure
Re: Trouble with a complex event
« Reply #11 on: December 30, 2015, 05:57:16 PM »
The problem comes because the guard asks (Yes/No Question) if the player has the permit. The player must press either Yes or No.

This is information that should have been mentioned in the original post.  In that post, you did not specify this as a condition in solving the issue. We likely could have helped you arrive at a solution quicker if you had pointed this out.
LANDS OF ADVENTURE: An Old-School Style CRPG

More Information Here: http://landsadventure.blogspot.com/

Offline Winspector

  • Newbie
  • *
  • Posts: 18
Re: Trouble with a complex event
« Reply #12 on: December 31, 2015, 10:10:12 AM »
The problem comes because the guard asks (Yes/No Question) if the player has the permit. The player must press either Yes or No.

This is information that should have been mentioned in the original post.  In that post, you did not specify this as a condition in solving the issue. We likely could have helped you arrive at a solution quicker if you had pointed this out.

Yes, I forgot to mention that. But I already solved this using an object "city permit" and a quest "permit given".

Thanks for your help.