Difference between revisions of "Useful Scripts"

From the Fallout3 GECK Wiki
Jump to navigation Jump to search
imported>Cipscis
(Reference scripts can use implied reference syntax)
imported>Qazaaq
(→‎Autoclosing door: shouldn't -> should (or change the script, this is how it works))
Line 38: Line 38:
Begin OnActivate
Begin OnActivate
     Activate
     Activate
     if IsActionRef Player == 0  ;if it shouldn't work for the player remove this...
     if IsActionRef Player == 0  ;if it should work for the player remove this...
         set doorTimer to 5
         set doorTimer to 5
         set closeDoor to 1
         set closeDoor to 1

Revision as of 08:06, 15 February 2009

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 should work for the player 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.
NOTE - Only works correctly when the player has the weapon equipped.

scn CALFPeffectSCR

short ActorValue1
short ActorValue2
short ActorValue3
short DamageValue

Begin ScriptEffectStart
    
    ; 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
    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} )
    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
    placeatme {smokeeffect}
    
    ; alternatively add a smoke actor effect on the character
    CastImmediateOnSelf {smoke actor effect}
End


begin ScriptEffectFinish
    ;if you used the above alternative, this segment removes the smoke effect from the character
    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 light
short toggle

begin onactivate
    if light == 0
        set light to getlinkedref
    endif
    
    if toggle == 0
        light.disable
        activate
        set toggle to 1
    else
        light.enable
        set toggle to 0
        activate
    endif
end