aliens

Author Topic: [Solved] Help with events  (Read 3877 times)

wcho035

  • Guest
[Solved] Help with events
« on: July 25, 2020, 07:42:58 pm »
I found a weird issue with the researchList from the Events.

From my understanding, this is suppose to grant a free research from a list of research yet to be complete, correct?

Code: [Select]
events:
  - name: STR_STATEOFEVENTINTROX
    description: STR_STATEOFAFFAIRS
    background: BACK13.SCR
    regionList: [LANDSPAWNSBLACKMARKET]
    city: false
    points: 1
    timer: 60
    timerRandom: 0
    researchList: [STR_CHIP]

For example this give the  STR_CHIP research for free, if you have got it for free, you don't have to research it again. Correct?

Code: [Select]
research:
  - name: STR_CHIP
    cost: 50
    points: 10
    lookup: STR_CHIP

So STR_CHIP is a free and fully completed research that's available and any potential research path can be unlock is made available and etc.

In the implementation of this feature at the start of a campaign game. I was able to have this research unlocked. However, I am still given the option of needing to complete this research. Is this correct behavior?

Attachment 1 is showing the research already available in Ufopedia.
Attachment 2 is showing the research still needing to be complete.
« Last Edit: February 12, 2023, 10:32:18 am by Meridian »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9103
    • View Profile
Re: Help with events
« Reply #1 on: July 25, 2020, 08:11:31 pm »
From my understanding, this is suppose to grant a free research from a list of research yet to be complete, correct?

correct

For example this give the  STR_CHIP research for free, if you have got it for free, you don't have to research it again. Correct?

correct

In the implementation of this feature at the start of a campaign game. I was able to have this research unlocked. However, I am still given the option of needing to complete this research. Is this correct behavior?

description is too vague (as usual), impossible to say what you did wrong...

Attachment 1 is showing the research already available in Ufopedia.

this just shows that the ufopedia article is unlocked, it doesn't say anything about the research

wcho035

  • Guest
Re: Help with events
« Reply #2 on: July 25, 2020, 08:53:17 pm »

description is too vague (as usual), impossible to say what you did wrong...

this just shows that the ufopedia article is unlocked, it doesn't say anything about the research

I have attached snippets of my code used. My objective is to have the STR_CHIP research unlock (unlocked means research for STR_CHIP is complete) when the event shows up at the start of every campaign game.

The code works, at the launch of the event, the STR_CHIP research can be viewed on the Alien Research section of the ufopedia. Yet in the research section, the STR_CHIP is showing the research has yet to be completed. (attachment 2)


this just shows that the ufopedia article is unlocked, it doesn't say anything about the research


You are being cryptic here, so if I am to understand you. It is suppose to unlocked only the ufopedia article? And I still need to properly research the article? If I do need to, then wouldn’t this contradict the part once I get the research for free  that I won’t need to research it?

I did nothing wrong on my end. I follow all the correct syntax and rules to get this feature implemented. Yet I am experiencing out of norm behaviour.
« Last Edit: July 25, 2020, 08:57:20 pm by Precentor Apollyon »

Offline R1dO

  • Colonel
  • ****
  • Posts: 442
    • View Profile
Re: Help with events
« Reply #3 on: July 25, 2020, 09:26:52 pm »
...
Yet in the research section, the STR_CHIP is showing the research has yet to be completed. (attachment 2)
...

From this snippet i get the feeling you already started research on the "STR_CLIP" before the event gave it to you for free. Am i correct?

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9103
    • View Profile
Re: Help with events
« Reply #4 on: July 25, 2020, 10:29:11 pm »
I have attached snippets of my code used. My objective is to have the STR_CHIP research unlock (unlocked means research for STR_CHIP is complete) when the event shows up at the start of every campaign game.

You didn't attach the eventScript.
You didn't attach the ufopedia article definition.

Don't call research completed "unlock". Unlock means research is available, not completed.

The code works, at the launch of the event, the STR_CHIP research can be viewed on the Alien Research section of the ufopedia. Yet in the research section, the STR_CHIP is showing the research has yet to be completed. (attachment 2)

Without seeing the eventScript and ufopedia ruleset, I cannot say anything.
Also a save after the event popup would clarify a lot.

