How does one run a script?

Post » Tue Jun 19, 2012 9:09 am

Okay, this seems really stupid, but I have written several scripts now, and I have no idea how to actually get them to execute. I'll give you an example. I have a Thalmor agent named Visarol, and he has a line of dialogue. After he says this, he is supposed to attack with a number of his guards, all of which are part of my custom Thalmor faction. Here is what the code looks like:

Scriptname TIF__01001FEB Extends TopicInfo HiddenFunction Fragment_3(ObjectReference akSpeakerRef)     Actor akSpeaker = akSpeakerRef as Actor     TBJThalmor.SetEnemy(PlayerFaction)EndFunctionFunction Fragment_0(ObjectReference akSpeakerRef)     Actor akSpeaker = akSpeakerRef as Actor;BEGIN CODE;test     TBJThalmor.SetEnemy(PlayerFaction);END CODEEndFunction;END FRAGMENTFaction Property PlayerFaction  Auto Faction Property TBJThalmor  Auto 

Then, in the Begins: Text box for the topic, I typed TBJThalmor.SetEnemy(PlayerFaction).
Everything compiled fine, but now when this guy executes the topic, he doesn't aggro. Why not?

Basically, I have had the problem of trying to make scripts I've written actually function for days now, and I really need to know how its done. So please, no workarounds, how can I get a script to run from dialogue. In a larger sense, how does one get these scripts to execute when you want them to?
User avatar
Jodie Bardgett
 
Posts: 3491
Joined: Sat Jul 29, 2006 9:38 pm

Post » Tue Jun 19, 2012 10:39 pm

You can run a script through quest in the quest "Start Up"

Then create stage index 0 and write in stage 0 next script


Setstage(0)

and also place your script there
User avatar
Janeth Valenzuela Castelo
 
Posts: 3411
Joined: Wed Jun 21, 2006 3:03 am

Post » Tue Jun 19, 2012 8:53 pm

You can run a script through quest in the quest "Start Up"

Then create stage index 0 and write in stage 0 next script


Setstage(0)

and also place your script there

Sorry man, I don't understand your English. Maybe you can show me with pictures?
User avatar
Miragel Ginza
 
Posts: 3502
Joined: Thu Dec 21, 2006 6:19 am

Post » Tue Jun 19, 2012 10:22 pm

Sorry.

1. Create a quest. Put a tick on the Start Up
2. Create stage 0
3. Write your script in stage 0 and SetStage(0)
User avatar
Yvonne Gruening
 
Posts: 3503
Joined: Mon Apr 23, 2007 7:31 pm

Post » Tue Jun 19, 2012 11:05 pm

Sorry.

1. Create a quest. Put a tick on the Start Up
2. Create stage 0
3. Write your script in stage 0 and SetStage(0)

I don't understand what that would accomplish. I don't want this to happen during stage 0, I want it to happen at stage 15.
User avatar
Rob Davidson
 
Posts: 3422
Joined: Thu Aug 02, 2007 2:52 am

Post » Tue Jun 19, 2012 6:48 pm

Maybe you can try with a carible that after the dialogue is done it change the variable number and the script would require an if variable is blah blah, so as soon the variable change the script should run.

Or as the other suggested you can put the script execution at the stage you want on the quest tab under quest stages, but thats only if you want your event to happen at the start of stage 15.
User avatar
Kevan Olson
 
Posts: 3402
Joined: Tue Oct 16, 2007 1:09 am

Post » Tue Jun 19, 2012 1:21 pm

Replace the stage at 15 and "Start Up" it's run your script
User avatar
danni Marchant
 
Posts: 3420
Joined: Sat Oct 07, 2006 2:32 am

Post » Tue Jun 19, 2012 10:13 am

I don't think you understand my question. The only "start up" thing I see is the Start Up Quest button. That seemingly has nothing to do with getting an aggro script to run, that is for making the first stage of a quest. This isn't in the first stage of the quest.

Also I don't want this to happen at the beginning of stage 15, I want it to happen when this guy says a specific line. But, I can't get Papyrus scripts to run. I finally figured out how to get them to compile, but they don't actually seem to do anything,
User avatar
Romy Welsch
 
Posts: 3329
Joined: Wed Apr 25, 2007 10:36 pm

Post » Tue Jun 19, 2012 5:05 pm

Then create a new script for your the quest and use next event http://www.creationkit.com/OnUpdate_-_Form
User avatar
Kirsty Wood
 
Posts: 3461
Joined: Tue Aug 15, 2006 10:41 am

Post » Tue Jun 19, 2012 12:35 pm

Then create a new script for your the quest and use next event http://www.creationkit.com/OnUpdate_-_Form

What? What are you talking about? I can't see how that article is related. It talks about how to make something occur regularly through updating.

Okay, clearly I am not being clear enough.
This is what I have so far.

In the Dialogue box under Begin I have TBJThalmor.SetEnemy(PlayerFaction), in the end box i have GetOwningQuest().SetStage(17), and in the script source i have
;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment;NEXT FRAGMENT INDEX 6Scriptname TIF__01001FEB Extends TopicInfo Hidden;BEGIN FRAGMENT Fragment_5Function Fragment_5(ObjectReference akSpeakerRef)     Actor akSpeaker = akSpeakerRef as Actor;BEGIN CODE     GetOwningQuest().SetStage(17);END CODEEndFunction;END FRAGMENT;BEGIN FRAGMENT Fragment_3Function Fragment_3(ObjectReference akSpeakerRef)     Actor akSpeaker = akSpeakerRef as Actor    ;BEGIN CODE    TBJThalmor.SetEnemy(PlayerFaction);END CODEEndFunction;END FRAGMENT;END FRAGMENT CODE - Do not edit anything between this and the begin commentFunction Fragment_0(ObjectReference akSpeakerRef)     Actor akSpeaker = akSpeakerRef as Actor     ;BEGIN CODE     ;test     TBJThalmor.SetEnemy(PlayerFaction);END CODEEndFunction;END FRAGMENTFaction Property PlayerFaction  AutoFaction Property TBJThalmor  Auto

