Jump to content

Recommended Posts

Posted

I've got a script for a piece of armor that acts a lot like the Prototype Medic Armor, except it doesn't talk and applies stimpaks instead. My problem is that I want to make a version that will work on an NPC (in my case, a follower), but I can't figure out how to make the script work for an actor, instead of acting on me.

 

If Player.GetHealthPercentage < 0.5 && Player.GetItemCount Stimpak > 0
   Do stuff
EndIf

Posted
  On 9/10/2010 at 8:46 PM, sinchiruna said:

where are you running it from, and is that all the code or just a snippet?

 

What I want is the script to be in a piece of armor that I can give to one of my followers instead of making them essential. I just need to know how to make it act on whichever actor is wearing the armor.

 

ScriptName RIPTacVestScrip2

Short Init
Short Running
Float Timer

Begin OnEquip
Set Timer to 0.0
Set Init to 0
Set Running to 1
End

Begin OnUnequip
Set Running to 0
End

Begin GameMode			
If Running == 1
	If Init == 0 	
		Set Timer to 1
		Set Init to 1
	Else	
		If Timer > 0
			Set Timer to Timer - getSecondsPassed
		Else
			If Player.GetHealthPercentage < 0.5
				Player.CastImmediateOnSelf RIPStimpakEffect
			ElseIf Player.GetHealthPercentage < 1 && Player.IsInCombat == 0
				Player.CastImmediateOnSelf RIPStimpakLightEffect
			EndIf
			Set Timer to 0.0
			Set Init to 0
		Endif
	Endif
Endif
End

Posted

the script itself looks good.. but after checking functions and such. i wonder?

 

according to CastImmediateOnSelf :

 

http://geck.bethsoft.com/index.php/CastImmediateOnSelf

 

it should be a 'spell' and not an 'effect'.. i looked and could not find a stimpakeffect or stimpackeffect in the geck.. so i'm not sure what you are doing with an effect.

 

i am doing my research off of the stealth suit from anchorage. i used this to make my stealth camo armors.

 

scn DLC02ArmorStealthWastelandScript

short ShaderState
short ShaderChange
short armorEquipped

BEGIN ONLOAD
set ShaderState to 0
set ShaderChange to 1
END

BEGIN ONEQUIP
set armorEquipped to 1
set shaderState to 0
END

BEGIN ONUNEQUIP
PMS DLC02StealthShader
player.removespell stealthBoyInvisibilitySpell
set armorEquipped to 0
END

BEGIN GAMEMODE

IF ShaderState == 1
	PMS DLC02StealthShader
	player.addspell stealthBoyInvisibilitySpell
	set ShaderState to -1

ELSEIF ShaderState == 2
	PMS DLC02StealthShader
	player.removespell stealthBoyInvisibilitySpell
	set ShaderState to 0

ENDIF

;// if the armor is equipped and we are visible, stealth up
IF armorEquipped == 1 && player.IsSneaking == 1 && shaderState == 0
	set ShaderState to 1

ELSEIF armorEquipped == 1 && player.IsSneaking != 1 && shaderState == -1
	set ShaderState to 2

ENDIF

END

 

edit: can't spell or proof read obviously..lol

Posted
Meh, RIPStimpakEffect is just the name of the healing thing I used. It could be anything, the problem is getting it to work on an NPC other than myself.
Posted

You should be able to get the ref to the actor wearing the armor by using GetContainer.

 

NPCs are considered "containers" by the script engine.

 

It is probably a good idea to check that it is set to something before use though.

 

ref actor

set actor to GetContainer

if actor

actor.DoSomething

endif

  • Recently Browsing   0 members

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