Author Topic: General Discussion  (Read 3821800 times)

0 Members and 24 Guests are viewing this topic.

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: General Discussion
« Reply #5670 on: August 31, 2015, 10:41:39 AM »
Btw I need to check if a quest was finished/cancaled or not. Obviously I can use intermediate flags, but it will be messy without a reason.
That will allow to make chains of quests.

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: General Discussion
« Reply #5671 on: August 31, 2015, 10:44:14 AM »
I'll take a look at it tonight, I don't have access to code atm.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: General Discussion
« Reply #5672 on: August 31, 2015, 11:49:10 AM »
Quote
if pytfall.world_quests.get("Sixth Sense")
What does this check do?

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: General Discussion
« Reply #5673 on: August 31, 2015, 12:07:47 PM »
What does this check do?

It makes sure there is a quest with such a name still active, basically, if that is not a fact (at some point you are bound to finish it) and you do the normal check of it's stage, chances are that you'll be screwed and crash the game because it will return None and try to do this:

Code: [Select]
None.stage > 1
None obviously does have such an attribute (or any attribute at all) so it's game over, maybe even without possibility to skip through.

We need a simpler and safer check for stages, MAYBE there is already such a thing coded by Thewlis and I don't know about it... In any case, it is VERY simple to code a perfectly safe check for this, I just need some time.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: General Discussion
« Reply #5674 on: August 31, 2015, 12:14:51 PM »
You need to add
Quote
    python:
        for i in chars.values():
            if i.origin == "Naruto":
                i.set_flag("quest_cannot_be_hired", True)
                i.set_flag("quest_cannot_be_fucked", True)
                i.set_flag("quest_cannot_be_lover", True)
to your testing json if you want quests working as intended. These flags will prevent related events inside all interactions and GMs if needed until char quest will be finished.
In fact, they should be in forest intro, but we skip it right now.

You were right about the typo, but it still doesn't work.
register_event("karin_first_meeting", quest="Sixth Sense", dice=None, run_conditions=["pytfall.world_quests.get('Sixth Sense').stage == 1"], max_runs=1) for quest and $ pytfall.world_quests.get("Sixth Sense").stage = 1 for running it do nothing.

Maybe it's impossible for quests to check themselves? I even checked via console, its stage is 1 after $ line, and it was 0 before. Wtf...
« Last Edit: August 31, 2015, 12:24:03 PM by DarkTl »

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: General Discussion
« Reply #5675 on: August 31, 2015, 12:35:50 PM »
Ah, I found it.
Quote
        def has_failed(self, quest):
            """
            Whether a quest has been failed.
            """
            if isinstance(quest, str): quest = self.get(quest)
            return quest in self.failed
       
        def is_active(self, quest):
            """
            Whether a quest is active.
            """
            if isinstance(quest, str): quest = self.get(quest)
            return quest in self.active
       
        def is_complete(self, quest):
            """
            Whether a quest is complete.
            """
            if isinstance(quest, str): quest = self.get(quest)
            return quest in self.complete
So if I want check if the quest was finished, it should be like if is_complete(pytfall.world_quests.get('Sixth Sense') )? Or simply is_complete ('Sixth Sense')?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: General Discussion
« Reply #5676 on: August 31, 2015, 12:39:42 PM »
And this is supposed to check stages, I think.
Quote
        def check(self, stage, strict, *flags):
            """
            Checks whether the quest is at a certain state.
            Used for easy checking through WorldEvent.run_conditions.
            """
            if strict and self.stage != stage: return False
            if not strict and self.stage < stage: return False
            for i in flags:
                if i not in self: return False
But I don't understand how to use it, the way of writing functions in python is very different from what I get used to  :)

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: General Discussion
« Reply #5677 on: August 31, 2015, 12:41:11 PM »
I think you need to have quests instance for this... but it's not very useful if you get a None instead... same cr@p will apply, I need to take a look at the code. The method is second posts checks flags I think, not stages.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: General Discussion
« Reply #5678 on: August 31, 2015, 02:47:56 PM »
And another condition in quest refuses to work... Do they even work at all, aside from those in the idol example?

I pushed it.

$ register_event_in_label("karin_finish_quest", quest="Sixth Sense", locations=["hiddenVillage_entrance"], run_conditions=["not('Virgin' in chars['Karin'].traits)"], trigger_type="auto", max_runs=1)
Ie when you go to location hiddenVillage_entrance it should start the label if she doesn't have a trait. Of course it doesn't work just as I suspected. I f###ing give up, I need clear instructions how this stuff works.

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: General Discussion
« Reply #5679 on: August 31, 2015, 05:51:36 PM »
And another condition in quest refuses to work... Do they even work at all, aside from those in the idol example?

I pushed it.

$ register_event_in_label("karin_finish_quest", quest="Sixth Sense", locations=["hiddenVillage_entrance"], run_conditions=["not('Virgin' in chars['Karin'].traits)"], trigger_type="auto", max_runs=1)
Ie when you go to location hiddenVillage_entrance it should start the label if she doesn't have a trait. Of course it doesn't work just as I suspected. I f###ing give up, I need clear instructions how this stuff works.

I've added check_stage method to the quests manager which should be safe to use (I didn't test it). Been one heck of a day for me so I am just gonna call it a night.

if pytfall.world_quests.check_stage("Quest Name", 1):
    This should return True if Quest is at stage one or above and None (same as False in this context) if quest is not active or stage is below 1.

