$OnAttachScript:

From GECK
Jump to: navigation, search

Weapon Smith

Description

Will call a UDF on the actor who equipped the attachment, with the attachments baseform and weapon instance being passed as arguments.

Syntax

$OnAttachScript: UDF:ref

Example

;Inside "WeaponAttachments\WeapNV9mmPistol\Barrel Device\BarrelDevice_Config.ini"

   $EditorID: MySilencerAttachment
   $Name: Silencer Mod
   $OnAttachScript: MyUDF

Will call MyUDF anytime MySilencerAttachment is attached.

scn MyUDF

ref rWeapBase
ref rWeapInstance   ;The specific weapon instance.
ref rActor
ref rAttachment     ;Silencer Mod

Begin Function {rAttachment rWeapInstance}

	let rActor := thisAlt
        let rWeapBase := AuxiliaryVariableGetRef "*_BaseForm" 0 rWeapInstance  ;Sets rWeapBase to WeapNV9mmPistol.

        ;Code:

end

Notes

  • OnAttach will run every time the player loads up a save with the modded weapon equipped. So it's useful in conjunction with SetEventHandlerAlt.

See Also