6Domino6 Posted March 5, 2012 Share Posted March 5, 2012 So I'm using the following script to add a perk to a player and I can't get the sound to work. I did define the "Sound Property Learned Auto" and the script works on all 3 instances but the sound doesn't play. I'm probably going about it the wrong way, but I've tried looking into other papyrus that play sounds and their method doesn't work for me either. Any suggestions or help would be appreciated. ps. I did post this in the mod discussion forum but it disappears so quickly that I don't want to keep bumping it every half hour just to keep it on the first page until I get a response :/ Scriptname DB_SoulSiphon extends ObjectReference {Adds Soul Siphon} Perk Property SoulSiphon auto Game Property Player Auto Sound Property Learned Auto Event OnRead() If ((game.getplayer().hasperk(SoulSiphon) == 0) && (game.getplayer().getactorvalue("Enchanting") >= 40)) Game.GetPlayer().AddPerk(SoulSiphon) Learned.play(self) debug.MessageBox("You've learned the perk Soul Siphon!") else if game.getplayer().hasperk(SoulSiphon) == 1 debug.notification("You've already learned this!") endif if ((game.getplayer().hasperk(SoulSiphon) == 0) && (game.getplayer().getactorvalue("Enchanting") < 40)) debug.notification("You can't learn this yet!") endif endif EndEvent Link to comment Share on other sites More sharing options...
Cipscis Posted March 5, 2012 Share Posted March 5, 2012 Are you reading the book from your inventory or from the game world? What happens if you replace "Self" with the player object as the parameter of Play? Cipscis Link to comment Share on other sites More sharing options...
6Domino6 Posted March 5, 2012 Author Share Posted March 5, 2012 Ideally the player should be reading it from their inventory, since it will be given to them by an NPC when completing a quest once all is said and done. As for replacing "self" I'm not sure what exactly you are suggesting replacing it with but "player" does not work and either does "object" because they will not compile properly and I get "c:\program files (x86)\steam\steamapps\common\skyrim\Data\Scripts\Source\temp\DB_M_E_SoulSiphon.psc(13,16): type mismatch on parameter 1 (did you forget a cast?)" Link to comment Share on other sites More sharing options...
Kohdi Posted March 5, 2012 Share Posted March 5, 2012 I think I agree with changing the "learned.play(self)", as is this could be "playing" the sound for the book or your inventory, but not for the player, though I don't know what to change it to. Then again, I'm not solid on how the sound-playing system works, so maybe it has to do with the bsa archives or the folder structure? Link to comment Share on other sites More sharing options...
6Domino6 Posted March 5, 2012 Author Share Posted March 5, 2012 There is a mod that does use a sound but I can't figure out what he's doing. In his script he has the following (not showing properties because it is a VERY long script and I'm skipping most of the fluff). The mod is http://skyrim.nexusmods.com/downloads/file.php?id=11623 and I unpacked it to look at his script. Essentially what his does is it has you talk to doom stones to get the perk points in return for dragon souls. The sound he has DOES play for me when using his mod but when I go to use a similar script in mine, it doesn't work. Even when reading it from the ground. Sound Property DSPPerkSelectSound Auto ;MAIN SCRIPT Event OnActivate(ObjectReference akActionRef) int spend = DSPSpend.Show() if spend == 0 int skill = DSPSkillListMage.Show() int playperksound ; ALTERATION PERK TREE if skill == 0 int alterationperksbuttonp1 = DSPAlterationPerks1.Show() if alterationperksbuttonp1 == 0 Game.GetPlayer().AddPerk(AlterationNovice00) Game.GetPlayer().DamageActorValue("dragonsouls", 1) playperksound == DSPPerkSelectSound.Play(Self) The code I used personally to test this was: Scriptname DB_M_E_SoulSiphon extends ObjectReference {Adds Soul Siphon} Perk Property SoulSiphon auto Game Property Player Auto Sound Property Learned Auto Event OnRead() int playperksound If ((game.getplayer().hasperk(SoulSiphon) == 0) && (game.getplayer().getactorvalue("Enchanting") >= 40)) Game.GetPlayer().AddPerk(SoulSiphon) playperksound == Learned.Play(Self) debug.MessageBox("You've learned the perk Soul Siphon!") else if game.getplayer().hasperk(SoulSiphon) == 1 debug.notification("You've already learned this!") endif if ((game.getplayer().hasperk(SoulSiphon) == 0) && (game.getplayer().getactorvalue("Enchanting") < 40)) debug.notification("You can't learn this yet!") endif endif EndEvent I am very new with scripting languages muchless papyrus so I do get confused quite easily, but I've learned most of what I know by looking at working scripts. I also tried "Learned.play(player as ObjectReference)" and neither reading from my inventory or from the ground made it play. Link to comment Share on other sites More sharing options...
6Domino6 Posted March 5, 2012 Author Share Posted March 5, 2012 Bump, because I am still having the issue. Link to comment Share on other sites More sharing options...
Kohdi Posted March 5, 2012 Share Posted March 5, 2012 I'm just taking a shot in the dark here, but is it possible that the sound file you want isn't set up properly for the script? It would seem (just from what you've posted) that the sound file would need to be linked through a property (?), so are you sure there is a solid connection between asking the script "playperksound == learned.play(self)", and the actual sound file that "learned" needs to link to? Link to comment Share on other sites More sharing options...
6Domino6 Posted March 6, 2012 Author Share Posted March 6, 2012 It has been linked through a property, I was using one of the UIperkselect sound files. "learned.play(self)" by itself should automatically link to the sound property, I've seen it done in several other papyrus scripts that work...but for some reason despite everything pointing towards "it should work" it doesn't work. Link to comment Share on other sites More sharing options...
tunaisafish Posted March 6, 2012 Share Posted March 6, 2012 If you drop the item on the floor it plays fine doesn't it? That's the difference between your object and the others you have been looking at. The player object can be used in any script, with Game.GetPlayer(), as you already know (or at least use that elsewhere in your code). So try... Learned.Play( Game.GetPlayer() ) Link to comment Share on other sites More sharing options...
6Domino6 Posted March 6, 2012 Author Share Posted March 6, 2012 (edited) If you drop the item on the floor it plays fine doesn't it? That's the difference between your object and the others you have been looking at. The player object can be used in any script, with Game.GetPlayer(), as you already know (or at least use that elsewhere in your code). So try... Learned.Play( Game.GetPlayer() )Actually it wasn't playing either way, I had it on the ground, used AdvSkill so I could learn it, tested. When it didn't work I reloaded, picked it up, AdvSkill, learned it and it wouldn't work either way :/ Trying your method in a moment soon as CK loads up. Edit: The following code didn't work either...despite the fact that it compiled perfectlyScriptname DB_M_E_SoulSiphon extends ObjectReference {Adds Soul Siphon} Perk Property SoulSiphon auto Game Property Player Auto Sound Property Learned AUto Event OnRead() If ((game.getplayer().hasperk(SoulSiphon) == 0) && (game.getplayer().getactorvalue("Enchanting") >= 40)) Game.GetPlayer().AddPerk(SoulSiphon) debug.MessageBox("You've learned the perk Soul Siphon!") learned.play(Game.GetPlayer()) else if game.getplayer().hasperk(SoulSiphon) == 1 debug.notification("You've already learned this!") endif if ((game.getplayer().hasperk(SoulSiphon) == 0) && (game.getplayer().getactorvalue("Enchanting") < 40)) debug.notification("You can't learn this yet!") endif endif EndEvent Edited March 6, 2012 by 6Domino6 Link to comment Share on other sites More sharing options...
Recommended Posts