One of the more recent additions to scripting, and the one with the potential to significantly enhance gameplay altering scripts, is the 'affect' command. Affects can boost or penalize stats or skills for periods of time, or add or remove status affects.
NEW FEATURES
- Affects now have a named type that must be specified. This type can be whatever you want it to be, and is a single word. Affects of the same type only interfere with each other. Use sensible typing and try to coordinate with others. For example, if you make a smoke grenade, call it SMOKE. If you make a fog effect, call it FOG. If its a tranquilizer item, call it TRANQUILIZER. Etc. Types dont have to be in uppercase but it helps delineate the type name from the flags.
- Only 1 modification OR 1 or more flags is allowed. While it MAY work to mix a mod AND flags, don't. Changes to the affect system may break that.
- Special Flags have changed drastically
- unaffect will zap all affects of a specified TYPE.
- affectmsg allows specifying a message to display on expiration of affect.
Some quick notes before continuing:
- Affects must be watched to prevent boosts and penalties from getting out of hand when it comes to 'stacking', especially due to TYPES.
- Affects are lost on death, but kept on quit
The formats are:
affect <target> <duration> <type> <modification> <flags>
affectmsg <target> <type> <message>
unaffect <target> <type>
<target> must be a reference to a character, such as %self% or %actor%. Passing a name won't work, but you can use any of the methods for retrieving a reference from a name, such as %actor.targetcharacter()%.
<duration> is the duration, in seconds, that the affect should be applied. It must be greater than 0 and less than 1 hour (3600), or
PERMANENT.
<message> is displayed to the player when the affect expires or is forcefully removed via unaffect or other means (other than death).
<type> is the type label of affect. Affects of the same type and status can cancel each other out or affect each other. Affects of different types are kept seperate and thus will stack. This string is not case sensitive, but it is recommend to write types in all uppercase for clarity.
<mods> is a list of modifications, which can include:
- EITHER
- Zero or One stat or skill followed by the amount to modify it
- OR Zero or more statuses
- AND Zero or more special flags
The Stat/Skill mod must always be followed by a number.
If you must apply multiple skill/stat mods or statuses, use multiple affect commands. Multiple Statuses CAN be grouped together, and are USUALLY intelligently managed.
| Stat/Skill Mods |
| Any stat (Strength, health, coordination, agility, perception, knowledge) |
| The FIRST word of any skill (Rifles, Special, Melee, Unarmed, Engineering, etc) |
| maxhit |
maximum hit points |
| maxmove |
maximum move points |
| extra_armor |
bonus absorb |
| Statuses |
| blind |
Can't see; Large to-hit and dodge penalties |
| invis |
Level 1 invisibility - Requires permission to use in a script |
| invis-2 |
Level 2 invisibility - Requires permission to use in a script |
| sense-life |
Bonus to detect hidden |
| det-invis |
Bonus to detect invisible |
| sanct |
"Sanctuary" - visual affect only. Don't use, may change |
| group |
DO NOT SET - INTERNAL ONLY |
| flying |
Gains benefits of flight |
| infra |
Gains infrared vision; can see in the dark without light |
| poison |
NOT FINISHED. Currently just halves mv regen rate |
| sleep |
Puts target to sleep; they can't be woken up |
| no-track |
Target can't be tracked via 'track' command |
| sneak |
Normally set by the 'sneak' command |
| hide |
Normally set by the 'hide' command. Automatically removed if the character does anything. |
| charm |
Character obeys whomever they are following as master, obeys commands given by 'order', can't attack master, can't unfollow. DO NOT SET ON PLAYERS. |
| tracking |
Motion-tracking is active |
| vacuum-safe |
Not killed by VACUUM rooms |
| light |
Normally set when wearing a LIGHT affected object; adds light to the room |
| trapped |
Forced to stay 'sitting' |
| stunned |
Kept in the 'stunned' state, unable to do most things |
| acidproof |
Immune to acid splash |
| bleeding |
Lose 2% of max hp every second, instead of healing |
| no-recall |
Can't recall |
| no-switch |
Cannot be target-switched off of during combat |
| DID-SHOOT-TIMER |
Player sniped with a gun |
| NO-SHOOT-TIMER |
Delay time for snipe |
| NO-QUIT-TIMER |
Combat timer |
| EXTRA_ARMOR |
Bonus Armor |
| Special Flags |
| stackable |
Don't merge any similiar affects of the same type, stack them |
| addtime |
Add the time of the similiar affects together |
| avgtime |
Average the times of the similiar affects |
| shortest |
The time of the affect is the shorter of the new time and the existing affects time |
| longest |
The time of the affect is the longer of the new time and the existing affects time |
| oldtime |
If a simliar affect exists, use it's time remaining instead |
| addmod |
Add the modifier of the similiar affects together |
| avgmod |
Average the modifiers of the similiar affects |
| smallest |
Use the smallest modifier of the existing affects |
| largest |
Use the largest modifier of the existing affects |
| oldmod |
If a similiar affect exists, use it's modifier instead |
NOTE 'Similiar affects' are those with the same TYPE, and same STAT/SKILL mod (but possibly different amount) or overlapping STATUSES. The time of the affect is not considered when determining 'similiar'. Whenever a flag other than STACKABLE is used, all other similiar affects, even stackable ones, of the same type, are destroyed. Special flags CAN be combined.
If no special flag is used, and a pre-existing non-stackable affect of the SAME stat/skill mod is already on the target character, the durations and modifiers will be averaged. In addition, the old affects statuses will be replaced.
Example uses:
- affect %actor% 60 SUPERSTRENGTH strength 30
- affectmsg %actor% SUPERSTRENGTH You no longer feel strong.
Gives %actor% 30 strength for 1 minute. Type:
Superstrength
Displays the message "You no longer feel strong." when SUPERSTRENGTH fades.
- affect %actor% 60 GOUGE agility -50
- affect %actor% 60 GOUGE bleeding
Reduces %actor%'s agility by 50, and causes bleeding, for 1 minute. Type:
Gouge
- affect %actor% 300 STIMPACK maxhit 200 addtime avgmod
Gives %actor% 200 extra max hp for 5 minutes. If %actor% already has a STIMPACK maxhit mod, it will add the times together and average the total bonuses. For example, if there are 3 minutes remaining on a 100 maxhit STIMPACK affect, the old one will be removed and the new one will be 8 minutes (addtime) of 150 maxhit. Type:
Stimpack
- unaffect %actor% STIMPACK
- affect %actor% 10 HARPOONED stunned
- affect %actor% 20 HARPOONED trapped
- affect %actor% 30 HARPOONED bleeding
Any
Stimpack affects applied to %actor% will be removed, and %actor% will be stunned for 10 seconds, trapped for 10 more seconds, meanwhile bleeding the entire time, and for 30 seconds afterwards. Type:
Harpooned
--
FearItself - 17 May 2004