This site contains mature content. Do not use this site if you are under 18.
This page last updated January 2023
Author: Hooded Silence
Doc version: v0.1
Code Base: v0.3
Intro
Instructions
Notes
The employment system has been introduced to make creating, tracking and termination easier for non-Zero Hours such as receptionist, shop assistant, etc where you have a fixed hours of employment and may have consequences for not attending. It also allows quests to determine if the MC is employed and will conflict with existing commitments. It's designed to work hand-in-glove with the event generation system that will be implemented in a future release.
A future expansion of the code will hook into an automated daily notifications system to advise players if they have work on that day or warning they have an hour to be there.
The system is broken down into two files:
emp_job_array – This is the init file for each job role. You can set the roles and it's various array variables as needed here.
emp_functions – This is the core library of the system, it validates and creates the job role when called and displays the role in the journal.
We first need to create the array and hours worked here we use the Tourist Guide role as an example:
In emp_job_array we have first create the job title as an arg, this allows the job to be called as gs 'emp_job_array', 'emp_tourist_guide'
Note all jobs and functions are prefixed emp_ to prevent code conflict elsewhere in the code base.
if $ARGS[0] = 'emp_tourist_guide':
Next we need to create a job ID this is a unique integer for each role and is used to create the role:
j_id = 1
Here we set when do the roles fire, 1 is a 7 day shift, 2 is weekday (Mon-Fri) and 3 is weekend (Sat and Sun)
j_day = 2
We then set up the array's Job ID, this is the array marker and allows the function to pull the details across into the journal.
emp_job_id[j_id] = 1
This is the initial job title, this can be changed later with career progression using the array ID
$emp_job_title[j_id] = 'Tourist Guide'
Next up we need to set the start time and finish time, each day has 48 slots to book allowed to book on the hour or half hour time slots. In this case we have a start of 16 and finish of 32 which equates to 0800 to 1600 respectively
emp_job_start[j_id] = 16
emp_job_end[j_id] = 32
How much the role pays out:
emp_job_wages[j_id] = 1000
Next we need to show the location in journal and to guide the player where to trigger the role:
$emp_job_loc[j_id] = 'Pavlosk Park'
Again some text to remind the player when and where the job takes place, it could also be used for career advice, quest related information, etc. It's shown as a pop-up in Journal under work:
$emp_job_notes[j_id] = 'Summer job with flexible days - start between 08:00 and 09:00'
This is the status of the job, I've created some flexibility here to allow for career or quest progression: 1- hired, 2 – hired with 'favours', 3 – started on merit (such as qualifications), 4 – terminated or suspended without prejudice, 5 – Fired permanently to prevent going back to the role. Note I've reserved all values up to 10 for future expansion, you can set your own values here if you wish for your own quests above this.
Also note, I've created a gate to prevent it being overwritten if set.
if emp_job_status[j_id] < 1:
emp_job_status[j_id] = 0
end
The final variable to set in the array is the rank, this allows for creating a career progression such as going from a secretary, head secretary or PA. Again I've created a gate to prevent it being over-written to allow returning to the role at the same career level:
if emp_job_rank[j_id] < 1:
emp_job_rank[j_id] = 1
end
Initialising the role is fairly simple, again using the Tourist Guide role:
On line 15 we determine whether you're employed or fired before proceeding to the interview:
if (emp_job_status[1] = 0 or emp_job_status[1] =4) and emp_job_status[1] ! 5:
note we're using emp_job_status with the array ID (1) to pull the value from the construct.
Here's where we set up creating the role:
First we initialise the array by constructing in the job array as previously discussed:
gs 'emp_job_array', 'emp_tourist_guide'
However if you have a unique day and time structure you can create your own loop to go through your own array see following notes.
Next we create the job, this will check if there is no conflict between existing jobs and if required previous job history. Note that the j_id has been set by the previous initialising call so this is purely automatic:
gs 'emp_functions','emp_booking'
Finally we'll return the user back to the starting location:
gt 'pav_park', 'start'
At this point the player can now go into the journal work section and visually see when they have to be at a job and click a link to get more information about the role.
Notes:
You can create a non-standard role by setting j_day to -1 and then set the following variables:
d_idx = (int)
d_end = (int)
This will ensure the booking will work in the internal loop. d_idx and d_end should be set to the day(s) of week required, so if you wanted to set Weds/Thurs you'd set them 3 and 4 respectively.
You'd loop through your own values and for each cycle use the following to validate and book the slots:
gs 'emp_functions','emp_booking
In addition remember to set your own hours if required if you've not created an init array.