Jump to content

Newbie Scripting Help - What does this error mean?


Hawkman984

Recommended Posts

In short, I'm trying to make a simple script that will remove an item from an npc's inventory on death and replace it with something else. I've been googling around for about an hour now, and I cannot find a good answer as to what the error I'm getting is caused by. I'd like to know what the error means primarily, but if you have any suggestions on how to fix the code, I'd appreciate that too.

Scriptname ItemReplacerScript extends Quest

MiscObject Property PipeGunb Auto
Weapon Property PipeGun Auto
Actor Property akVictim Auto
Actor Property akKiller Auto

Event OnDeath(Actor akKiller) Native
	if akkiller==game.getplayer()
		akVictim.additem(PipeGunb, 1, true)
		akVictim.removeitem(PipeGun, 1, true)
	endif
endevent

Compiler:

 

Papyrus Compiler Version 2.8.0.4 for Fallout 4
Copyright © ZeniMax Media. All rights reserved.
Starting 1 compile threads for 1 files...
Compiling "ItemReplacerScript"...
C:\Users\brand\AppData\Local\Temp\PapyrusTemp\ItemReplacerScript.psc(9,1): no viable alternative at input 'if'
No output generated for ItemReplacerScript, compilation failed.
Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on ItemReplacerScript

 

 

I cannot find a straight answer for what no viable alternative means, and as far as I can see my syntax is good, although I'm not exactly good at this. Help is appreciated.

Link to comment
Share on other sites

The primary issue is that you have the keyword "native" in the event declaration. You will want to remove that.

 

However you have a larger issue in that the script extends quest instead of actor. The ondeath event won't fire because your script is not attached to an actor.

 

To solve this you either need to rewrite the script and extend actor or use RegisterForRemoteEvent.

Edited by Reneer
Link to comment
Share on other sites

  • Recently Browsing   0 members

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