Jump to content

Scripting Help


LongRaider

Recommended Posts

Hello everyone, I'm working on a highly interactive player home.

I'm relatively new to scripting but I'm slowly getting the hang of it.

However, I'm stuck on a few ideas.

First:

 

Basically I want to be able to stock purified water on a shelf, depending on the amount of purified waters in a fridge.

Now, I'm able to get this to work as an object script and activated by a button.

 

Here is my script: (Very basic only set up for one water bottle)

 

scn CSpwaterstockscript
short pwaterstock
begin onactivate
set pwaterstock to CSfoodstock.getitemcount waterpurified
if pwaterstock == 1
CSpwater1.enable
endif
end
This works perfect for that one water bottle. However, I want this to be more fluid. Instead of having to press the button everytime to stock, I want it to be like if i go in the fridge and put in two water bottles two more will show up on the shelf. I tried using a "gamemode" instead of "onactivate" block but to no avail. Do I have to change the script type to quest or effect? Basically how do I make this work so the script will run all the time and disable or enable the bottles as they are taken or added into the fridge?
Second:
From the above idea, I have all of the water bottles recreated as static objects in the geck, and a milk crate they are in as an activator. Everytime the milk crate is activated one purified water is added to the players inventory, and a water bottle is taken from the fridge.
However, instead of 1 water bottle everytime, am I able to bring up the how many? menu from containers and merchants?
Basically waht I'm looking for is:
Player activates the milk crate.
the "how many?" menu pops up.
the player chooses how many waters they want and that many are added to the players inventory and removed from the fridge.
How would I go about doing this?
Thank you in advance.
Also sorry to everyone on this forum as this is my third geck question here on the forum.
Also thank you to everyone for the help!
Link to comment
Share on other sites

For the first one, you should have another if block for each bottle of water to display.

if (bottleCount == 1)
     enable 1
endif

if (bottleCount == 2)
     enable 2
endif

etc etc

For your second one, you have two options, move the bottled water to another container, with only bottled water (to make it easy to select) and then open that container to the player by using container.activate player, or provide some kind of message box with buttons for "take 1" "take 2" "take 5" etc.

Link to comment
Share on other sites

For the first one, you should have another if block for each bottle of water to display.

if (bottleCount == 1)
     enable 1
endif

if (bottleCount == 2)
     enable 2
endif

etc etc
For your second one, you have two options, move the bottled water to another container, with only bottled water (to make it easy to select) and then open that container to the player by using container.activate player, or provide some kind of message box with buttons for "take 1" "take 2" "take 5" etc.

Thank you for responding and for the help gribbbles! However, I understand how to get each water bottle to enable, but I don't know how to run the script without an activator like a button. How do I just get the script to run in the background so they are enabled as they are taken/added?

 

And thats perfect on the second problem, didn't think of a message box. Thank you!!

Link to comment
Share on other sites

You can put the check in a GameMode block running on a container or some other activator object in the cell. The problem with that is that it will check every single frame, which could potentially have performance issues. The alternative to that would be putting the script in a quest, and then having the quest delay set to some multi-second delay, which would help cut down on performance issues, but would have delays between adding to containers and the update. There are ways around the second issue, but that's starting to get a lot more complicated.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...