Is there a way to Holster weapon via script?

Post » Tue Aug 16, 2011 9:31 pm

Im trying to make a Stim that I can Heal NPC's with (non-companions)... and I can Get it to heal, but even at 0 damage the game still considers the stim a weapon and causes assault.

iv tried using a on hit script that is supposed to stop combat on the person, but it doesn't seem to be working. I was wondering if there was a Command (stock or NVSE) that could make a player holster their weapon? (to initiate an Auto Yield)

or if someone could take a look at this script and tell me why it might not be working correctly please :)

Spoiler
SCN Pleasedonthurtmefloat timerfloat fQuestDelayTimeRef patsyBegin OnHit	set patsy to GetOwnerLastTarget	set fQuestDelayTime to 0.001 if  timer < 1         set timer to timer + getSecondsPassed     else                                                                         patsy.StopCombatAlarmOnActor     endif				End     


Crap On a cracker... Wrong Forum.. LOL thought this was the Geck forum

Thanks to the Mods for the quick Move :)
User avatar
remi lasisi
 
Posts: 3307
Joined: Sun Jul 02, 2006 2:26 pm

Post » Wed Aug 17, 2011 1:37 am

A few things wrong with your reasoning, OnHit blocks require a reference to run on, so if you are using this script on a weapon, you need to run a script of effect type, and use ScriptEffectStart, and ScriptEffectUpdate blocks to run the check for a fire.

Think of it like this, your stimpak gun has an object effect on it, that object effect is an actor effect, which has a base effect, the base effect runs the script when it gets fired.

Afaik your style of thinking won't work because, even though you can stop the combat alarm on the player, other npcs would still come to the aid of the "attacked" npc.

So instead I think you can do something else. You would have to make a gun that doesn't fire anything, or whatever your weapon is, as long as it is ranged.

This is simplified and based on a ranged weapon that is used in close range, as afaik GetCrossHairRef needs to be in activation range.
*Note: Both GetCrossHairRef and GetObjectType are NVSE functions, I don't know offhand of any way to do this without NVSE.

ref PatsyInt IsNpcBegin ScriptEffectStartset Patsy to GetCrossHairRef ;this is where you get the object under the crosshair, in acivation range,  that you want to healset IsNpc to Patsy.GetObjectType ;what type of thing is patsyif IsNpc == 42 ;this is the type code for Npcs Patsy.RestoreAv Health 100 ;where you heal the npcendifend


;GetSelf does not work well for PlaceAtMe objects, remember, so test this on npcs already in the game world. You would have to write another script for this to function on PlaceAtMes, and tie it to a token, more complications.

Oh, and, I probably won't check this again, so PM if you need more help.
User avatar
Rachel Hall
 
Posts: 3396
Joined: Thu Jun 22, 2006 3:41 pm

Post » Tue Aug 16, 2011 5:24 pm

A few things wrong with your reasoning, OnHit blocks require a reference to run on, so if you are using this script on a weapon, you need to run a script of effect type, and use ScriptEffectStart, and ScriptEffectUpdate blocks to run the check for a fire.

Think of it like this, your stimpak gun has an object effect on it, that object effect is an actor effect, which has a base effect, the base effect runs the script when it gets fired.

Afaik your style of thinking won't work because, even though you can stop the combat alarm on the player, other npcs would still come to the aid of the "attacked" npc.

So instead I think you can do something else. You would have to make a gun that doesn't fire anything, or whatever your weapon is, as long as it is ranged.

This is simplified and based on a ranged weapon that is used in close range, as afaik GetCrossHairRef needs to be in activation range.
*Note: Both GetCrossHairRef and GetObjectType are NVSE functions, I don't know offhand of any way to do this without NVSE.
Spoiler

ref PatsyInt IsNpcBegin ScriptEffectStartset Patsy to GetCrossHairRef ;this is where you get the object under the crosshair, in acivation range,  that you want to healset IsNpc to Patsy.GetObjectType ;what type of thing is patsyif IsNpc == 42 ;this is the type code for Npcs Patsy.RestoreAv Health 100 ;where you heal the npcendifend


;GetSelf does not work well for PlaceAtMe objects, remember, so test this on npcs already in the game world. You would have to write another script for this to function on PlaceAtMes, and tie it to a token, more complications.

Oh, and, I probably won't check this again, so PM if you need more help.


Alright thanks for the help. i'm an off again On again modder and don't script very often. (i should one day just study the scripting section of the Wiki) I'll try this
User avatar
Cat Haines
 
Posts: 3385
Joined: Fri Oct 27, 2006 9:27 am


Return to Fallout: New Vegas