Jump to content

Need help with a Python Script


Dragten

Recommended Posts

EDIT: Problem is fixed.

 

 

EDIT: Tittle fail... I meant Papyrus, not Python

 

Hey.

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:

 

 

[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. Also, I am not too sure of how good the order is in that.

 

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)

 

So far, the only things I know how to do to these scripts is the beginning. Like this template:

 

Scriptname TESTSCRIPT1 extends ObjectReference  


MiscObject Property ITEM2 auto
MiscObject Property ITEM3 auto
MiscObject Property ITEM1 auto
Race Property RACE1 auto
Race Property RACE2 auto
Race Property RACE3 auto
;etc with races



 

 

And yeah, that is kinda all I can for that script :/

Will greatly appreciate any help you can provide.

 

 

Edited by Dragten
Link to comment
Share on other sites

I 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:

 

 


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

 

 

 

What may be causing the error?

Edited by Dragten
Link to comment
Share on other sites

(10,0): mismatched input 'Event' expecting FUNCTION

 

you didnt use an endif, endevent or either endfunction where you should have. Anything you open, you need to close so the program knows to carry on.

 

 

From what I can see, endif was used.

 

 

But matters not, the problem was solved. But still, thank you for replying.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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