So far, my guess would be that you don't understand how events work.

You are being cryptic here, so if I am to understand you. It is suppose to unlocked only the ufopedia article? And I still need to properly research the article? If I do need to, then wouldn’t this contradict the part once I get the research for free  that I won’t need to research it?

I am not being cryptic, I am just guessing because you didn't give me much information to work with.

I did nothing wrong on my end. I follow all the correct syntax and rules to get this feature implemented. Yet I am experiencing out of norm behaviour.

I am 99.9% sure you did something wrong.
It's just hard to guess what it is with so little information.
« Last Edit: July 25, 2020, 10:36:30 pm by Meridian »

wcho035

  • Guest
Re: Help with events
« Reply #5 on: July 26, 2020, 03:50:38 am »
Here is a sample.rul attached with this post.

It contained everything I have to make this work.

I seek the following feature implementation. At the start of a game, an event pop up, it is an introduction that will give a research for free, so you don't have to do the research again (This part I want to be absolutely clear). You get the research with no string attached. You don't have to manually go to research section and assign scientists to research the topic, once you can see it on ufopedia (in the alien research section) after the event which gave it had unlocked it for you.

My knowledge on eventscripts and event are only as good as, from the existing example provided on this forum and from what info is available in the https://www.ufopaedia.org/index.php/Ruleset_Reference_Nightly_(OpenXcom)

In the sample.rul, please modify anything that could allow this feature to be implemented. There is a reason why I ask of this.
The free research will unlocked a few other research topic, which in turn are triggers within the missionscripts that starts off in beginning part of my campaign.

Sorry if I hadn't provide enough information. In your sample code, 

researchList: [STR_LASER_PISTOL]

I assume this provide the STR_LASER_PISTOL research for free and completed in research without needing the player to do the research again, or it only unlock the research section in the ufopedia? You still have to research the laser pistol? This part is not explain in detail.

Code: [Select]
eventScripts:
  - type: STR_TEST_EVENT_SCRIPT
    eventWeights:
      0:
        STR_TEST_EVENT1: 90
        STR_TEST_EVENT2: 10
      6:
        STR_TEST_EVENT1: 100
    firstMonth: 0
    lastMonth: 12
    executionOdds: 100
    minDifficulty: 0
    maxDifficulty: 4
  - type: STR_TEST_EVENT_SCRIPT2
    eventWeights:
      0:
        STR_TEST_EVENT2: 100
    firstMonth: 0
    lastMonth: 12
    executionOdds: 100
    minDifficulty: 0
    maxDifficulty: 4
    researchTriggers:
       STR_THE_MARTIAN_SOLUTION: true
       STR_CYDONIA_OR_BUST: false

events:
  - name: STR_TEST_EVENT1
    description: STR_TEST_DESCRIPTION1
    background: BACK13.SCR
    regionList: [STR_NORTH_AMERICA, STR_EUROPE]
    city: true
    points: 2000
    funds: 100000000
    itemList: [STR_LASER_PISTOL, STR_SOMETHING_ELSE]
    randomItem: false        # false = all items from the list are given, true = only one item is given (randomly)
    researchList: [STR_LASER_PISTOL]
    interruptResearch: STR_LASER_PISTOL
    timer: 1700
    timerRandom: 60
  - name: STR_TEST_EVENT2
    description: STR_TEST_DESCRIPTION2
    background: BACK01.SCR
#    regionList: []
#    city: false
    points: -2000
    funds: -100000000
#    itemList: [YYY]
    researchList: [STR_LASER_RIFLE]
#    interruptResearch: XXX
    timer: 2700
    timerRandom: 150

extraStrings:
   - type: en-US
     strings:
       STR_TEST_EVENT1: "Political assassination in {0}"
       STR_TEST_EVENT2: "Test title"
       STR_TEST_DESCRIPTION1: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."
       STR_TEST_DESCRIPTION2: "This one is rather short."

* GeoscapeEvents.zip (1.47 kB - downloaded 40 times.)


Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9103
    • View Profile
Re: Help with events
« Reply #6 on: July 26, 2020, 09:50:17 am »
I assume this provide the STR_LASER_PISTOL research for free and completed in research without needing the player to do the research again

Yes

or it only unlock the research section in the ufopedia?

