Larian Banner
Previous Thread
Next Thread
Print Thread
Joined: May 2020
stranger
OP Offline
stranger
Joined: May 2020
Hello! I've done a little coding with Java in the past, so i have a general understanding of how to code, but I'm having a little trouble understanding the flow of logic in Osiris. I guess the best way to demonstrate this is to give an example of a quest I'm working on. I know this will get a bit messy and will be hard to describe what I do and don't know about coding in Osiris, but here goes.

Basically, I want the player(s) to find an item (a skull) and return it to an npc who then rewards the group with another item (a talisman). I've commented in what I basically want to do in the code, but I'm not sure what the correct calls are to make the effects in game.

some flags being set in the dialogue flow are::

Has_Met_Boralu
-after talking to the npc for the first time.

QuestUpdate_TalismanQuest_QuestReceived
-after accepting the quest.

QuestUpdate_TalismanQuest_Skull_Delivered
-flag for quest update

Skull_Delivered
-flag for general use

QuestUpdate_TalismanQuest_Talisman_Received
-flag for quest update

Talisman_Received
-flag for general use



Right now, this is the code that I have, also with the journal entries that I want to appear:

Journal:
Quest states
-QuestReceived
-HasSkull
-SkullDelivered
-TalismanReceived




Code:

INIT
DB_IsPlayer(CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406);

DB_QuestDef_State("TalismanQuest","QuestReceived", 1);
DB_QuestDef_State("TalismanQuest","Has_Skull", 1);
DB_QuestDef_State("TalismanQuest","Skull_Delivered", 1);
DB_QuestDef_State("TalismanQuest","Talisman_Received", 1);
//no idea if this is anywhere close to what i need. Really, I'm not sure how to use the INIT section. Initialization of variables used in KB section?
----------------------------------------------------------------------------------------------------------------------------


KB
IF
//players talk to the npc and receive the quest. flag is set via dialogue. This part is working.
ObjectFlagSet("QuestUpdate_TalismanQuest_QuestReceived", _speaker, _)

THEN
//this was a test to add an item to their inventory. working
ItemTemplateAddTo("CON_Potion_A_Health_Large_68b40462-247a-44fd-87d0-c2eea2f49ed1", _speaker, 1);




IF
//on quest
ObjectFlagSet("QuestUpdate_TalismanQuest_QuestReceived", _speaker, _)
AND
//and Item in inventory
ItemIsInPartyInventory(ITEMGUID_Unholy_skull_16d0798c-588f-4290-97f1-1a066f639435, CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406,1,1)

THEN
//update quest and flag character as having the skull
ObjectSetFlag(CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406, "QuestUpdate_TalismanQuest_Has_Skull");




IF
//character has item
ItemIsInPartyInventory(ITEMGUID_Unholy_skull_16d0798c-588f-4290-97f1-1a066f639435, CHARACTERGUID_S_GLO_CharacterCreationDummy_001_da072fe7-fdd5-42ae-9139-8bd4b9fca406,1,1) //not sure what integers to use
AND
//and character talks to Boralu
DialogStarted("test_dialogue",_);

THEN
//move item to boralu
ItemToInventory(ITEMGUID_Unholy_skull_16d0798c-588f-4290-97f1-1a066f639435, CHARACTERGUID_High_Priest_Boralu_d4fe747f-0d21-4655-b00a-b3ce9382df4b, 1, 1); //not sure what integers to use

//and update quest log
DB_QuestDef_State("TalismanQuest","Skull_Delivered", 1);




IF
//boralu has item
ItemAddedToCharacter(ITEMGUID_Unholy_skull_16d0798c-588f-4290-97f1-1a066f639435, CHARACTERGUID_High_Priest_Boralu_d4fe747f-0d21-4655-b00a-b3ce9382df4b)
//and talking to player
AND
DialogStarted("test_dialogue",_);

THEN
//move talisman to player
ItemToInventory(ITEMGUID_Holy_Talisman_053c21f4-1c14-4edf-85fc-101b2387f6e1, _Char, 1, 1);
//and update quest
DB_QuestDef_State("TalismanQuest","Talisman_Received", 1);
------------------------------------------------------------------------------


EXIT
//not sure what to use this for


I hope this wasnt too messy. Thanks for any help you can give! :-D


Last edited by Rhonjuras; 09/05/20 03:27 AM. Reason: oops
Joined: Mar 2016
Location: Belgium
T
addict
Offline
addict
T
Joined: Mar 2016
Location: Belgium
Do you know about https://docs.larian.game/Osiris ? It contains a.o. an overview of the language, including an explanation of the structure and the purpose of the INIT/KB/EXIT sections.

Regarding giving/receiving items, check out the following convenience databases (which you would define in the INIT section as well):
* https://docs.larian.game/Osiris/Shared/DB_HasStoryEvent
* https://docs.larian.game/Osiris/Shared/DB_GiveItemToEvent


Moderated by  Larian_Koala 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.5