Jump to content

Recommended Posts

Posted (edited)

I can't compile a RemoveItem function.

 

It seams that something is wrong with my property.

I found thiss note on CK wiki:

  • The function accepts a form object, however you can't make a property to a form object, you need to create a property to another type of object that extends form. Most often a MiscObject, or Weapon, etc.

I think that might be the problem, but I have trouble translating it to human.

 

Somebody speeks nerdish? :tongue:

 

Edit: Im posting my code and LOG

 

 

CODE:

Scriptname PlayerEqupingLimiter extends Actor Const

Event OnItemEquipped(Form akBaseObject, ObjectReference akReference)
if akBaseObject.HasKeyword(EquipSlot_A_Coat)
if Game.GetPlayer().HasPerk(SlotEquipped_A_Coat)
Game.GetPlayer().RemoveItem(Keyword EquipSlot_A_Coat, int aiCount = -1, bool abSilent = true)
Game.GetPlayer().EquipItem(akBaseObject, abSilent = True)
Game.GetPlayer().AddPerk(SlotEquipped_A_Coat)
Else
Game.GetPlayer().AddPerk(SlotEquipped_A_Coat)
EndIf
EndIf
endEvent
Perk Property SlotEquipped_A_Coat Auto Const
Keyword Property EquipSlot_A_Coat Auto Const
AND THE LOG:
Papyrus Compiler Version 2.8.0.4 for Fallout 4
Copyright © ZeniMax Media. All rights reserved.
Starting 1 compile threads for 1 files...
Compiling "PlayerEqupingLimiter"...
C:\Users\borys\AppData\Local\Temp\PapyrusTemp\PlayerEqupingLimiter.psc(8,45): no viable alternative at input 'EquipSlot_A_Coat'
C:\Users\borys\AppData\Local\Temp\PapyrusTemp\PlayerEqupingLimiter.psc(8,79): required (...)+ loop did not match anything at input ','
C:\Users\borys\AppData\Local\Temp\PapyrusTemp\PlayerEqupingLimiter.psc(8,101): required (...)+ loop did not match anything at input ')'
No output generated for PlayerEqupingLimiter, compilation failed.

 

 

Edited by khazerruss
Posted

Seeing your script would be rather useful.

Here is the line:

Game.GetPlayer().RemoveItem( ########## , int aiCount = -1, bool abSilent = true)

 

########## - everithing I put in here fails the compilation.

I'm trying to put keyword here.

I tried a lot like:

"Keyword KeywordName"

or

"akItemToRemove.HasKeyword(KeywordName)"

 

Nothing seams to be working.

Posted

Please refer to the examples on the wiki. You don't need to put the type into the function. So in your example:

 

Game.GetPlayer().RemoveItem( KeywordName , int aiCount = -1, bool abSilent = true)

 

You don't need the "int" or "bool". It's also unnecessary to have the "aiCount" and "abSilent" like so:

 

Game.GetPlayer().RemoveItem( KeywordName, -1, true)

Posted

Please refer to the examples on the wiki. You don't need to put the type into the function. So in your example:

 

Game.GetPlayer().RemoveItem( KeywordName , int aiCount = -1, bool abSilent = true)

 

You don't need the "int" or "bool". It's also unnecessary to have the "aiCount" and "abSilent" like so:

 

Game.GetPlayer().RemoveItem( KeywordName, -1, true)

I doesn't change anything. Still not working. :(

Posted (edited)

So are you trying to remove a keyword? If so you need to use RemoveKeyword and not RemoveItem.

No. I'm trying to unequip player from all items that have a EquipSlot_A_Coat keyword.

Edited by khazerruss
Posted (edited)

It's hard to know how to help you because we can't see your whole script. You have people essentially guessing as to how to do that.

 

From what I can tell you are trying to remove an item that has a certain keyword?

 

If so then you want something along the lines of:

 

Game.GetPlayer().RemoveItem(<ObjectNameHere>.HasKeyword(<KeywordNameHere>))

 

Of course you'll need some kind of way of iterating through objects, either through a list that runs through and checks everything, or using events to check items. But, again, to say any more than that we'd need to see your code.

Edited by paulatreides0
  • Recently Browsing   0 members

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