No


You still have to research the laser pistol?

No

This part is not explain in detail.

There were no changes in how ufopedia works.
If there were any changes, I would describe it.

In the sample.rul, please modify anything that could allow this feature to be implemented.

That's not how my help works.
I don't write mods for people.

If you write a sample minimod that you think should do something, but doesn't do it... I can run that mod and tell you why it is not doing what you expect.

wcho035

  • Guest
Re: Help with events
« Reply #7 on: July 26, 2020, 10:28:38 am »
Well it is not doing what I am expecting. I still have to research the topic after it is given for free.  I follow every step, perhaps you can run it and tell me where have I gone wrong.

Now I have provided all the details needed, ufopedia, event, research and etc in the sample.rul
« Last Edit: July 26, 2020, 10:36:37 am by Precentor Apollyon »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9103
    • View Profile
Re: Help with events
« Reply #8 on: July 26, 2020, 11:01:16 am »
You can research STR_CHIP multiple times, because it has "getOneFree" topics.

It's the same why you can research for example alien medics or engineers multiple times.

Code: [Select]
research:
  - name: STR_CHIP
    cost: 50
    points: 10
    lookup: STR_CHIP
    #needItem: true
    getOneFree:
      - STR_STATEOFSITUATIONRAIDER
    getOneFree:
      - STR_STATEOFSITUATIONMERC
    getOneFree:
      - STR_STATEOFSITUATIONNAZI
    getOneFree:
      - STR_STATEOFSITUATIONCHURCH
    getOneFree:
      - STR_STATEOFSITUATIONMARSEC 
    getOneFree:
      - STR_STATEOFSITUATIONBANDIT

Also, this syntax is wrong.
You cannot have "getOneFree:" attribute duplicated.
Correct syntax would look for example like this:

Code: [Select]
research:
  - name: STR_CHIP
    cost: 50
    points: 10
    lookup: STR_CHIP
    #needItem: true
    getOneFree:
      - STR_STATEOFSITUATIONRAIDER
      - STR_STATEOFSITUATIONMERC
      - STR_STATEOFSITUATIONNAZI
      - STR_STATEOFSITUATIONCHURCH
      - STR_STATEOFSITUATIONMARSEC 
      - STR_STATEOFSITUATIONBANDIT

Also if the research name and research lookup are the same, you should not specify the lookup.

So the final correct research, which does what you want would look like this:

Code: [Select]
research:
  - name: STR_CHIP
    cost: 50
    points: 10
« Last Edit: July 26, 2020, 11:22:26 am by Meridian »

wcho035

  • Guest
Re: Help with events
« Reply #9 on: July 26, 2020, 11:42:29 am »
You can research STR_CHIP multiple times, because it has "getOneFree" topics.

It's the same why you can research for example alien medics or engineers multiple times.


This was done absolutely and intentionally. If I follow the norm

Code: [Select]
research:
  - name: STR_CHIP
    cost: 50
    points: 10
    lookup: STR_CHIP
    #needItem: true
    getOneFree:
      - STR_STATEOFSITUATIONRAIDER
      - STR_STATEOFSITUATIONMERC
      - STR_STATEOFSITUATIONNAZI
      - STR_STATEOFSITUATIONCHURCH
      - STR_STATEOFSITUATIONMARSEC 
      - STR_STATEOFSITUATIONBANDIT

This will only give me one research topic free from the six available above. I want ALL the topic available.  So, with this arrangement,

Code: [Select]
research:
  - name: STR_CHIP
    cost: 50
    points: 10
    lookup: STR_CHIP
    #needItem: true
    getOneFree:
      - STR_STATEOFSITUATIONRAIDER
    getOneFree:
      - STR_STATEOFSITUATIONMERC
    getOneFree:
      - STR_STATEOFSITUATIONNAZI
    getOneFree:
      - STR_STATEOFSITUATIONCHURCH
    getOneFree:
      - STR_STATEOFSITUATIONMARSEC 
    getOneFree:
      - STR_STATEOFSITUATIONBANDIT

I did get all the topic for free, I know this is strange, but from testing, I was able to unlock all with this arrangement. This hack is better than a new feature request.

