aliens

Author Topic: [Answered] Remove item from base inventory after event is triggered by item.  (Read 2840 times)

thePaleone

  • Guest
Hi, I apologise if this is the wrong part of the forum to ask my question, I have just recently wrote an event script for my humble small mod. I used an item from the inventory in my base to trigger off an event in a coming month. Is it possible to have the item delete or remove from the base inventory by the event after it was triggered?
« Last Edit: February 12, 2023, 10:37:17 am by Meridian »

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9103
    • View Profile
Re: Remove item from base inventory after event is triggered by item.
« Reply #1 on: October 08, 2020, 11:01:52 pm »
Hi,

it's currently not possible.
But if you give us some examples of usage and maybe explain why do you think it's a good idea, we can consider it for the future versions.


Currently "unpreventable stealing from the player" doesn't sound very appealing to me...
Not to mention the player could have sold or used up the item(s) that were scheduled for stealing when the event pops up. What should happen then?

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 11730
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Remove item from base inventory after event is triggered by item.
« Reply #2 on: October 08, 2020, 11:54:18 pm »
The only way this would be acceptable would be an additional check: if the item no longer exists in the base, the event doesn't run. The same as interruptResearch stops missions.

I don't know if it's practical, or a good idea, but it's definitely a necessary condition, otherwise such a feature wouldn't make sense.

thePaleone

  • Guest
Re: Remove item from base inventory after event is triggered by item.
« Reply #3 on: October 09, 2020, 12:06:55 am »
My simple mod is where I or player can buy a lottery ticket, and it will then go into a draw next month to win either Ammo, Cash, Weapon or nothing. Once the lottery was over and after the event was triggered, the lottery ticket is removed.

I think it is a good idea, for any modder who want an event only to be trigger after an inventory item was purchase and to be removed after the event was triggered. Can be a Lottery in my case, can be some random events that spawn something.. or act as a stop for a chain events that continuously triggered by the same inventory item?

The only way this would be acceptable would be an additional check: if the item no longer exists in the base, the event doesn't run. The same as interruptResearch stops missions.

I don't know if it's practical, or a good idea, but it's definitely a necessary condition, otherwise such a feature wouldn't make sense.

What if the item can't be sold? With missing costSell line in the item? It can't be get rid off. Sorry if my logic is simple, I can't think of any way an item can go missing if it can't be sold. If you make the item as geoscape item, then it can't be used correct?
« Last Edit: October 09, 2020, 12:20:58 am by thePaleone »

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Remove item from base inventory after event is triggered by item.
« Reply #4 on: October 09, 2020, 03:17:58 am »
If I understand correctly I can see this being useful for a few things.

This would allow time frames where items are viable with expiration dates that remove the item, here is an example:
What if you could manufactured an item called "Charged Energy Cells" that at a certain time would either be removed from the player's inventory or changed into a different item.

"Charged Energy Cell" could become "Dead Energy Cell" on a certain day of the month or X days after it is created.


Additionally it could be used to clean up items that after a certain date have no use due to them being involved in a story arc.

For example if the player has obtained an alien item that needs to be research before month X to gain the location of a time sensitive mission which is not available after that date.

The item could be automatically transformed or removed from the player's inventory after that date preventing the research from being undertaken or the item being used in further manufacturing projects.

What if the item can't be sold? With missing costSell line in the item? It can't be get rid off. Sorry if my logic is simple, I can't think of any way an item can go missing if it can't be sold. If you make the item as geoscape item, then it can't be used correct?

I was going to ask for that feature as well. If it is not already present having items that cannot be sold from the "PURCHASE/RECRUIT" screen would be useful.

For example this could be used with story arc related or otherwise special items that the mod creator does not want the player to be able to accidentally sell.

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3350
    • View Profile
Re: Remove item from base inventory after event is triggered by item.
« Reply #5 on: October 09, 2020, 11:11:42 pm »
Quote
"Charged Energy Cell" could become "Dead Energy Cell" on a certain day of the month or X days after it is created.
I could say this is impossible, item is only number in geoscape, rewrite lot of logic to have state per item, not mention bigger save size.

For item that cannot be sold, this could have dire consequences, what if you lost storage? You need reduce everything to 0 but you have one item that is not sell able and keep you on 0.1 over limit. This mean it will need some more code than simply remove from sell screen.

Question is if better not add option for warning when you try sell som items like:

"Commander sentient say that we do not know purpose of this item, it would be wise not sell it"

Offline The Martian

  • Commander
  • *****
  • Posts: 754
  • "It implores you to listen to its arguments..."
    • View Profile
Re: Remove item from base inventory after event is triggered by item.
« Reply #6 on: October 10, 2020, 12:56:02 am »
ThePaleone is it possible with scripts or events to check the player's storage on certain day(s) every month and remove the lottery ticket if it is found, else do nothing?

If such a reoccurring check is possible and the script or event only pays out if an item of the expected type was found, this could provide the illusion that the event was being triggered by the item purchase.

That way it isn't triggered by an item being created so much as it is always checking for the item, but only displaying results to the player if they have purchased the lottery ticket. With the reality being the event was checking for the item at a regular interval without informing the player even when no lottery ticket was purchased.

Question is if better not add option for warning when you try sell som items like:

"Commander sentient say that we do not know purpose of this item, it would be wise not sell it"

I see what you mean, a prompt to warn the player would probably be enough in most cases.

If the displayed text is assigned to an easily configurable variable the mod creator could tailor the prompt's style to fit the theme of their mod.

STR_ITEM_SALE_WARNING: "Commander sentient say that we do not know purpose of this item, it would be wise not sell it"

Additionally it could also be used for items that are intended be sold but have an additional confirmation prompt displaying a reason the player may wish to reconsider.

For example, the player tries to sell an item called "Damaged Golden Treasure." and a YES / NO prompt asking if they want to sell it appears with the message "This item will sell at a fraction of its value in its current condition." to warn the player that they could in some way convert it into a more valuable item via manufacturing or some other method specific to that mod.
« Last Edit: October 10, 2020, 01:11:58 am by The Martian »