Useful Scripts
Revision as of 05:35, 14 February 2009 by imported>Illyism (created page :"Example scripts".)
Karma Effects on Items
Script Type: Object
scn KarmaEffect Begin OnEquip player.RewardKarma -650 END Begin OnUnequip player.RewardKarma 650 END
Autoclosing door
Script Type: Object
Scriptname AutoClosingDoor float doorTimer short closeDoor Begin GameMode if closeDoor == 1 if doorTimer > 0 set doorTimer to doorTimer - getSecondsPassed else ;close the door Activate ; Lock set closeDoor to 0 endif endif End Begin OnActivate Activate if IsActionRef Player == 0 ;if it only works for NPCs remove this ..... set doorTimer to 5 set closeDoor to 1 endif ;...and this End
Pusheffect
Script Type: Effect
spell effect script for a weapon that knocks people far away and creates a trail of smoke or fire along the way.
scn CALFPeffectSCR ref Target short ActorValue1 short ActorValue2 short ActorValue3 short DamageValue Begin ScriptEffectStart set Target to GetSelf ; places initial explosion when hit, just in case there's no specified explosion effect in the weapons projectile ; also useful if you'd want a melee weapon or fist to cause explosions on hit Target.placeatme {ExplosionType} Player.PushActorAway Target 104 ; this is the part of the script in which you can specify a certain damage formula ; the formula can be added to the base damage amount set in the weapons tab ; -or you can set the damage in the tab to zero and fully rely on the formula to calculate damage ; it can be the target NPC/creature's actor value or the player's ; it's also fine not to make a certain damage formula set ActorValue1 to Player.GetAv {ActorValue1} set ActorValue2 to Player.GetAv {ActorValue2} set ActorValue3 to Player.GetAv {ActorValue3} set Damage to -1 * ( {formula incorporating actor values} ) Target.ModAv Health DamageValue ; make the effect play a certain sound-you could also use the sound of the explosion and not specify a specific sound Playsound3D Play a certain sound End Begin ScriptEffectUpdate ; this is the part where you place a smoke effect on every axis the NPC/Creature is located ; it makes as if the smoke is always coming out of the target while the effect is taking place Target.placeatme {smokeeffect} ; alternatively add a smoke actor effect on the character Target.CastImmediateOnSelf {smoke actor effect} End begin ScriptEffectFinish ;if you used the above alternative, this segment removes the smok eeffect from the character Player.RemoveSpell {smoke actor effect} end
Light switch
Script Type:Object
To be placed on an activator, and linked to a light source or a x-marker parent.
scn LightSwitchScript ref myself ref light short toggle begin onactivate if myself == 0 set myself to this endif if light == 0 set light to myself.getlinkedref endif if toggle == 0 light.disable activate set toggle to 1 else light.enable set toggle to 0 activate endif end