So in otherwords, I am fully aware of this syntax error I was committing. The strange part it works. In my second month, all my research triggers for the missionscript spawn.

What's above is a different issue.

Yet this does not answer the question of this thread of why the topic given free by the event has to be researched again. I had actually tested the code in its most basic form like you had listed.


Code: [Select]
research:
  - name: STR_CHIP
    cost: 50
    points: 10

From memory of yesterday, I had disable all the getonefree lines and just use the most basic form like prior example. The problem still persist, I need to research the topic even though it was given free.

I can test it again tonight and record a video of it. I am confident my memory did not lie on this.

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9103
    • View Profile
Re: Help with events
« Reply #10 on: July 26, 2020, 12:03:42 pm »
This was done absolutely and intentionally.

If it is intentional, then we don't have anything else to discuss.
It works correctly.
Any research topic with remaining getOneFree(s) can be researched again. That's a normal OpenXcom feature.

I did get all the topic for free, I know this is strange, but from testing, I was able to unlock all with this arrangement. This hack is better than a new feature request.
So in otherwords, I am fully aware of this syntax error I was committing. The strange part it works. In my second month, all my research triggers for the missionscript spawn.

It is ABSOLUTELY IMPOSSIBLE that this works, the game will not even read this. It will read one getOneFree and ignore the rest.
I can say this with the same certainty as I can say that the sun will rise in the morning.

Yet this does not answer the question of this thread of why the topic given free by the event has to be researched again.

To repeat what I have already said:
1. the game will give you STR_CHIP for free when the event pops up (it does NOT give you any of the getOneFree(s))
2. the game will then allow you to research STR_CHIP again, so that you can get the remaining getOneFree(s) too

You don't HAVE TO research it again, you CAN research it again (to receive the getOneFree reward).
« Last Edit: July 26, 2020, 12:14:08 pm by Meridian »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9103
    • View Profile
Re: Help with events
« Reply #11 on: July 26, 2020, 12:07:21 pm »
Here you have the simplest example, tested and working:

Code: [Select]
eventScripts:
  - type: STR_TEST_EVENT_SCRIPT
    eventWeights:
      0:
        STR_TEST_EVENT1: 100
    firstMonth: 0
    lastMonth: 0
    executionOdds: 100

events:
  - name: STR_TEST_EVENT1
    description: STR_TEST_DESCRIPTION1
    background: BACK13.SCR
    researchList: [STR_LASER_PISTOL]
    timer: 60

One hour after the start of the game, it gives you the STR_LASER_PISTOL research, and it is not possible to research STR_LASER_PISTOL again.

wcho035

  • Guest
Re: Help with events
« Reply #12 on: July 26, 2020, 12:35:34 pm »
If it is intentional, then we don't have anything else to discuss.
It works correctly.

It is ABSOLUTELY IMPOSSIBLE that this works, the game will not even read this. It will read one getOneFree and ignore the rest.
I can say this with the same certainty as I can say that the sun with rise in the morning.


I will test the same thing again tonight, I know my memory did not lie from the test. However, I did have to research the topic again after it was given free, to enable it.

To repeat what I have already said:
1. the game will give you STR_CHIP for free when the event pops up (it does NOT give you any of the getOneFree(s))
2. the game will then allow you to research ST_CHIP again, so that you can get the remaining getOneFree(s) too

Part 1 is confirm, it does not give me of the getOnefree, after the event pops up. I have to research it again to get them.

Part 2, now rather than using an event to get the research free, I have to scrap this idea. I thought researchList: is suppose to get a research for free AND with its corresponding, branching rewards and etc, without the need to research STR_CHIP again.

So, there is a technicality then, if getOneFree(s) feature is used?

I need to do more testing tonight. I do recall last night, in both instance, getOneFree(s) and not used, I still have to research the topic again. I will record any confirmation I found. Also with that hack, I remember it too works. I am not saying you are incorrect Meridian, there is some weird results last night which had led me to believe that I meet my objectives in what I want. I need to duplicate again to confirm.

wcho035

  • Guest
Re: Help with events
« Reply #13 on: July 26, 2020, 03:37:46 pm »
After some more test. I can confirm everything is as you say. Sorry for doubting you and thank you for your time as usual. I was going to have a more complicated research tree, now this will have to be more simplistic.