Jump to content

DOWNLOAD MODS

Are you looking for something shiny for your load order? We have many exclusive mods and resources you won't find anywhere else. Start your search now...

LEARN MODDING

Ready to try your hand at making your own mod creations? Visit the Enclave, the original ES/FO modding school, and learn the tricks of the trade from veteran modders...

JOIN THE ALLIANCE

Membership is free and registering unlocks image galleries, project hosting, live chat, unlimited downloads, & more...

Need help for Papyrus script.


Dragten
 Share

Recommended Posts

Good day. I got pointed here from the Bethesda forums.

I have been working with modding ever since Morrowind. Mostly some few private projects.

I have not been doing much scripting, since I had no need for it, but I did try it once in Oblivion and thought it was not THAT hard, if one was to sit down and try to understand it.

Although, with a new mod in the works, I now need to create a few scripts in Skyrim. And it is a pain. The Papyrus language is much harder than I expected and there are way too many things that I yet cannot understand.

I have created a few scripts for the mod already, but I really need some help for the big (and very important) one.

Here is what it should do (this is not 100% correct order, but more of a sketch):

[1]* When the player has an armor item equipped, he will get a message, when clicking on some dead bodies (men, mer and creatures).

[2]* If the RACE of the dead creature = RACE1 property, go to STAGE1

[2.5]* If the RACE of the dead create = RACE2 property, go to STAGE2

etc with races

STAGE1,2,etc

[3]* If the state of the body is NOT "STATE1" (property), then a message box should come up

[3.5]* If the state of the body IS "STATE1" (property), go to [5]

[4]* The message box will ask, if player wants to preform "Action lalala" on the corpse.

[5]* If no - open loot

[6]* If yes - check if player has ITEM1 and ITEM2.

[7]* ^ If player does NOT have both or any of ITEM1 or ITEM2, go to [5]

[8]* ^ If player has both ITEM1 and ITEM2, remove the ITEM1 x1 and ITEM2 x1, set corpse state to "STATE1", add ITEM3 x1 to player

EndSTAGE

It must look rather complicated, and it is... Sadly, I cannot create it with my own skills and therefore ask for your help.

The script has a little similarity to the blood extractor (DA04) script. Although, looking at these scripts did not help me at all.

Also, I do not know if the first park of the script should be added to armor or perk.

If perk, then the armor item will just give the perk to the player when equipped and remove it, when unequipped. (I know how to do that)

Again, tried to do some things on my own.

Copied and edited a part of da04bloodharvestvictimscript.psc . It is the script, used in the DA04 quest, for blood harvesting off elves.

Even though:

Scriptname aaDr_SCR_Ana_toolsPER extends ReferenceAlias
Is set on ReferenceAlias, just like the original (also tried ObjectReference), I keep getting following errors when complying:
Starting 1 compile threads for 1 files... Compiling "aaDr_SCR_Ana_toolsPER"... c:\steam\steamapps\common\skyrim\Data\Scripts\Source\aaDr_SCR_Ana_toolsPER.psc(10,0): mismatched input 'Event' expecting FUNCTION c:\steam\steamapps\common\skyrim\Data\Scripts\Source\aaDr_SCR_Ana_toolsPER.psc(0,0): error while attempting to read script aaDr_SCR_Ana_toolsPER: Object reference not set to an instance of an object. No output generated for aaDr_SCR_Ana_toolsPER, compilation failed. Batch compile of 1 files finished. 0 succeeded, 1 failed. Failed on aaDr_SCR_Ana_toolsPER
Here is my code:

What may be causing the error?

Thanks in advance.



Scriptname aaDr_SCR_Ana_toolsPER extends ObjectReference

{The actual script for the tools work}


Race Property Race_wolf auto

Race Property Race_bear auto

Message Property MSG_Message1 auto

MiscObject Property Notes_wolf



Event OnActivate(ObjectReference akActivator)



int response = MSG_Message1.Show()

if (response == 0)


ActorBase me = GetActorReference().GetLeveledActorBase()