===
I took a quick look at you code. I don't think that you need to register a single event, this was already discussed on the chat a bit. Events are smart ways to execute code in labels, you however handle that perfectly fine just by entering Karens house... so all the event registration is absolutely redundant. In fact I do not think it is even working at all since most of your event registration is without any conditioning or even places where you wish conditions to be checked...

I think you need to get rid of all the useless event registers and just register the quest, check the current quest level upon entering Karen's building and advance the quest in that label accordingly.

In any case, right now it seems like a mess :(

===
You can also try testing out events and quests system by coming up with some simple, short events/quests of your own, maybe even without unique girls, just some bonuses to MC and maybe finding a couple of items. Maybe that'll give you a better grasp on how those systems work.

I'll test all quests events before release... I know that at least one thing in frogs quest is off for example. Namis quests is still a bit of a mess as well.
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: General Discussion
« Reply #5680 on: September 01, 2015, 12:41:25 AM »
Yeah, whenever I use events with conditions that are different from those in the idol example, they don't work. My guess is it wasn't tested properly (just like schools, but I tested them and Thewlis fixed them).
Of course there is also a chance that the system is so complex that it requires a very deep understanding in order to make it work. But it's not good too.

For example, stuff like quest=event.quest didn't worked for me so far. With it you in theory don't need to write the name of the quest inside the event that is a part of that quest.
« Last Edit: September 01, 2015, 01:27:46 AM by DarkTl »

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: General Discussion
« Reply #5681 on: September 01, 2015, 02:01:32 AM »
Yeah, whenever I use events with conditions that are different from those in the idol example, they don't work. My guess is it wasn't tested properly (just like schools, but I tested them and Thewlis fixed them).
Of course there is also a chance that the system is so complex that it requires a very deep understanding in order to make it work. But it's not good too.

Events system is mostly my own design, except for the quests integration part and I've tested it fairly well. I know for a fact that it executes complex conditioning properly, that a very complex "times per days" system is working, that dice is working, that events are being queued as expected and that garbage collection for the events is working. That the simpler days tracking works also.

For example, stuff like quest=event.quest didn't worked for me so far. With it you in theory don't need to write the name of the quest inside the event that is a part of that quest.

Not sure what this is and where you write this line. I'll check it when I can... but:

1) You're creating a new instance of WorldEvent.
2) You are providing event.quest as an argument to the new event.
- This means that there MUST be an instance of older event, that was a part of the same quest, that is bound to event variable.
- That is by no means guaranteed... maybe Thewlis coded mapping of the event variable to global namespace whenever event is executed or you are in a called, parameterized label but those are both assumptions.

You do always know the Quest you're creating the new event for, so you can just provide the name of a quest...
Like what we're doing?

Offline DarkTl

  • Hero Member
  • *****
  • Posts: 4737
Re: General Discussion
« Reply #5682 on: September 01, 2015, 02:03:57 AM »
A fresh example. I register a quest.

    qtest = register_quest("Test Quest")
    register_event("testq", quest="Test Quest", locations=["hiddenVillage_entrance"], dice=100, trigger_type="auto", max_runs=1, start_day=1)

label testq:
    "U r one cheeky bugger m8 I swear!"
    $ pytfall.world_quests.get("Test Quest").next_in_label("1v1 me irl")
    $ pytfall.world_events.kill_event("testq")

It's just like the last stage of the idol was made. Guess what, I have

Quote
  File "game/library/events/StoryI/Karin_part.rpy", line 8, in script
    label testq:
  File "C:\Pytfall\RenPy\renpy\ast.py", line 743, in execute
    values = apply_arguments(self.parameters, renpy.store._args, renpy.store._kwargs)
  File "C:\Pytfall\RenPy\renpy\ast.py", line 144, in apply_arguments
    raise Exception("Arguments supplied, but parameter list not present")
Exception: Arguments supplied, but parameter list not present
even though I literally copied it from the idol quest.

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: General Discussion
« Reply #5683 on: September 01, 2015, 02:05:57 AM »
*Also don't expect events to execute right after you created them*

Next Day must run once before new events are properly registered and absorbed by the game. I may update that at some point to allow instant registration and absorption but right now that is not a case.
Like what we're doing?

Offline Xela

  • Global Moderator
  • *****
  • Posts: 6893
  • "It's like hunting cows"
Re: General Discussion
« Reply #5684 on: September 01, 2015, 02:10:29 AM »
A fresh example. I register a quest.

    qtest = register_quest("Test Quest")
    register_event("testq", quest="Test Quest", locations=["hiddenVillage_entrance"], dice=100, trigger_type="auto", max_runs=1, start_day=1)

label testq:
    "U r one cheeky bugger m8 I swear!"
    $ pytfall.world_quests.get("Test Quest").next_in_label("1v1 me irl")
    $ pytfall.world_events.kill_event("testq")

It's just like the last stage of the idol was made. Guess what, I have
even though I literally copied it from the idol quest.

Ghm... try adding:

jump=True

to the registration line, like so:

Code: [Select]
register_event("testq", quest="Test Quest", locations=["hiddenVillage_entrance"], dice=100, trigger_type="auto", jump=True, max_runs=1, start_day=1)
Error means that a parameterized label is expected, it's likely that an event is either called or maybe even called in a new context. You most likely want to jump to the label. Also note that you cannot return from a label you jumped to... you'll have to jump somewhere when the event is over, like hidden village or mainscreen.
Like what we're doing?