I've had this parallel Common Event in my project which tracks a few things and has the ability to cause an 'illness' state. However, since my game has some serious lag due to CEs such as this one, I wanted to start weeding them out by converting some of them to Scripts. This is the largest one. Illnesses and Diseases! I took it upon myself to make an in-depth beginning to the script, using several other scripts, such as ModernAlgebra's Quest script as a model. However, I really suck at scripting and would like to ask someone to take on the project, which should become very clear after reading through this script intro and beginning. A guy like, MA, himself (hint, hint), would have no problem with it I'm sure, but hey, anyone will do, just so long as it works when completed. I've got a little demo put together which will test the script when it is completed.
Anyway, here's what I got (oh yeah, and your name will be above mine in the intro should you actually take on the task)
#DUFUTAs_Illness 1.0
#By DUFUTA, aka IXFURU
#
#
#
#This script utilizes a system of states caused by several different
#game aspects. For instance, being on certain tiles, being in certain weathers,
#coming in contact with certain events. The goal of this script is to
#simulate sicknesses and diseases.
module DUFUTAs_Illness
#==============================================SECTION 1====================
#This section is a list of arrays which correspond to the way Illnesses from
#SECTION 2 can be contracted. In other words, the numbers inside each array
#will represent the <ill_id> of the ILLNESS. Also listed here is the setting
#in-game SWITCH which can activate/shut-off the script completely.
#=============================================================================
ILL_SWITCH = 3 #id of in-game switch to activate/shutoff script
WEATHER_ILLS = [1, 2] #numbers represent ILLNESSES which can be contracted by weather
PATH_ILLS = [1, 3] #numbers represent ILLNESSES which can be contracted by tiles
EVENT_ILLS = [1, 2, 3] #numbers represent ILLNESSES which can be contracted by events
#=============================================SECTION 2=====================
#This section will provide a breakdown of the ILLNESSES one can attain. You can
#create as many ILLNESSES as you like and set them up accordingly. Just make
#sure there is a reference to them in SECTION 1, dependent upon how you would
#like the ILLNESS to be contracted. As you saw above, an ILLNESS can be
#contracted in more than one way.
#
#The following is an overview of ILLNESS settings setup. You can mimmick this
#example, but you don't have to stick strictly to its elements. Whatever part
#you leave out of your ILLNESS settings will resort to the default settings
#immediately following this section.
#
#Remember that if you add the number of the <ill_id> to your array but don't set
#up the relative settings, the ILLNESS will in-effect have no actual effects due
#to the default settings. Therefor, if ILLNESS with 4 for an ill_id can be
#found in the PATH_ILLS array of SECTION 1, then you need to make sure, that the
#ILLNESS in SECTION 2 has properties pertaining to the PATH.
#
#
# EXAMPLE OVERVIEW:
#When <ill_id>
#ill_state = <a>
#ill_switch = <in-game switch id>
#weather_id = <b>
#weather_odds = <c>
#path_ids = <[d, e, f]>
#path_odds = <g>
#event_comment = <'SIK'>
#event_odds = <h>
#ill_remarks = <'you got sick'>
#ill_SE = <'Absorb1'>
#ill_animation = <i>
#actor_immunities = <[j, k, l>
#
#The following will describe each of the parts of the settings, YOU DON'T NEED
#TO INCLUDE THE <> SYMBOLS IN YOUR SETTINGS. Just replace it with a variable
#or string, whichever is called for.
#
#PART 1: <ill_id>
#replace with a number which will be used to identify the specific ILLNESS.
#This number is stored in the SECTION 1 arrays.
#
#PART 2: ill_state
#replace assigned <a> with a number to represent the state_id from the
#database. This will subsequently give the contractor of the ILLNESS a state
#when contracted. Make sure that if you place a value here, you have the ILLNESS
#defined in a state of that id number in the database. For example, If you
#place assign a 20 to the ill_state variable, you'll need to go into the
#database and setup up state number 20 to match it.
#
#PART 3: ill_switch
#replace assigned <in-game switch id> with number representing switch that will
#be activated upon contraction of the ILLNESS. This way, you can setup events
#and Conditional Branches to react to someone in the party having the ILLNESS.
#
#PART 4: weather_id
#replace assigned <b> to a number corresponding to weather type. For instance,
#if you want the ILLNESS to be activated by exposure to rain then use the number
#1 here to signify, when raining.
#
#PART 5: weather_odds
#replace assigned <c> with a integar (number) which will effect how much of a
#a chance there is of contracting the ILLNESS. For instance, if you assign
#10, there will be a one in 10 chance you will contract the illness each time
#the weather check loop is run. Basically, the loop will call a random number
#from 1 to <c> and the illness will be contracted if the random number is 1.
#Since the loop is run once every 5 seconds (300 frames), there's a chance
#you will contract the ILLNESS once every 5 seconds. For weather, it's best to
#set a pretty high number. For, you want the chances of catching the illness
#to be greater only if you are exposed to the corresponding weather for prolonged
#periods of time. This number is recommended at 500 or so.
#
#PART 6: path_ids
#replace the letters in the brackets with numbers representing the tile ids.
#This will call the chance at ILLNESS each time the player steps onto these
#particular tiles. Make sure you keep the brackets [] for the array when
#assigning this ILLNESS property in the settings.
#
#PART 7: path_odds
#replace assigned <g> with integar from which a random number will be chosen
#once each time the player steps onto the given tile. Like the weather odds,
#this gives the player a 1 in <g> chance at contracting the ILLNESS when the
#loop is called. I recommend a moderately high number. Somewhere between 50
#and 200. This way, it's unlikely you will pick up the ILLNESS from short
#strolls across the tile.
#
#PART 8: event_comment
#replace the string (word) inside the ' ' with a word that will be placed inside
#an event comment command, signifying that the given event has the ability to
#infect someone with the ILLNESS. Here's how it works. If you come in contact
#action button an event, like an NPC or treasure chest with the comment "SIK"
#in the commands of the event's active page, there will be a chance at contracting
#the illness.
#
#PART 9: event_odds
#replace assigned <h> with a number for representing chance at ILLNESS when
#in contact with an event which has the proper event_comment in its commands.
#Best to make this a small number, especially for common ILLNESSes. Recommended
#5 to 20.
#
#PART 10: ill_remarks
#replace the string or number of strings inside the ' ' with the word(s) you wish
#to display if and when the player contracts this ILLNESS. Words will appear
#in a text box just over the player's sprite.
#
#PART 11: ill_SE
#replace the string inside the ' ' with a name of a SE from the resources of
#your project. This way, you will hear this sound when contracting the
#specific ILLNESS.
#
#PART 12: ill_animation
#replace assigned <i> with an integar corresponding to a given database
#animation. Subsequently, this animation will play when the ILLNESS is
#contracted.
#
#PART 13: actor_immunities
#replace assigned letters inside brackets [] with numbers which will determine
#which actors are immune to the ILLNESS. Feel free to add as many as you want.
#Just don't forget to surround your numbers with the [] brackets and keep
#commas , between them.
#===============================================================================
#This sets defaults. LEAVE IT ALONE.
def self.illness_data(ill_id)
ill_state = 0
ill_switch = 0
weather_id = 0
weather_odds = 0
path_ids = []
path_odds = 0
event_comment = 'sick'
event_odds = 0
ill_remarks = 'You got sick.'
ill_SE = 'Absorb1'
ill_animation = 3
actor_immunities = []
case ill_id
#===============================================================================
#SETTINGS/PROPERTIES
#Modify and create new ILLNESSES
#===============================================================================
when 1 #FLU
ill_state = 17
ill_switch = 4
weather_id = 1
weather_odds = 500
path_ids = [2864]
path_odds = 50
event_comment = 'FLU'
event_odds = 5
ill_remarks = 'You have contracted the FLU'
ill_SE = 'Absorb1'
ill_animation = 3
actor_immunities = 4
when 2 #SOGGYBUMPS
ill_state = 18
ill_switch = 5
weather_id = 1
weather_odds = 500
event_comment = 'SOGGY'
event_odds = 10
ill_remarks = 'You have contracted SOGGYBUMPS'
ill_SE = 'Absorb2'
ill_animation = 6
actor_immunities = 2
when 3 #BIGPOX
ill_state = 19
ill_switch = 6
path_ids = [2864]
path_odds = 100
event_comment = 'POX'
event_odds = 5
ill_remarks = 'You have contracted the POX'
ill_SE = 'Darkness1'
ill_animation = 9
actor_immunities = 1
end
return ill_state, ill_switch, weather_id, weather_odds, path_ids, path_odds
return event_comment, event_odds, ill_remarks, ill_SE, ill_animation
return actor_immunities
end
#determine if script is on
#========================================================================
if ILL_SWITCH == true
#========================================================================