if (me.GetRace() == Race_wolf)


Debug.Notification("Yeps, that is a wolf")

Game.GetPlayer().AddItem(Notes_wolf, 1)


elseif (me.GetRace() == Race_Bear)


Debug.Notification("Yeps, that is a bear")



; elseif (me.GetRace() == da04script.Dunmer)

;

; elseif (me.GetRace() == da04script.Falmer)

;

; elseif (me.GetRace() == da04script.Orsimer)

;

endif


endif

EndEvent


And here is the original part of the code:


Scriptname DA04BloodHarvestVictimScript extends ReferenceAlias


Quest Property ParentQuest auto


Message Property HarvestMessage auto


(...)


Event OnActivate(ObjectReference akActivator)



int response = HarvestMessage.Show()

if (response == 0)

ActorBase me = GetActorReference().GetLeveledActorBase()

MiscObject bloodType = None

if (me.GetRace() == da04script.Altmer)

bloodType = da04script.AltmerBlood

elseif (me.GetRace() == da04script.Bosmer)

bloodType = da04script.BosmerBlood

elseif (me.GetRace() == da04script.Dunmer)

bloodType = da04script.DunmerBlood

elseif (me.GetRace() == da04script.Falmer)

bloodType = da04script.FalmerBlood

elseif (me.GetRace() == da04script.Orsimer)

bloodType = da04script.OrsimerBlood

endif


; Game.GetPlayer().AddItem(bloodType, 1)

da04script.GotBlood(bloodType)


GetOwningQuest().SetStage(100)

endif /;

EndEvent


Link to comment
Share on other sites

I have been trying over and over again, without any luck.

This time, I have tried to borrow fragments from DA11 Cannibalism quest scripts, but it was useless once again.

Scriptname aaDr_SCR_Ana_toolsPER extends ObjectReference

{The actual script for the tools work}



	Message Property MSG_Message1 auto





Function Fragment_0(ObjectReference akTargetRef, Actor akActor)

	Debug.Notification("So far so good")

	Int iButton = MSG_Message1.Show()



EndFunction	

Nothing happens when clicking a dead actor. Creature or Humanoid.

I am completely "blind" when working on the starts of the scripts.

Help is greatly appreciated.

Edited by Dragten
Link to comment
Share on other sites

What you are trying is out of my league.

Seems to me you would have to put a script on every actor in the game and check for death. Or perhaps, place an enchantment on a special weapon that when you kill the target, it places a token or something on them, so your script will run on 'that' dead body.

Link to comment
Share on other sites

Thank you for taking time to look here.

What you are trying is out of my league.

Seems to me you would have to put a script on every actor in the game and check for death. Or perhaps, place an enchantment on a special weapon that when you kill the target, it places a token or something on them, so your script will run on 'that' dead body.

But what about the before mentioned scripts for the Blood Extractor and the Namira ring?

They seem to do the job, although I have no idea how.

Or perhaps, place an enchantment on a special weapon that when you kill the target, it places a token or something on them,

Theoretically, I already have created a script that would add a perk to the player, once he equips an item. So now I just need the actual script for the perk. So yeah, whenever a target is killed, while the player has the perk on him, it should become a kind of activator.

Link to comment
Share on other sites

Have been a while since I have done it , but AFAIR, Cannibalism works like this:

When you have the ring equipped, it adds you a perk.

Perk does the following:

When you kill a person, and you sneak-loot their body, you will get the message if you want to feed.

If you say yes, an animation will play and you will get some buffs.

Papyrus actually has a function for cannibalism.

Here is the only script for that perk:

;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment

;NEXT FRAGMENT INDEX 6

Scriptname PRKF_DA11Cannibalism_000EE5C3 Extends Perk Hidden


;BEGIN FRAGMENT Fragment_0

Function Fragment_0(ObjectReference akTargetRef, Actor akActor)

;BEGIN CODE

Game.GetPlayer().StartCannibal(akTargetRef as Actor)

