Table of Contents

Generic Hooks

See the hooks page to see what hooks we have and ci_g_hooks for more information about hooks system.

Here is list of generic hooks in the cerea2 module:

ch_g_q_incquest
ch_g_q_saytext
ch_g_q_tagger

ch_g_q_incquest

Hook script for incrementing quest state. Part of quest engine Incerements the give quest by one, up to maximum of QuestAdvanceMax. If QuestAdvanceMin is set then the quest must be minimally at this stage to be incremented.

Variables on the Object use:

Variable Description Type
QuestAdvance Name of the quest to advance String
QuestCheckMin Min value of quest level to trigger increment Integer
QuestCheckMax Max value of quest level to trigger increment, i.e. this is the max value where the quest can be incremented Integer

ch_g_q_saytext

Hook script for saying something if quest state is right in QuestSay quest. Says the text QuestSayText using given QuestSayType talk type, but only if QuestSay quest is between QuestSayMin (inclusive) and QuestSayMax (not inclusive). Can also incerement the given quest QuestAdvance by one, up to maximum of QuestAdvanceMax. If QuestAdvanceMin is set then the quest must be minimally at this stage to be incremented.

Variables on the Object use:

Variable Description Type
QuestAdvance Name of the quest to advance String
QuestCheckMin Min value of quest level to trigger increment Integer
QuestCheckMax Max value of quest level to trigger increment, i.e. this is the max value where the quest can be incremented Integer
QuestSay Name of the quest to check whether to say or not defaults to QuestAdvance. Says the text if quest level is between QuestSayMin ⇐ level < QuestSayMax String
QuestSayMin Min value of quest level to say text defaults to QuestAdvanceMin Integer
QuestSayMax Max value of quest level to say text defaults to QuestAdvanceMax Integer
QuestSayText<level> Text to say if QuestSay quest has level <level> (before incrementing) String
QuestSayText Text to say if no QuestSayText<level> found. String
QuestSayType<level> 1 = whisper, 2 = shout, 3 = silent talk, 4 = silent shout (dm shout). Value 0 means use default of QuestSayType Integer
QuestSayType 0 = talk, 1 = whisper, 2 = shout, 3 = silent talk, 4 = silent shout (dm shout) Integer
QuestSayClearHook Clear this hook given as string from the object after running once, i.e. give OnPerception or similar to this variable and this system will delete that string from the oObject, making it so that this hook is not called second time String
QuestSayOncePerPC Say text only once per pc per reboot, uses the value of this unique identifier for this step, thus sets local int with this name to PC to 1 to make sure it is not triggered twice String

ch_g_q_tagger

Hook script that is meant to be used from them item activate hook. It will take the HookTarget and HookLocation from PC, and check if those are matching the filters set on the item (caller is usually the item), object is oPC, and Param1 and 2 come from the SCRIPTHOOK unique power. If the filter match, then it will check if the tag is of the item is already seen and if so, do nothing (or count the number of such items seen), and if not then it will add that tag as seen. This can be used to count for example animals, or different animals or so on.

Tags (or other info) are stored as array to the item so they can be looped through. In the array the key is the tag, and there is only two variables, Name (the name of the first of given tag found), and Count (number of items of that type seen).

Variables on the Object use:

Filters

