Jump to content

Papyrus - Weapon script not working


Recommended Posts

I've come back to this problem since it's one of the last things that needs doing before an update and am still not able to figure out where I might be going wrong. If I do the Quest Alias route, is it still 'extends Weapon'? Does it matter if it's Const? How will the game know to only apply the function when the correct weapon is out?

I don't have the time to invest into learning papyrus and I don't think looking for a dedicated scripter is necessary either since I only want to do a few things.

Link to comment
Share on other sites

Thanks, but still, no luck. Nothing seems to be happening inside power armour or not. The current script:

Scriptname MagnumRevolverRifle_APPenalty extends ReferenceAlias

string WeaponFireAnimation = "weaponFire" Const
int ValueCost = 5 Const ; Maybe a GlobalVariable for customizability?
ActorValue Property ValueType Auto Const Mandatory ; you must "fill" this in the CK

Event OnInit()
	Actor kActor = Game.GetPlayer()
	RegisterForRemoteEvent(kActor, "OnEquipped")
	RegisterForRemoteEvent(kActor, "OnUnequipped")
EndEvent

Event ObjectReference.OnEquipped(ObjectReference akSender, Actor akActor)
	self.RegisterForAnimationEvent(akSender, WeaponFireAnimation)
EndEvent

Event ObjectReference.OnUnequipped(ObjectReference akSender, Actor akActor)
	self.UnregisterForAnimationEvent(akSender, WeaponFireAnimation)
EndEvent

Event OnAnimationEvent(ObjectReference akSource, string asEventName)
	Actor kSubject = akSource as Actor
	If (kSubject)
		If !(kSubject.IsInPowerArmor()) ; not in power armor
			kSubject.DamageValue(ValueType, ValueCost)
		EndIf
	EndIf
EndEvent

Quest Data tab / Quest Alias tab

 

I think I need a step by step, as I'm not sure I've done everything right myself.

Edited by TheRizzler1
Link to comment
Share on other sites

I continued to work on this script for a while and it turned out to be difficult. When the player enters power armor the players base RACE changes to the power armor race. This change makes animation events registered on the Player "HumanRace" invalid. You have to register for animations when the race changes. I found "Event Actor.OnRaceSwitchComplete(Actor akSender)" but I cannot get it to work as expected.

Link to comment
Share on other sites

Thankyou for your efforts. That does sound more complicated than previously envisioned :/

I might push out the next update and hopefully figure this scripting stuff out in the meantime, as it's the last thing that needs doing

Edited by TheRizzler1
Link to comment
Share on other sites

  • Recently Browsing   0 members

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