Jump to content

"No viable alternative at input"


Recommended Posts

I've made a script with a very basic code from https://www.creationkit.com/fallout4/index.php?title=OnPlayerFireWeapon_-_Actor

 

The code so far is

Scriptname ViableInstituteWeaponsScript extends Quest
; Event is sent to the player
Event OnPlayerFireWeapon(Form akBaseObject) native
  Debug.Trace(akBaseObject+ " weapon fired by player.")
endEvent

Of course, I get errors copying directly from the tutorial. I added the word "native" to get around the "Not flagged as native" error, but now I get the following

Starting 1 compile threads for 1 files...
Compiling "ViableInstituteWeaponsScript"...
C:\Users\Robert\AppData\Local\Temp\PapyrusTemp\ViableInstituteWeaponsScript.psc(4,7): no viable alternative at input '.'
No output generated for ViableInstituteWeaponsScript, compilation failed.

There's no if variable in there, so why the hell is it asking for alternate at input?

Please help.

 

Link to comment
Share on other sites

Well ok you're trying to use an Actor event on a Quest script? Not gonna work.

 

Remove the native declaration and either register for remoteevent on the player to get it or use an alias.

 

You can make it extend ReferenceAlias then attach the script to an alias that is filled with the player and it should work.

Edited by BigAndFlabby
Link to comment
Share on other sites

Well ok you're trying to use an Actor event on a Quest script? Not gonna work.

 

Remove the native declaration and either register for remoteevent on the player to get it or use an alias.

 

You can make it extend ReferenceAlias then attach the script to an alias that is filled with the player and it should work.

 

I understood about 10% of that. Remove native, got it. However "register for remove even ton player" is new to me. Is this what you're talking about? https://www.creationkit.com/fallout4/index.php?title=Remote_Papyrus_Event_Registration

Link to comment
Share on other sites

 

Well ok you're trying to use an Actor event on a Quest script? Not gonna work.

 

Remove the native declaration and either register for remoteevent on the player to get it or use an alias.

 

You can make it extend ReferenceAlias then attach the script to an alias that is filled with the player and it should work.

 

I understood about 10% of that. Remove native, got it. However "register for remove even ton player" is new to me. Is this what you're talking about? https://www.creationkit.com/fallout4/index.php?title=Remote_Papyrus_Event_Registration

 

 

Yes that's it. The event you're trying to use only fires on the player. That means the script has to be attached to the player. The example script you gave in your OP is of type Quest which will never get the event. So the only solutions are either register for a remote event on the player so that it gives it to that script, or put the script on the player using an alias. The alias is arguably the better way to do it. Though that depends what you intend for the script to do and how it will do it.

Link to comment
Share on other sites

My objective for the moment is to get that debug message of "player has fired weapon" and make it a shot counter. From there, I'm going to be making a mod called "viable institute weapons" which give institute weapons a chance not to use ammo. First prototype is going to be a flat 50% chance to not use ammo (add one to magazine). Thus institute weapons are still weaker than laser weapons, but use half as much ammo and thus have a role. Later I'll adjust properties on the receivers so that different receivers have different ammo conservation amounts.

 

So the objective is to make

"Did player just fire gun? If so, is player using institute weapon? If so, is random number 1-100 greater than 50? If so, add one to magazine of current weapon."

Link to comment
Share on other sites

You would want something like this:

 

Scriptname RenInstituteGunQuestScript extends Quest

ObjectReference Property PlayerRef Auto

Ammo Property GunAmmo Auto

Weapon Property InstituteWeapon Auto

Event OnInit()
	RegisterForAnimationEvent(PlayerRef "weaponFire")
	RegisterForAnimationEvent(PlayerRef, "reloadComplete")
EndEvent

Event OnAnimationEvent(ObjectReference akSource, string asEventName)
	If (akSource == PlayerRef && asEventName == "weaponFire" && PlayerRef.GetEquippedWeapon() == InstituteWeapon)    
		if (Utility.GetRandomInt(0, 100) >= 50)
			PlayerRef.AddItem(GunAmmo, 1, true)
		endif
	EndIf
EndEvent
Link to comment
Share on other sites

Thanks, that code worked and I got the debug just about working, but I decided to can the project. This creation club garbage has killed any motivation to do Fallout 4 stuff. It's not that what they've done is THAT bad, but you know it's only going to get worse. I'm getting off this train now before it crashes.

Link to comment
Share on other sites

There is still going to be many people who will prefer to get quality mods for free. The Club is just an expanded upon version of DLC, and DLC has been a long standing bad taste in people's mouths since the whole trend started. No one likes the idea of paying for content that should have been added to the base game to begin with.

 

Also it sounds like your project wasn't entirely for you. This is mistake on a modder's behalf. Motivation should come from making stuff yourself and seeing it work in your game. Disappointment is around the corner if you mod for other reasons other than yourself. Modding is just sharing when you think about it.

 

tl;dr - don't can your project over this club nonsense.

Edited by Rasikko
Link to comment
Share on other sites

  • Recently Browsing   0 members

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