Variable Description Type
TaggerObjectTypeAllowed Comma separated list of object type numbers allowed. String
TaggerCreatureGenderAllowed Comma separated list of genders numbers allowed. String
TaggerCreatureRaceAllowed Comma separated list of race numbers allowed. String
TaggerCreatureSubRaceAllowed Comma separated list of subrace numbers allowed. String
TaggerCreatureAlignmentAllowed Comma separated list of LG,NG,CG style alignments allowed. String
TaggerCreatureClassAllowed Comma separated list of class numbers allowed. String
TaggerCreatureLevelAllowed Comma separated list of total levels allowed. String
TaggerCreatureEnemyAllowed If set to 1 then enemies are allowed. (If none of Enemy, Neutral, Friend is set then all are allowed). Integer
TaggerCreatureNeutralAllowed If set to 1 then neutrals are allowed. (If none of Enemy, Neutral, Friend is set then all are allowed). Integer
TaggerCreatureFriendAllowed If set to 1 then friends are allowed. (If none of Enemy, Neutral, Friend is set then all are allowed). Integer
TaggerCreaturePCAllowed If set to 1 then PC are allowed (if none of PC, NPC, Summoned is set then all are allowed). Integer
TaggerCreatureNPCAllowed If set to 1 then NPC are allowed (if none of PC, NPC, Summoned is set then all are allowed). Does not include creatures which have master. Integer
TaggerCreatureSummonedAllowed If set to 1 then summoned creatures are allowed (if none of PC, NPC, Summoned is set then all are allowed). Summoned creatures include all creatures which have master (summons, familiars, animal companions, dominated creatures, henchmans etc). Integer
TaggerBaseItemAllowed Comma separated list of base item type numbers allowed. String
TaggerCereaBaseItemAllowed Comma separated list of cerea base item numbers allowed. String
TaggerUserIsCombatAllowed It set to 1 then using this is allowed in combat. (if none of Combat, NonCombat is set then both are allowed). Integer
TaggerUserIsNonCombatAllowed It set to 1 then using this is allowed when not in combat. (if none of Combat, NonCombat is set then both are allowed). Integer
TaggerLockedAllowed If set to 1 then using this is allowed on locked object (if none of Locked, Unlocked is set then both are allowed). Integer
TaggerUnLockedAllowed If set to 1 then using this is allowed on unlocked object (if none of Locked, Unlocked is set then both are allowed). Integer
TaggerTrappedAllowed If set to 1 then using this is allowed on trapped object (if none of Trapped, NotTrapped is set then both are allowed). Integer
TaggerNotTrappedAllowed If set to 1 then using this is allowed on not trapped object (if none of Trapped, NotTrapped is set then both are allowed). Integer
TaggerAreaAllowed Comma separated list of area tags where usage is allowed. This can include * at the end of tag to indicate wildcard. String
TaggerAreaNameAllowed Comma separated list of area names where usage is allowed. This can include * at the end of name to indicate wildcard. String
TaggerTagAllowed Comma separated list of object tags where usage is allowed. This can include * at the end of tag to indicate wildcard. String
TaggerNameAllowed Comma separated list of object names where usage is allowed. This can include * at the end of name to indicate wildcard. String
TaggerDistanceAllowed Maximum distance between user and target in meters. Int

Actions

Variable Description Type
TaggerPer If set then this is used to override which is the unique tag when storing usages. Default is “tag”. Other values are: “object type”, “race”, “subrace”, “alignment”, “highestclass”, “combinedclass”, “firstclass”, “level”, “pcid”, “base item”, “cerea base item”, “areatag” String
TaggerUnique If set to 1 then only calculate unique things, i.e. if it is already in the list, do nothing, otherwise count how many of similar things have been found. Integer
TaggerFeedBackText Text to send as floating string when successfully used. @XXX@ things are replaced. String
TaggerFeedBackText<cnt> Text to send as floating string when successfully used and the @CNT@ reaches <cnt>. @XXX@ things are replaced. String
TaggerFeedBackTextDiff<cnt> Text to send as floating string when successfully used and the @DIFFCNT@ reaches <cnt>. @XXX@ things are replaced. String
TaggerFeedBackTextTotal<cnt> Text to send as floating string when successfully used and the @TOTALCNT@ reaches <cnt>. @XXX@ things are replaced. String
TaggerSetDescription If set to 1 then set description of item. Integer
TaggerSetDescriptionText If set to non empty then this text is used for each different item in list, and @XXX@ things are replaced in it. String
TaggerSetDescriptionHeader Header text for description. @XXX@ things are replaced. String
TaggerSetDescriptionFooter Footer text for description. @XXX@ things are replaced. String
TaggerSetName Set the name of item to this text. @XXX@ things are replaced. String
TaggerMarkObject Set this variable on the target to value 1 and do not accept second uses for the exactly same object. @PC@ is replaced with the PCID of the PC using the item (not target). String

@KEY@ is replaced with the tagger key, @NAME@ is replaced with target name, @TYPE@ is replaced with printable type, and @CNT@ is replaced with count of those things, @DIFFCNT@ is replaced with number of different things found, and @TOTALCNT@ is replaced with total count of things tagged. In the description per item text the @INDEX@ is replaced with the index of current item. Note that items come sorted by the key.

