Playing sounds via Script & disposition

Post » Tue Jun 19, 2012 5:55 am

Well, i tried to add a sound that plays randomly by a npc. I tried following:


Scriptname soundscript1

Sound property sound1 Auto

int instanceID

Event OnInit()

While(TRUE)
int time = Utility.RandomInt()

instanceID = sound1.play(self)
Sound.SetInstanceVolume(instanceID,1.0)

utility.Wait(time)

EndWhile

EndEvent

I have the sound1 in the Sound Marker and its includin g the original sound from the Sound Descriptor.

I get a compiler error and the message:
type missmatch on parameter 1 (did you forget a cast?)

that actually tells me, that sound1 isn't the right type for the play function. So i actually was looking, what types are used in the other scripts but it seems there is always a sound type generated like the one i used. So does somebody know what is wrong by this compling stuff?
Ok, i also get a second compile error by the Sound.SetInstanceVolume, but its the same Code i got from the Wiki and i think its because the instanceID is null because of the error.
http://www.creationkit.com/Play_-_Sound

And then i tried also:

Event OnActivate(ObjectRefernece akActionRef)
moddisposition player 100
EndEvent


But this seems not to work by Skyrim. And there is also no explanation in the wiki about moddisposition
http://www.creationkit.com/ModDisposition
Empty Page :<



Hope somebody could help me by the problems. Thx ^^

PS: Is there also some kind of timerevent, so i don't need to use the while loop?
User avatar
Juan Suarez
 
Posts: 3395
Joined: Sun Nov 25, 2007 4:09 am

Post » Tue Jun 19, 2012 8:44 am

What's the whole compiler output? It's easier to debug if we know what line to look on (please take a look at http://www.gamesas.com/topic/1347469-how-to-ask-for-scripting-help/)

ModDisposition is a console command - it is not available to Papyrus.

Cipscis

EDIT:

A couple of other things - your script doesn't extend anything so you won't be able to attach it to anything, and instead of a While loop you should use an http://www.creationkit.com/OnUpdate_-_Form event.

Cipscis
User avatar
Unstoppable Judge
 
Posts: 3337
Joined: Sat Jul 29, 2006 11:22 pm

Post » Tue Jun 19, 2012 1:43 am

Starting 1 compile threads for 1 files...
Compiling "soundscript1"...
d:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\soundscript1.psc(12,20): type mismatch on parameter 1 (did you forget a cast?)
d:\games\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\soundscript1.psc(12,0): type mismatch while assigning to a int (cast missing or types unrelated)
No output generated for soundscript1, compilation failed.

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


Thats actually this what i get from the compiler


ModDisposition is a console command - it is not available to Papyrus.
Yea, tried also SetDisposition Player 100 what worked by the older Script Language but this isn't also working in the new scripting language. So is there a command who can change the Disposition per script?

Thx for the help
User avatar
SiLa
 
Posts: 3447
Joined: Tue Jun 13, 2006 7:52 am

Post » Tue Jun 19, 2012 4:07 am

Ah, that will be because your script doesn't extend anything, so its type cannot be cast to http://www.creationkit.com/ObjectReference_Script, as would be required by http://www.creationkit.com/Play_-_Sound.

I don't know if disposition can be modified in Papyrus. Are you certain it's still being used in Skyrim, though? I thought it was replaced with http://www.creationkit.com/Relationship, and you can use http://www.creationkit.com/SetRelationshipRank_-_Actor to edit those.

Cipscis
User avatar
Christine Pane
 
Posts: 3306
Joined: Mon Apr 23, 2007 2:14 am

Post » Tue Jun 19, 2012 2:53 am

I don't know if disposition can be modified in Papyrus. Are you certain it's still being used in Skyrim, though? I thought it was replaced with http://www.creationkit.com/Relationship, and you can use http://www.creationkit.com/SetRelationshipRank_-_Actor to edit those.
Ah oh, ok. That makes it a bit difficult what i tried. Already got the relationships model, but its something i wasn't looking in because i thought there would be the mod still, because u can alter it manually in the editor.

Ah, that will be because your script doesn't extend anything, so its type cannot be cast to http://www.creationkit.com/ObjectReference_Script, as would be required by http://www.creationkit.com/Play_-_Sound.
Yea, thx, I think i was able to get a bit more into the stuff. Replaced it tough Actor because i was trying it on a NPC and the thing is finally working.

So thx for the help. :D
User avatar
Allison C
 
Posts: 3369
Joined: Mon Dec 18, 2006 11:02 am


Return to V - Skyrim