Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Companion Attack Key


InsanitySorrow
 Share

Recommended Posts

Companion Attack Key

This was Joben's idea :noway:, The idea behind this is to take the effects of an attack spell, a spell that when cast at a target will make the companion attack them, and change it so it works when the player presses a key instead.

Notes:

Quest Script

Requires OBSE v18+

Script:


;===========================
;Name: Attack Script
;Version: 1.0
;Author: InsanitySorrow
;===========================

;===========================
;Scriptname
;===========================

Scriptname aaISAttackScript

;===========================
;Variables
;===========================

Ref Target
Ref Companion
Float fQuestDelayTime

Short KeyUsed
Short AttackKey
Short Initialize

;===========================
;Script
;===========================

Begin GameMode
If (GetGameLoaded)
If (Initialize)
let fQuestDelayTime := 0.001
let Initialize := 1
Endif
Endif

let Target := GetCrosshairRef
let Companion := SimpliciaTheSlowRef
let AttackKey := 25 ;P Key

If (Target > 0)
If (IsKeyPressed3 AttackKey) && (KeyUsed == 0)
let KeyUsed := 1
If (Target.IsActor == 1 || Target.GetIsCreature == 1)
;Message"Starting Combat..."
Companion.StartCombat Target
Else
Return
Endif
Elseif (IsKeyPressed3 AttackKey == 0) && (KeyUsed)
let KeyUsed := 0
Endif
Else
Return
Endif
End
[/code]

This script is only basic, it works but it only checks to see if the target is eiter an NPC(actor) or a Creature. It works by picking up the target currently in the crosshair and when the key is pressed (in this case P) it tells the companion to start combat on the target

[color=#FFA500]Changes:[/color]

Change this line:

[b]let Companion := SimpliciaTheSlowRef[/b]

The reference used here is that of a beggar in the IC Market District, it was used for testing and was quite funny to see :P, Just change the [b]SimpliciaTheSlowRef[/b] to whatever your companions Reference is.

You can also make additional changes to add other checks into the script, like checking to see if the NPC is part of any evil factions for example.

Also you may change this line:

[b]let AttackKey := 25

[/b]

To change the key that needs to be pressed for the action to take place. Key codes can be found on the CS Wiki.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...