Jump to content

[LE] Adding a Perk Point by Reading a Book via Script in CK


jeyoon

Recommended Posts

After reading through some of the commentary in other posts from IsharaMeradin I was able to apply the below simple script to a custom book i made in CK that would add a perk point to the PC upon reading. So I thought I would post this in case someone else is trying to make something similar and to thank Ishara for the great advice given in other posts.

 

 

Event OnRead()
Game.AddPerkPoints(1)
EndEvent

Link to comment
Share on other sites

If you don't add a 'Bool' or a 'Global' or a 'State' to that script, the book will add a perk point every single time the player reads the book. (cheat mod).

If this is what you want, then it's ok, if not then you have a problem.

Link to comment
Share on other sites

Correct, I had a difficult time finding the line Game.AddPerkPoints(1) so I thought it might save someone some time if they were also looking for a solution. Also, it is probably good to add in a .show() message script as well so that you know you received the perk.

That said, for my personal use the cheat book fit the need, but for other people who may want the book to only give a one time only perk point could you provide an example line to successfully execute? It is beyond my knowledge.

Thank you

Edited by jeyoon
Link to comment
Share on other sites

As i said you could use a 'Bool' property or a 'Global', but in this circumstance is better to work with 'States', the reason behind this is explained further down:


Script with a 'Bool' property:

* The scripting logic here is the same as with using a 'GlobalVariable'.



Bool Property PerkAdded = Fasle Auto Hidden

Event OnRead()
If ( PerkAdded == False ) ; Check Bool and / or GlobalVariable
PerkAdded = True
Game.AddPerkPoints(1)
EndIf
EndEvent




Script using 'States':



Auto State WaitingPlayer
Event OnRead()
Game.AddPerkPoints(1)
GoToState("AllDone")
EndEvent
EndState

State AllDone
; Do Nothing
EndState



The main and big difference is that the scripts using the 'Bool' or 'GlobalVariable' logic will always fire when you open the book even if its work has already been done / finish, while opening the book the script will run to check that 'Bool' and / or GlobalVariable'.

While:

The script that it's using 'States' after the script first fires it will go to a 'State' that it will no longer fire anything, it will do NOTHING anymore, it is 'Kind' of equivalent of 'Deleting' the script (but it's not).


I hope it helps you.

Edited by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

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