• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[vJASS] Quest library

Level 25
Joined
Jun 5, 2008
Messages
2,572
A really simple library i wrote while i was bored and in a need of a better way to setup my quests that a hundred of native calls that are far too boring and slow human wise...

Anyway it is simple but unfinished and i need some feedback about this(and yes i know it has no documentation, that will be changed tomorrow when i update the code).

JASS:
library Quest

globals
    private constant integer MAX_QUEST_REQ_SIZE = 10
endglobals

interface qInterface

    boolean             enabled
    boolean             completed
    boolean             failed
    boolean             discovered
    boolean             required

    quest               main
    string              title
    string              description
    questitem   array   questItem       [MAX_QUEST_REQ_SIZE]
    string      array   questItemDes    [MAX_QUEST_REQ_SIZE]
    boolean     array   questItemComp   [MAX_QUEST_REQ_SIZE]
    string              icon
    
endinterface

struct xquest extends qInterface

    boolean enabled = true // by default
    boolean discovered = true   // by default
    boolean required = true // by default

endstruct

function UpdateQuest takes xquest q returns nothing
    local integer i = 0
    call QuestSetEnabled(q.main,q.enabled)
    call QuestSetTitle(q.main,q.title)
    call QuestSetDescription(q.main,q.description)
    call QuestSetIconPath(q.main,q.icon)
    call QuestSetCompleted(q.main,q.completed)
    call QuestSetRequired(q.main,q.required)
    call QuestSetFailed(q.main,q.failed)
    call QuestSetDiscovered(q.main,q.discovered)
    loop
        exitwhen i >= MAX_QUEST_REQ_SIZE
        if  q.questItem[i] != null then
            call QuestItemSetDescription(q.questItem[i],q.questItemDes[i])
        endif
        set i = i +1
    endloop
endfunction
    
endlibrary

The only thing i haven't thought of is how to store the quests for future manipulations(marking them as completed,failed,etc) and i want to hear opinions on how to do this (hashtable is an option).
 
Level 14
Joined
Jun 13, 2007
Messages
1,432
I'm currently working on something similar, in mine you will have diffrent modules that you can choose from like for instance kill X units and collect X items. This system could use something similar
 
Top