All of this compiles correctly. Unfortunately, neither the stage gets set to 17 nor does he aggro when talked to. I want to know how to fix this.
User avatar
Latisha Fry
 
Posts: 3399
Joined: Sat Jun 24, 2006 6:42 am

Post » Tue Jun 19, 2012 6:41 pm

As I understand it you want to create fight or not?
User avatar
Justin Hankins
 
Posts: 3348
Joined: Fri Oct 26, 2007 12:36 pm

Post » Tue Jun 19, 2012 7:28 pm

As I understand it you want to create fight or not?

Yes, I want it so that if a player is at stage 15 and talks to a guy, (TBJVisarol2) they get a particular topic. I want him and his other faction members in the building to attack after he responds.
User avatar
Kayla Bee
 
Posts: 3349
Joined: Fri Aug 24, 2007 5:34 pm

Post » Tue Jun 19, 2012 9:37 am

Check it out:
this code write in dialogue and don't forget to create properties.
If (*Your Quest*.GetStage()==15)*your faction*.SetActorValue("aggression",100)endif
Or you can to write in the dialogue
Actor.StartCombat(Game.GetPlayer())
User avatar
Katie Samuel
 
Posts: 3384
Joined: Tue Oct 10, 2006 5:20 am

Post » Tue Jun 19, 2012 7:43 pm

Check it out:
this code write in dialogue and don't forget to create properties.
If (*Your Quest*.GetStage()==15)*your faction*.SetActorValue("aggression",100)endif
Or you can to write in the dialogue
Actor.StartCombat(Game.GetPlayer())

I typed
IF (GetOwningQuest.GetStage()==15)   TBJThalmor.setactorvalue("aggression", 100)endif

in the begins: box, and got

Starting 1 compile threads for 1 files...
Compiling "TIF__01001FEB"...
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__01001FEB.psc(9,4): variable GetOwningQuest is undefined
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__01001FEB.psc(9,19): none is not a known user-defined type
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__01001FEB.psc(9,29): cannot compare a none to a int (cast missing or types unrelated)
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__01001FEB.psc(10,14): setactorvalue is not a function or does not exist
No output generated for TIF__01001FEB, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on TIF__01001FEB

as a result
User avatar
Project
 
Posts: 3490
Joined: Fri May 04, 2007 7:58 am

Post » Tue Jun 19, 2012 3:57 pm

Oh...you forgot write in the script property.

On the Right from dialogue there is a script. Right click on the script --->>Edit Source and in end write next

Quest Property MyQuest Auto

Isn't correct

IF (GetOwningQuest.GetStage()==15)   TBJThalmor.setactorvalue("aggression", 100)endif

Correct

IF (MyQuestt.GetStage()==15)   TBJThalmor.setactorvalue("aggression", 100)endif

and don't forget to create properties for your the quest
User avatar
CYCO JO-NATE
 
Posts: 3431
Joined: Fri Sep 21, 2007 12:41 pm

Post » Tue Jun 19, 2012 3:01 pm

I still got a weird error, so I switched my syntax to the StartCombat, and it worked!
Now I want to get the other people to attack with the main guy. This is what I'm trying, but no luck so far.
faction tribe =TBJThalmorIF (TBJ01.GetStage()==15)   TBJVisarol2.startCombat(Game.GetPlayer())   tribe = TBJVisarol2.getAV("faction")   tribe.SetActorValue("aggression",100)endif

this is the error I'm getting


SUCCESS FINALLY! I wound up forgetting about the Faction attack idea and just made everyone aggro individually. It works beautifullly!

Starting 1 compile threads for 1 files...
Compiling "TIF__01001FEB"...
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__01001FEB.psc(9,8): type mismatch while assigning to a faction (cast missing or types unrelated)
c:\program files\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\TIF__01001FEB.psc(13,9): SetActorValue is not a function or does not exist
No output generated for TIF__01001FEB, compilation failed.

Batch compile of 1 files finished. 0 succeeded, 1 failed.
Failed on TIF__01001FEB
User avatar
Hayley Bristow
 
Posts: 3467
Joined: Tue Oct 31, 2006 12:24 am

Post » Tue Jun 19, 2012 7:39 pm

Better point all guys

IF (TBJ01.GetStage()==15)   TBJVisarol2.startCombat(Game.GetPlayer())   TBJVisarol3.startCombat(Game.GetPlayer())   TBJVisarol4.startCombat(Game.GetPlayer())    ; and so onendif
User avatar
James Smart
 
Posts: 3362
Joined: Sun Nov 04, 2007 7:49 pm

Post » Tue Jun 19, 2012 1:07 pm

Better point all guys

IF (TBJ01.GetStage()==15)   TBJVisarol2.startCombat(Game.GetPlayer())   TBJVisarol3.startCombat(Game.GetPlayer())   TBJVisarol4.startCombat(Game.GetPlayer())	; and so onendif

Yeah, I wound up doing that. It worked. Thank you so much for your persistent help, I couldn't have done it without you. I think I'm finally beginning to understand how properties work.
User avatar
Miguel
 
Posts: 3364
Joined: Sat Jul 14, 2007 9:32 am

Post » Tue Jun 19, 2012 4:17 pm

Finally :biggrin: if you have any questions ask me
User avatar
naana
 
Posts: 3362
Joined: Fri Dec 08, 2006 2:00 pm


Return to V - Skyrim