Difference between revisions of "Programmable Spell Effects"
Jump to navigation
Jump to search
m
Programmable Spell Effects (edit)
Revision as of 17:47, 11 September 2006
, 17:47, 11 September 2006no edit summary
imported>Ra5946 |
imported>Elder m |
||
|
PROGRAMMABLE SPELL EFFECTS
Er? Can't I program my own spells using script effects already?
1)
2) To turn the player invisible without raising his/her arm to cast.
6) Know who cast that spell at me or some other actor.
Well now you can! The following procedures are built on the fact that Ability spell effects are cast on the target the moment they are added and do not cause any visible effects on the target nor caster. Of course you can add whatever effects you do want to see with PlayMagicShaderEffects or PlayMagicVisualEffects, etc.
Here is a BASIC example of how to create 'silent' spell effect that does an instant 10 damage to the target.▼
▲Here is a BASIC example of how to create 'silent' spell effect that does an instant 10 damage to the target
Step 1 is to create an Ability spell, lets say 'SilentDm10' with:▼
Health Damage 10▼
Script Effect: StopSilentDm10▼
Step 2 is to create/attach the following magic effect script 'StopSilentDm10':▼
▲Std Effect: Health Damage 10
▲Script Effect: StopSilentDm10
scn StopSilectDm10
End
▲Step 3 is to actually use the spell in some other script:
; target here is a reference to some actor (or player)
target.AddSpell SilentDm10
Notice that using this spell is actually a neater syntax than that for Cast.
NOTE: Adding an ability to the player will produce message spam and so in this case this effect is not so silent. I would recommend changing the actual name of the spell to be something appropriate, e.g. "Poison damage". You wont see more than one "Posion damage added" message so long as all of your equivalent ability-cast effects have the same name.
True programmable spells are more useful. They are in effect (in-game) function wrappers for several silent and standard (area-effect targetting) spells.
Here is one example to show the BASIC principle. This one allows you to do X-fixed plus Y-random damage to a target:
scn WildDamageSpell
End
To cast this spell, since it is an in-game function:
; target here is a reference to some actor - player is assumed to be the caster
Advanced programable spell effects
Basically the sky's-the-limit here, or rather a matter of your imagination and scripting experience. Here are just a few things to expand the range of programmable spell functions:
1) Timed spells: Since in-game functions have the ability to trigger their own GameMode, a small modification of your spell function can be made to trigger every second (or every frame) for any variable time.
6) NPC cast spells: To force actor X to immediately cast on target Y is simple. Having it cast as it would be by RAI may take a bit of work. You could add a (hostile) spell to the actor directly that then adds your effect the target (as in 2 above). However, this will add to the base actor object. You can also simulate the AI yourself (AAI) with a permanent spell effect. This has a similar issue and solution, as described below.
Permanent
Ironically enough, the thing that Ability spells are not a good idea for is adding permanent effects to targets - including the player! The problem is that abilities get cancelled/re-cast when the target enters or leaves the player cell, and any scripted variables are reset. This also applies to abilities on the player when he/she changes cell, although here it is not so bad if you employ all global variable in the ScriptEffectUpdate block. An even less desirable issue is that the ability is added to the base actor object so any spawned generic characters will inherit the same ability. (This is partly why the recipe for silent spells always removes the ability after 1 frame.)
| |||