Custom Tutorial

    Joined
    Jun 29, 2013
    Messages
    144
    Reaction score
    64
    • Modder
    • Legacy Citizen 4
    • Purchased!
    Hello,

    I've some documentation here to make new Tutorial/Quest for your players. Let's see how work tutorial files.
    Tutorial folder:
    Code:
    ./data/Tutorial/NAME_OF_TUTORIAL/
    Inside of this folder you have NAME_OF_TUTORIAL.xml and eventually some image

    JavaScript:
    <Tutorial description="Some Description">
        <Start type="text">
            <Content>string</Content>
            <Duration>int</Duration>
            <Satisfied>StateA</Satisfied>
        </Start>
    
       <!--Optional states, can use diffrent name and has many has you want-->
       <StateA type="text">
         <Content>string</Content>
         <Duration>int</Duration>
         <Back>Start</Back>
         <Satisfied>StateB</Satisfied>
       </StateA>
    
       <StateB type="text">...
       <!--end of optional states-->
    
        <End type="text">
            <Content>string</Content>
            <Duration>int</Duration>
            <Back>StateB</Back>
        </End>
    </Tutorial>

    State can have diffrents balises with diffrent kinf of data.
    JavaScript:
        <Content></Content>                              //string    text to show,/!\ if not set script return error
        <Duration></Duration>                            //int       state duration,/!\ if not set script return error
        <Image></Image>                                  //string    image name to show
        <NPCName></NPCName>                              //string    NPC name (used for next step if used at end)
        <StructureUID></StructureUID>                    //string    structureUID
        <TypeA></TypeA>                                  //int       diffrent use
        <Count></Count>                                  //int       count
        <Slot></Slot>                                    //int       slot id
        <Clear></Clear>                                  //bool      if set to true, clear player inventory
        <LimitedBlockSupply></LimitedBlockSupply>        //bool      not used
        <Active></Active>                                //bool      diffrent use
        <BlockPosA></BlockPosA>                          //v3i       x, y, z
        <BlockPosB></BlockPosB>                          //v3i       x, y, z
        <RecordPosition></RecordPosition>                //bool      used with BlockPosA, mark area
        <SkipWindowMessage></SkipWindowMessage>          //bool       
        <Condition></Condition>                          //string    set fail condition, see at line 55
        <Satisfied></Satisfied>                          //string    state to go on validation
        <Back></Back>                                    //string    state to go on previous
        <TypeB></TypeB>                                  //          not used
        <BackBack></BackBack>                            //          not used
        <TakeAsCurrentContext></TakeAsCurrentContext>    //          not used

    State's attaribut type define how user validate current state
    JavaScript:
    /*    StateX type="text"
    *
    * Validate after reading
    * @balise string    <Content>    text to show
    */
    
    /*    StateX type="waitingText"
    *
    * Validate after reading
    * @balise string    <Content>    text to show
    */
    
    /*    StateX type="skip"
    *
    * Validate after reading
    * @balise string    <Content>    empty string
    */
    
    /*    StateX type="talkToNPC"
    *
    * validate on player talk to <NPCName>
    * @balise string    <Content>    text to show
    * @balise string    <NPCName>    name of NPC
    */
    
    /*    StateX type="tutorialCompleted"
    *
    * @balise string    <Content>    text to show
    */
    
    /*    StateX type="instantiateInventory"
    *
    * Starmade save player current inventory
    * @balise string    <Content>    text to show
    * @balise bool        <Clear>        true to clear player inventory
    */
    
    /*    StateX type="restoryInventory"
    *
    * Starmade restore saved inventory
    * @balise string    <Content>    text to show
    */
    
    /*    StateX type="teleportTotutorialSector"
    *
    * teleport player to new instance of tutoral at BlockPosA in StructureUID
    * @balise string    <Content>        text to show
    * @balise string    <StructureUID>    uid of structure
    * @balise v3i        <BlockPosA>        cordinate "x, y, z" of teleportation in <StructureUID>
    */
    
    /*    StateX type="teleportTo"
    *
    * teleport player to BlockPosA in StructureUID
    * @balise string    <Content>        text to show
    * @balise string    <StructureUID>    uid of structure
    * @balise v3i        <BlockPosA>        cordinate "x, y, z" of teleportation in <StructureUID>
    */
    
    /*    StateX type="spawnShip"
    *
    * validate on spawn ship core
    * @balise string    <Content>                text to show
    * @balise bool        <LimitedBlockSupply>    !optional: if set to true, player need to have or buy ship core
    */
    
    /*    StateX type="getInStructureUID"
    *
    * validate if player is at BlockPosA in StructureUID
    * @balise string    <Content>                text to show
    * @balise string    <StructureUID>            uid of structure
    * @balise v3i        <BlockPosA>                cordinate "x, y, z" to check in <StructureUID>
    */
    
    /*    StateX type="getIntoLastSpawnedShip"
    *
    * validate if player is in last spawned ship
    * @balise string    <Content>                text to show
    */
    
    /*    StateX type="placeBlockOnLastSpawned"
    *
    * validate when player place TypeA in last spawned ship
    * @balise string    <Content>                text to show
    * @balise int        <TypeA>                    block id
    * @balise v3i        <BlockPosA>                !optional: where player need to place block (marked area)
    * @balise bool        <LimitedBlockSupply>    !optional: if set to true, player need to have or buy blocks
    * @balise int        <Count>                    !optional: amount of block needed
    */
    
    /*    StateX type="placeBlock"
    *
    * validate when player place TypeA
    * @balise string    <Content>                text to show
    * @balise int        <TypeA>                    block id
    * @balise v3i        <BlockPosA>                !optional: where player need to place block (marked area)
    * @balise bool        <LimitedBlockSupply>    !optional: if set to true, player need to have or buy blocks
    * @balise int        <Count>                    !optional: amount of block needed
    */
    
    /*    StateX type="destroyEntity"
    *
    * validate on destroy entity StructureUID
    * @balise string    <Content>                text to show
    * @balise int        <StructureUID>                    block id
    */
    
    /*    StateX type="openChest"
    *
    * validate when player place TypeA
    * @balise string    <Content>                text to show
    * @balise v3i        <BlockPosA>                position of chest to check
    */
    
    /*    StateX type="putinChest"
    *
    * validate when player place TypeA
    * @balise string    <Content>                text to show
    * @balise int        <TypeA>                    block id
    * @balise v3i        <BlockPosA>                !optional: where player need to place block (marked area)
    * @balise bool        <LimitedBlockSupply>    !optional: if set to true, player need to have or buy blocks
    * @balise int        <Count>                    !optional: amount of block needed
    */
    
    /*    StateX type="selectProductionOn"
    *
    * validate on production type = TypeA in factory at position BlockPosA
    * @balise string    <Content>                text to show
    * @balise int        <TypeA>                    production type
    * @balise v3i        <BlockPosA>                position of factory to check
    */
    
    /*    StateX type="typeInInventory"
    *
    * validate if player has Count of block id TypeA in inventory(default Count = 1)
    * @balise string    <Content>                text to show
    * @balise int        <TypeA>                    block id
    * @balise int        <Count>                    !optional: amount of block needed
    */
    
    /*    StateX type="typeInPersonalCapsuleRefinery"
    *
    * validate if player has Count of block id TypeA in personal capsule refinery (default Count = 1)
    * @balise string    <Content>                text to show
    * @balise int        <TypeA>                    block id
    * @balise int        <Count>                    !optional: amount of block needed
    */
    
    /*    StateX type="typeInPersonalFactoryAssember"
    *
    * validate if player has Count of block id TypeA in personal factory assembler (default Count = 1)
    * @balise string    <Content>                text to show
    * @balise int        <TypeA>                    block id
    * @balise int        <Count>                    !optional: amount of block needed
    */
    
    /*    StateX type="connectBlocks"
    *
    * validate when block at BlockPosA is connected to block at BlockPosB
    * @balise string    <Content>                text to show
    * @balise int        <TypeA>                    block id
    * @balise v3i        <BlockPosA>                postion of master block
    * @balise v3i        <BlockPosB>                postion of slave block
    */
    
    /*    StateX type="weaponPanelOpen"
    *
    * validate when player open weapon panel
    * @balise string    <Content>                text to show
    */
    
    /*    StateX type="assignWeaponSlot"
    *
    * validate when player assign computer id TypeA to slot id Slot
    * @balise string    <Content>                text to show
    * @balise int        <TypeA>                    computer id
    * @balise int        <Slot>                    assignation slot
    */
    
    /*    StateX type="weaponPanelClosed"
    *
    * validate when player close weapon panel
    * @balise string    <Content>                text to show
    */
    
    /*    StateX type="activateFlightMode"
    *
    * validate when player is in flight mode
    * @balise string    <Content>                text to show
    */
    
    /*    StateX type="activateBuildMode"
    *
    * validate when player is in build mode
    * @balise string    <Content>                text to show
    */
    
    /*    StateX type="activateBlock"
    *
    * validate when player Activate block at BlockPosA
    * @balise string    <Content>                text to show
    * @balise v3i        <BlockPosA>                position of block to check
    * @balise bool        <Active>                true if block need to be active
    */
    
    /*    StateX type="activateGravity"
    *
    * activate gravity on StructureUID
    * @balise string    <Content>                text to show
    * @balise string    <StructureUID>            uid of structure
    */

    There's also diffrent conditions, bellow i've added them with some explications
    JavaScript:
        attr failTo                 //return state on fail
        attr uid                    //!optional, string ship uid
        attr pos                    //!optional, string x, y, z
        attr type                   //!optional, string id
        inner:
            "inShipUID"             //check if player is in attribut uid="ShipUID"
            "inFlightMode"         //check if player is in flight mode
            "inBuildMode"          //check if player is in build mode
            "inLastSpawnedShip"    //check if player is in last spawned ship
            "weaponPanelOpen"      //check if weapon panel is open
            "chestOpen"            //check if chest at attribut pos="x, y, z" is open
            "blockExists"          //check if block at attribut pos="x, y, z" exists
            "setProduction"        //check if production at attribut pos="x, y, z" is set to attribut type="id"

    Now you have all the informations to make new tutorial and with some imagination you can also create quest / scenario. You can see to Custom NPC's thread to see how to integrate theme in your tutorialhttps://starmadedock.net/threads/custom-npcs.5677/
     
    • Like
    Reactions: d4 gaming