DA11CannibalismAbility.Cast(Game.GetPlayer(), Game.GetPlayer())

DA11CannibalismAbility02.Cast(Game.GetPlayer(), Game.GetPlayer())


;Game.GetPlayer().AddSpell(DA11CannibalismAbility)

;Game.GetPlayer().AddSpell(DA11CannibalismAbility02, abVerbose= false)

;END CODE

EndFunction

;END FRAGMENT


;END FRAGMENT CODE - Do not edit anything between this and the begin comment


PlayerVampireQuestScript Property PlayerVampireQuest  Auto  


Spell Property DA11CannibalismAbility  Auto  


Spell Property DA11CannibalismAbility02  Auto  

Link to comment
Share on other sites

Lets take a look at the Ring of Namira and I will show you how I would reserach it.

>Items >Armor >DA11RingofNamira

Script attached is 'da11ringofnamirascript' and in its properties is a perk reference called 'DA11Cannibalism'. Looking at the script, it adds or removes the perk depending on if you equip or take off the ring.

It also has the enchantment 'DA11RingofNamiraEnchantment'. But all it does is fortify your stamina by 50 points.

Now the 'Perk' is interesting. 'DA11Cannibalism'.

See the 'perk entries'?

Double-click it. You see its 'entry point' is Activate, and its adding an activate button choice when you activate something. That 'something' in on the 'Target' tab, so click it.

You see the target of the activate has this:

HasKeyword 'ActorTypeNPC'. And they are dead (getdead = 1).

So, you need to do something similar.

Link to comment
Share on other sites

dont think so... Not sure where 'hasbeeneaten' is located, but it must be a property of all Actors.

Here is what Wiki says:

HasBeenEaten

This function is for Actors who have been cannibalized by other Actors.

For regular food items, the reference should be destroyed on eating, so you should be able to just check for existence of the reference to tell whether it has been eaten.

Maybe it would be possible to create a function with a script? Be cause, if no function like this will be used, then the player will be able to do it infinite amount of times.

And again, if I was to use the HasBeenEaten, I would more or less break the game cannibalism.

Link to comment
Share on other sites

So far, so very good!

I have finally made some progress, thanks to you, Willie.

Working so far:

Having the item equipped, and "activating" dead actor of "ABC" race, while also having items 1 & 2 in the inventory brings up a message whether I just want to loot it or to XYZ it.

Now I just need to somehow make an effect of: remove item 1 & 2, add item 3, mark as eaten.

I have decided to use HasBeenEaten anyway.

Sure, it will be impossible to do both cannibalism feeding and XYZ, but it is a good price to pay. Besides, my mod will focus on creatures. Still not sure if I want to add the NPCs to it.

Now.. back to work.

Link to comment
Share on other sites

Some info on fragments. I do not yet understand 100% how they work, but here is what I have found out so far:

You can have a script with several fragments. They are all numbered, like fragment_0, fragment_1 etc.

Perks can have several perk entries. Each entry can call upon a certain fragment in the script.

Seems like it is the "part of the script that has to be executed at the specific entry."

If park entry has "Entry point" as activate (and several others, I'm guessing) you can select the script and fragment under "Advanced". You can also compile, edit and set properties under "Papyrus fragment".

And I almost got everything working now!

Edited by Dragten
Link to comment
Share on other sites

Willie, I need last thing.

I need to add HasBeenEaten as "true" for the corpse.

The namira script/perk does not have it, so I think it is a part of StartCannibal.

I have been trying to do:

akTarget.HasBeenEaten true
(12,9): no viable alternative at input 'HasBeenEaten'
akTarget.HasBeenEaten(1)
(12,0): variable akTarget is undefined (12,9): none is not a known user-defined type
akTarget.HasBeenEaten = 1

(12,0): variable akTarget is undefined

(12,9): none is not a known user-defined type

(12,8): type mismatch while assigning to a none (cast missing or types unrelated)

Do you have a suggestion for correct order or syntax?

Edited by Dragten
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...