Jump to content

Rate My Scripts


SmileyCat

Recommended Posts

Mods; I was unsure where to post this, and mod talk seemed to be the best option, so if it's the wrong section, please move it.

I consider myself a pretty decent scripter, and I want to improve my scripting skills but I am unsure how,

so I came up with a little idea.. You take a look at my script and tell me what you (dis)approve.

 

This is a very simple FOSE script that colors all actors near the player.

Feel free to use this script in your mod, just attach it onto a pair of glasses or a helmet.

ScriptName CJ39ACIScript

; ACI = Advanced Combat Interface

ref rCurrentTarget
int iMaxDistance
float fTimer
int iTimer
int iSetupRan

Begin GameMode

;===================================;
;	Setup the variables.
;===================================;
If iSetupRan != 1
	Set iTimer To 5
	Set iMaxDistance To 1250
	Set iSetupRan To 1
EndIf

;=============================================;
;	First, we check if the ACI is equipped.
;=============================================;
If Player.GetEquipped CJ39ACI != 1
	Return
EndIf

;=============================================;
;	The ACI has a small timer that
;	only lets the script color references
;	on a preset interval.
;=============================================;
If fTimer > 0
	Set fTimer To (fTimer - GetSecondsPassed)
	Return
EndIf

;=============================================;
;	Then we start coloring actors,
;	colors are determined by their current
;	action and attitude towards the player.
;=============================================;
Set rCurrentTarget To GetFirstRef 200 1 0
Label 1
If rCurrentTarget
	If rCurrentTarget.GetDistance Player < iMaxDistance
		; Sleeping
		If rCurrentTarget.GetCurrentAIProcedure == 8
			rCurrentTarget.PlayMagicShaderVisuals CJ39ShaderSleeping iTimer
		; Fleeing
		ElseIf rCurrentTarget.GetCurrentAIProcedure == 16
			rCurrentTarget.PlayMagicShaderVisuals CJ39ShaderFleeing iTimer
		 ; Enemy
		 ElseIf rCurrentTarget.GetFactionRelation Player == 1
			rCurrentTarget.PlayMagicShaderVisuals CJ39ShaderEnemy iTimer
		EndIf
	EndIf
	Set rCurrentTarget To Pencil01
	Set rCurrentTarget To GetNextRef
	Goto 1
EndIf
Set rCurrentTarget To Pencil01

;===============================;
; Then we just reset the timer.
;===============================;
Set fTimer To iTimer

End

 

And here is another one, a stealth hat that runs off Microfusion Cells.

Feel free to use this one aswell.

ScriptName CJ39StealthHatScript

; This is my demo script of a hat that uses microfusion cells as charges for a stealth effect.

int iMinutesBetweenCharges
float fTimer

Begin GameMode

;======================================;
;	This is the "setup block", where
;	we initialize variables and such.
;======================================;
If iMinutesBetweenCharges == 0
	Set iMinutesBetweenCharges To 3 ; 3 Minutes between charges.
	Set fTimer To (iMinutesBetweenCharges * 60)
EndIf

;=====================================================================;
;	The effect is for when the player wears the hat and is sneaking.
;=====================================================================;
If Player.IsSneaking != 1 && Player.GetEquipped CJ39StealthHat != 1
	Return
EndIf

;=============================;
;	The timer block here.
;=============================;
If fTimer > 0
	Set fTimer To (fTimer - GetSecondsPassed)
	Return
EndIf

;===========================================;
;	This is where the actual magic happens.
;	If the player has no cells, we reset
;	the timer to a shorter interval,
;	else we take a cell and give him/her
;	the stealth effects.
;===========================================;
Player.RemoveSpell CJ39StealthHatSpell
If Player.GetItemCount AmmoMicrofusionCell == 0
	Set fTimer To 30 ; Half a second.
	Return
Else
	Player.RemoveItem AmmoMicrofusionCell 1
	Player.AddSpell CJ39StealthHatSpell
	; You need to make an actor effect with the stealth base effects.
EndIf

;=============================;
;	Then we reset the timer.
;=============================;
Set fTimer To (iMinutesBetweenCharges * 60)

End

 

Here is a third script, a fairly basic yet very useful one. A lamp script.

As always, feel free to use.

ScriptName CJ39LampScript

ref rLight
ref rSelf

Begin GameMode

;=====================================================;
;	This is the light, it gets placed onto the lamp
;	and then disabled, until an NPC or the player
;	activates it.
;=====================================================;
If rLight == 0
	Set rSelf To GetSelf
	Set rLight To rSelf.PlaceAtMe * ; Replace this with a actual light reference.
	rLight.Disable
EndIf

End

Begin OnActivate

;====================================;
;	You should know what this does.
;====================================;
If rLight != 0
	If rLight.GetDisabled == 1
		rLight.Enable
	Else
		rLight.Disable
	EndIf
EndIf

End

 

And please, only constructive criticism.

 

Thanks in advance.

Edited by SmileyCat
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...