Jump to content

Small Script Problem


Omeletter

Recommended Posts

I made and play-tested this script:

 

Object script placed on a silver plate laying on a table which is up against the wall and can only be approached from one direction. Touch plate to get apple. Only works once a day.

 

SCN aaTestSilverApplePlate

Short DayofLastUse

Begin Onactivate

If GetDayofWeek != DayofLastUse
	PlaceAtMe Apple 1, 50, 0
	Set DayofLastUse to GetDayofWeek
EndIf

End

 

 

 

Problems:

 

PlaceAtMe is taboo and is not supposed to be used. More especially if it is used repeatedly instead of just once and never again. It creates persistent objects which result in savegame bloat and can eventually ruin a savegame and make it unplayable. (But I doubt you will create that many apples with your mod.) It would not be aesthetically pleasing, but if you used some other command to create your daily apple in a container, you would not create bloat.

 

The apple appears in the wrong place. I wanted it to appear on the silver plate which is also the trigger. It always appears left of the plate, even if I move the table and plate. Therefore, you will need a trigger to the left of the plate. You will have to playtest to make sure your plate is in exactly the right spot to receive your apple.

Link to comment
Share on other sites

1. Question: What is 1 50 0? Is it stands for coordinates? 2. What should I use if I want it in the container? Is it "Additem"? 3. Question, I think I've got the Idea to not ruin the game! What if I create 7 apples, I wanted them to slide down into the basket, strange house really... Please help, what if they're remain disabled, then if its day 1, apple 1 enable, 2 day, 2 apple 2 enable... 3 days respawn time is OK, so because all food respawns in 3 days, we can use vanilla technique.

Thanks, I'll try it out

Link to comment
Share on other sites

Hm, what about apples that when you activate them, they will be disabled and it will be added to the inventory?

That way you could use the same apples over and over again....

Link to comment
Share on other sites

Don't really understand what you meant, I think that we can do the script like there will be 7 apples, and script will activate one of them, enable I mean, so 1 apple for each day of the week, once you took the apple, it'll start to respawn, 3 days respawn time, in vanilla. Or if you took it, it will respawn with another script itself. Not using "PlaceAtMe" command. Using enable instead, but if you haven't took the apple from the plate, or whatever, it won't work.
Link to comment
Share on other sites

What I meant is:

When the apple is placed into the world. (not inside containers) If you activate it, it will disable itself and give you an apple. Instead of normal apples you can pick up, this one will just disable as there is a script attached to it.

The give-part would be just a simple player.additem code..that way you could use the same scripted apple over and over again and you'll have no placeatme problems.

 

Will they be spawn in a chest then? As outside of those..nothing respawns. If it is inside a chest/container..there is no placeatme problem at all. You could put a script on that container that adds an apple every day.

Link to comment
Share on other sites

Answers

Question 1: in the line

PlaceAtMe Apple 1, 50, 0

1 is number of apples placed

50 is distance from player

0 is direction from player (only four directions available it appears.)

 

Question 2: The command to place an apple in a container would be something like:

aaMyContainerREF.AddItem Apple 1

Assuming that you have a non-respawning container, which is a persistent item, and which you have made into a reference.

 

Question 3: Food does not respawn in the game world unless it is in a container. (Under normal conditions as far a I know.) I have one mod in which the entire cell seems to reset sometimes, and all the food I have taken reappears and all my hard-won treasure vanishes. I have not figured out how to do that yet, and it would probably not be appropriate for your home, because you will want to leave things laying around for storage and display. I have heard that The Midas Magic shop ground floor resets. So if you had seven apples to enable for the seven days, they would be gone when you took them all, and there would be no more apples.

 

Am I understanding your design parameters correctly that it is okey for the apple to just automatically be there? Or must you hit a trigger to summon the apple?

 

Here is a new object script to place on an apple you create with a unique form ID. Place the apple on your tray, and it will basically act like it respawns once per day if taken.

 

SCN aaTestBogusAppleSCRIPT

Short DayofLastUse

Begin Onactivate

Player.AddItem Apple 1
Disable
Set DayofLastUse to GetDayofWeek

End

Begin GameMode

If GetDayofWeek == 0  && DayofLastUse == 6
	Enable
EndIf

If GetDayofWeek == 1 && DayofLastUse == 0 
	Enable
EndIf	

If GetDayofWeek == 2 && DayofLastUse == 1
	Enable
EndIf

If GetDayofWeek == 3 && DayofLastUse == 2 
	Enable
EndIf	

If GetDayofWeek == 4 && DayofLastUse == 3 
	Enable
EndIf	

If GetDayofWeek == 5 && DayofLastUse == 4
	Enable
EndIf

If GetDayofWeek == 6 && DayofLastUse == 5 
	Enable
EndIf	

End

 

I am not much of a scripter. I was trained in BASIC, and Oblivion Scripting language is quite alien to me. I could probably find a way to reduce the Begin gamemode block to two "If" statements. An expert might be able to reduce it to one "If" statement. Someone might also know how to use the nested statement format. I do not think this is an excessively resource consumptive script destined to contribute to lag though.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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