Jump to content

Make generic books readable, but only once


Macrophobic

Recommended Posts

There are tons of junk books in the game. I want to make some use of them and make a plugin for DUST, to give the player a chance to get some XP or improve his skills, since there are no quest. The easiest way is to create some craftable skill books and they would require 1 undamaged book or, let's say, 20 damaged and a certain perk. There are 12 variants in the game, 4 small ruined books, 4 large ruined books and 4 undamaged. Craftable books would work like vanilla skill books: you "eat" them and you get a permanent effect, except it would take effect only the first time you read the book. Once you know the contents, you get no bonus for reading another copy of the book.

 

Any tips how to do this? Maybe some sort of hidden perks?

 

Link to comment
Share on other sites

Probably attach a script to each book that would check to see if it's been read once before on use and then if not to proceed with given desired effect listed in the script and list no effects in the actual book themselves. If it has been read then it should just consume the item with no effect.

Link to comment
Share on other sites

You could do it a few ways, but the easiest would be to copy Old World Blues's method. There are advantages and disadvantages here. What they did in OWB was they limited this at the crafting level, which requires no scripting. In OWB, you needed a note, which had only one copy per book and which was removed as part of the crafting process (by listing in the Ingredients, as well as the Conditions, but not listing it in the Output; most recipes just include their required note items in the Conditions).

 

In your case, you can borrow that concept (by using a recipe that gets removed, making the crafting add a note that the player is required not to have when crafting, or by doing other stuff that requires scripting), which will stop players attempting to craft it unnecessarily, or you can script it so that they can always craft it but not always use it. Are there vendors in DUST? Should the player be unable to eat it so that they can sell it to anyone?

Edited by EPDGaffney
Link to comment
Share on other sites

You could do it a few ways, but the easiest would be to copy Old World Blues's method. There are advantages and disadvantages here. What they did in OWB was they limited this at the crafting level, which requires no scripting. In OWB, you needed a note, which had only one copy per book and which was removed as part of the crafting process (by listing in the Ingredients, as well as the Conditions, but not listing it in the Output; most recipes just include their required note items in the Conditions).

 

In your case, you can borrow that concept (by using a recipe that gets removed, making the crafting add a note that the player is required not to have when crafting, or by doing other stuff that requires scripting), which will stop players attempting to craft it unnecessarily, or you can script it so that they can always craft it but not always use it. Are there vendors in DUST? Should the player be unable to eat it so that they can sell it to anyone?

 

It's not (Nexus users love this word) "immersive". Once you restore an old book, you don't lose ability to restore books.

 

As for vendors, what I mean there are very few vendors, and most of NPC's don't seem to be fond of reading, so the best way for the Survivor to acquire some books that would help him to survive on the Wasteland is to reconstruct them from remains of those ruined books scattered around. However, the Survivor's only quest is to stay alive, find shelter, fight for food and don't end as someone else's food, not to loot every location for books. But the ability to read each title only once wouldn't make the game unbalanced, as there are only 12

Link to comment
Share on other sites

Probably attach a script to each book that would check to see if it's been read once before on use and then if not to proceed with given desired effect listed in the script and list no effects in the actual book themselves. If it has been read then it should just consume the item with no effect.

 

Thanks, that would make sense, but how would I check if this variant of book had been already read? I think I have and idea: make a hidden, weightless version of each craftable book, added the way bottlecaps are added after consuming Nuka-Cola, and it would check inventory for hidden books. I don't know exactly how, but I could try.

 

My initial thought was to add 12 new perks and the "magic effect" would work only if the player hasn't obrained the perk yet, but I'm not sure how to do this either.

Link to comment
Share on other sites

Then you don't make a 'Book', but an Ingestible. Then you give it an Effect, which has to use a script, so then you need to make a completely separate script that gets attached to that effect. Instead of 12 perks, in that case, you could just use a quest script as a variable reservoir. The quest script would be something like:

scn DUSTBooksVariableQuestScript

int bBarter
int bEnergy
int bExp
int bGuns
; and so on and so forth

Then the effect script, using Barter as he example, would be something like:

scn DUSTBooksBarterEffectScript

Begin ScriptEffectStart
    if DUSTBooksVariableQuest.bBarter == 0
        player.modav barter 5    ; (or whatever value you want)
        set bBarter to 1
    endif
End

Edit: So, I was looking at the wiki and they claim OnEquip will run when you use a book if Teaches is set to NONE. I've seen stuff like that on the wiki before and it's never worked for me, but you can try it. The NCR Emergency Radio is handled with a script effect like what I have above, and I'm almost certain there was no advantage in that, so I suspect OnEquip doesn't run when you use an Ingestible, despite what the wiki says.

If OnEquip does work, you'd still make the quest script, and attach the other script directly to the book, using Begin OnEquip instead of ScriptEffectStart, and it should work without doing anything else (if OnEquip works in this context, which you'll need to test).

Edited by EPDGaffney
Link to comment
Share on other sites

It doesn't technically have to be a book, I checked some popular mods and their authors add new skill books as food items with custom effects.

 

So I made a custom ingestible item and named it "qwerty"

Then I made a new Magic Effect, "QwertyMagicEffect" and added it to the item.

Then I created the effect script, and named it "QwertyEffectScript"

scn QwertyEffectScript

BEGIN ScriptEffectStart


            Player.ModActorValue CarryWeight 10


END

And the quest script looks like this:

scn QwertyQuestScript

Int bbCarryWeight

Now I can consume the item and it actually increases carrying capacity by 10. So after eating 100 "books" CarryWeight would increase by 1000, but apart of this, it works.

 

 

However, when I add the condition

scn QwertyEffectScript

BEGIN ScriptEffectStart


	if QwertyQuestScript.bbCarryWeight == 0
        	Player.ModActorValue CarryWeight 10
		set bbCarryWeight to 1

	endif

END

I can't save the script. I probably missed or mistyped something.

 

Link to comment
Share on other sites

You have QwertyQuestScript.bbCarryWeight, but you want to use the name of your quest, not its script, so in your case, probably:

QwertyQuest.bbCarryWeight

Remember to make an actual quest, and remember to attach this script to that quest.

 

Either way, I forgot that you can just put that condition on the effect itself when you choose it in the Ingestible form for the book. That would be GetQuestVariable. Of course, you need to declare that variable in the quest script first.

 

Or you can correct this script's if statement, and then do an ElseIf and put a corner message if you like (to remind the player that they can only get the effect once). Provided you're using NVSE:

https://geckwiki.com/index.php/MessageEx

 

Speaking of which, you can use GECK PowerUp (which requires NVSE) and it will proofread your scripts for you. I highly recommend it.

 

Edit: WAIT -- I've changed everything above.

Edited by EPDGaffney
Link to comment
Share on other sites

No quest stages or conditions. All you need is the script to be attached and the quest to be running, and you're done with that form entirely.

 

Your variable in your script (I see it in the back in your screenshot) is still missing the quest ID:

bbCarryWeight should be QwertyQuest.bbCarryWeight

Link to comment
Share on other sites

  • Recently Browsing   0 members

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