Variables set on the Item

There is array on the “Tagger” category having the given thing as key (see TaggerPer above), and having 2 variables Name and Count.

Variable Description Type
Tagger:<key>:Name Name of the thing tagged. String
Tagger:<key>:Type Printable key of the thing tagged. String
Tagger:<key>:Count Count of the things tagged. Integer
TaggerDifferent Count of different things found. Integer
TaggerTotal Count of things found in total. Integer

Quest advancement

When the suitable limits are set and PC has given quest in progress and between the given quest range, then it is advanced by 1 for every time tagger is successfully used.

Variable Description Type
QuestTaggerDifferentLimitMin If TaggerDifferent was updated, and is greater than or equal to this then increment quest state (check also max). Integer
QuestTaggerDifferentLimitMax If TaggerDifferent was updated, and is less than to this then increment quest state (check also min). Integer
QuestTaggerCountLimitMin If current count of this type is greater than or equal to this then increment quest state (check also max). Integer
QuestTaggerCountLimitMax If current count of this type is less than to this then increment quest state (check also min). Integer
QuestTaggerTotalLimitMin If TaggerTotal is greater than or equal to this then increment quest state (check also max). Integer
QuestTaggerTotalLimitMax If TaggerTotal is or equal to this then increment quest state (check also min). Integer
QuestAdvance Name of the quest to advance String
QuestCheckMin Min value of quest level to trigger increment Integer
QuestCheckMax Max value of quest level to trigger increment, i.e. this is the max value where the quest can be incremented Integer

Note, that DifferentLimit, CountLimit, and TotalLimits are checked separately but quest can only be incremented once. The idea is that you can make quests where you need to get for example 20 different animals (only incremented at different count of 20), or you can put it so it is incremented for every count between 1-20 and get different text in journal. Or you can set the CountLimit min and max to 20 and then you need to get 20 same types of animals to get journal increment, etc.

Example

Variable Value Description
Prop “=EUANIM;walk/6.0/target;unequip/4,UUSCRIPTHOOK;ItemHook” On Equip run animation that will walk to your current target for 6 seconds, and then unequip the item. On the unequip run the script hook called ItemHook. So if you are close enough to do reach to the given distance in 6 seconds then you can tag the creature without loosing stealth status..
ItemHook “ci_g_q_tagger” Make the script called above to call the given hook.
TaggerObjectTypeAllowed “1” Only creatures.
TaggerCreatureRaceAllowed “8” Only animals.
TaggerCreatureEnemyAllowed 1 Only Enemies.
TaggerCreatureNPCAllowed 1 Only monsters or NPCs, no PCs, nor summoned creatures.
TaggerUserIsNonCombatAllowed 1 Only allowed when user is not in combat.
TaggerDistanceAllowed 5 Max distance is 5 meters.
TaggerPer “tag” Make per tag counting.
TaggerFeedBackText “Tagged new animal @NAME@, you have now @CNT@ animals, with @DIFFCNT@ different.” Text to print when PC finds new creature.
TaggerSetDescription 1 Add list of animals to description.
TaggerSetDescriptionText “@INDEX@. <color=blue>@NAME@</color>, count = <color=green>@CNT@</color>\n”
TaggerSetDescriptionHeader “List of animals:\n” Header for description.
TaggerSetName “Animal list @TOTALCNT@/@DIFFCNT@” Name to set on the item.
TaggerMarkObject “TaggerAnimalCounter@PC@” Store variable on the animal so it can be counted only onces per pc (@PC@ is replaced with PCID of the PC.
QuestTaggerDifferentLimitMin 1 Start incrementing quest immediately when you tag first different creature.
QuestAdvance “QUEST_TK_COUNT_ANIMALS” Quest to advance.
QuestCheckMin 1 Advance immediately from start.
QuestCheckMax 20 Up to the 20 different creatures.

Now the QUEST_TK_COUNT_ANIMALS can be something that has quest step 1 telling that find first creature and tag it. Step 2 .. 10 will tell that find a lot more creatures, 11 .. 15 will tell that you might have almost enough, and 16 .. 20 tells you most likely have enough, and 21 will tell that you have enough creatures. Then quest giver might accept if the quest step is greater than 10+d10.