Difference between revisions of "Useful Scripts"

Jump to navigation Jump to search
76 bytes removed ,  07:28, 15 February 2009
Reference scripts can use implied reference syntax
imported>Illyism
(created page :"Example scripts".)
 
imported>Cipscis
(Reference scripts can use implied reference syntax)
Line 6: Line 6:


Begin OnEquip
Begin OnEquip
player.RewardKarma -650
    player.RewardKarma -650
END
End


Begin OnUnequip
Begin OnUnequip
player.RewardKarma 650
    player.RewardKarma 650
END
End
</pre>
</pre>


Line 38: Line 38:
Begin OnActivate
Begin OnActivate
     Activate
     Activate
     if IsActionRef Player == 0  ;if it only works for NPCs remove this .....
     if IsActionRef Player == 0  ;if it shouldn't work for the player remove this...
         set doorTimer to 5
         set doorTimer to 5
         set closeDoor to 1
         set closeDoor to 1
     endif                                   ;...and this
     endif                       ;...and this
End
End
</pre>
</pre>
Line 48: Line 48:
Script Type: Effect
Script Type: Effect


<small>spell effect script for a weapon that knocks people far away and creates a trail of smoke or fire along the way. </small>
<small>spell effect script for a weapon that knocks people far away and creates a trail of smoke or fire along the way.<br />NOTE - Only works correctly when the player has the weapon equipped.</small>


<pre>
<pre>
scn CALFPeffectSCR
scn CALFPeffectSCR
ref Target


short ActorValue1
short ActorValue1
Line 61: Line 59:


Begin ScriptEffectStart
Begin ScriptEffectStart
   
    set Target to GetSelf
      
      
     ; places initial explosion when hit, just in case there's no specified explosion effect in the weapons projectile
     ; 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
     ; also useful if you'd want a melee weapon or fist to cause explosions on hit
     Target.placeatme {ExplosionType}
     placeatme {ExplosionType}
      
      
     Player.PushActorAway Target 104
     Player.PushActorAway Target 104
Line 80: Line 76:
      
      
     set Damage to -1 * ( {formula incorporating actor values} )
     set Damage to -1 * ( {formula incorporating actor values} )
     Target.ModAv Health DamageValue
     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
     ; make the effect play a certain sound-you could also use the sound of the explosion and not specify a specific sound
Line 90: Line 86:
     ; this is the part where you place a smoke effect on every axis the NPC/Creature is located
     ; 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
     ; it makes as if the smoke is always coming out of the target while the effect is taking place
     Target.placeatme {smokeeffect}
     placeatme {smokeeffect}
      
      
     ; alternatively add a smoke actor effect on the character
     ; alternatively add a smoke actor effect on the character
     Target.CastImmediateOnSelf {smoke actor effect}
     CastImmediateOnSelf {smoke actor effect}
End
End




begin ScriptEffectFinish
begin ScriptEffectFinish
     ;if you used the above alternative, this segment removes the smok eeffect from the character
     ;if you used the above alternative, this segment removes the smoke effect from the character
     Player.RemoveSpell {smoke actor effect}
     RemoveSpell {smoke actor effect}
end
end


Line 112: Line 108:
scn LightSwitchScript
scn LightSwitchScript


ref myself
ref light
ref light
short toggle
short toggle


begin onactivate
begin onactivate
    if myself == 0
        set myself to this
    endif
     if light == 0
     if light == 0
         set light to myself.getlinkedref
         set light to getlinkedref
     endif
     endif
      
      
Anonymous user

Navigation menu