quake709 Posted February 5, 2017 Share Posted February 5, 2017 Alright so i'm trying to make a magic effect script that will change the target's voicetype: Scriptname ChangeVoiceMagicEffect extends activemagiceffect VoiceType Property Voice = MaleKhajiit Auto Event OnEffectStart(Actor Target, Actor Caster) Target.SetVoiceType(MaleKhajiit) EndEvent The compiler throws " no viable alternative at input 'MaleKhajiit' ". I did research and people said that there needs to be an event, but there is? Any Idea how to fix? I'm a complete noob at papyrus, the only other language i really know is java. Link to comment Share on other sites More sharing options...
Surilindur Posted February 5, 2017 Share Posted February 5, 2017 (edited) If you have not yet read it, the wiki page on variables and properties might help: http://www.creationkit.com/index.php?title=Variables_and_Properties_(Papyrus) A property is a sort of link between the script and an actual in-game object. You can add a property in a script, but you need to use the Creation Kit to point it at an object. As in, your property declaration should look like this: VoiceType Property Voice AutoAnd you would need to attach the script to whatever it is you are going to attach it to (a magic effect?), open the property editor for the script after you have attached it to the magic effect, and fill the "Voice" property with the voice type you want (there should be some sort of drodown list I think?). You can think of a property as a hole and a tunnel, and your script as an isolated cube. The script, by itself, has no idea what something called "MaleKhajiit" is - it is just a bunch of characters after another with no meaning. To be able to point the script at your "MaleKhajiit" voice type, you cut a hole to the cube and label it "VoiceType called Voice" (create a property of type VoiceType named Voice). The script now knows that there should be a VoiceType called Voice somewhere through that hole. The next thing you do is build a tunnel between the hole and the MaleKhajiit voice type (fill the property in the Creation Kit), so that when the script looks through the "VoiceType called Voice" hole, it will see the MaleKhajiit object at the end of the tunnel. If that makes any sense. :tongue: Hopefully that helps a bit. Edit: I made a small picture to illustrate the whole Property idea, if it helps (in the spoiler): http://i.imgur.com/i5oL6FQ.jpg Edited February 5, 2017 by Contrathetix Link to comment Share on other sites More sharing options...
quake709 Posted February 6, 2017 Author Share Posted February 6, 2017 If you have not yet read it, the wiki page on variables and properties might help: http://www.creationkit.com/index.php?title=Variables_and_Properties_(Papyrus) A property is a sort of link between the script and an actual in-game object. You can add a property in a script, but you need to use the Creation Kit to point it at an object. As in, your property declaration should look like this: VoiceType Property Voice AutoAnd you would need to attach the script to whatever it is you are going to attach it to (a magic effect?), open the property editor for the script after you have attached it to the magic effect, and fill the "Voice" property with the voice type you want (there should be some sort of drodown list I think?). You can think of a property as a hole and a tunnel, and your script as an isolated cube. The script, by itself, has no idea what something called "MaleKhajiit" is - it is just a bunch of characters after another with no meaning. To be able to point the script at your "MaleKhajiit" voice type, you cut a hole to the cube and label it "VoiceType called Voice" (create a property of type VoiceType named Voice). The script now knows that there should be a VoiceType called Voice somewhere through that hole. The next thing you do is build a tunnel between the hole and the MaleKhajiit voice type (fill the property in the Creation Kit), so that when the script looks through the "VoiceType called Voice" hole, it will see the MaleKhajiit object at the end of the tunnel. If that makes any sense. :tongue: Hopefully that helps a bit. Edit: I made a small picture to illustrate the whole Property idea, if it helps (in the spoiler): http://i.imgur.com/i5oL6FQ.jpg Gotcha, thanks I was always confused on the properties thing but your llustration clears it up perfectly. Link to comment Share on other sites More sharing options...
Surilindur Posted February 6, 2017 Share Posted February 6, 2017 (edited) No problem, great to hear I could help My skills at explaining things are below average. :blush: One more thing about properties: they are not just links between Papyrus and actual game objects (I think I might have made it sound like as if they were mainly that) - they also allow the reuse of scripts with different variable values that can be set in the Creation Kit without having to hardcode them to the script. Maybe something like a "gold lever" thing would be a great example of a property being both a link between Papyrus and a game object and a variable that can be set in the Creation Kit without having to hardcode it. So, assuming there would be two levers: one lever adds twenty Septims to whoever triggers it, and another lever adds 123 burnt books to whoever triggers it. They can both use the same script: ScriptName _RememberToPrefixYourScripts_LeverScript Extends ObjectReference Form Property ItemToGive Auto ; the item to give Int Property GiveCount Auto ; number of items to give Event OnActivate(ObjectReference akActionRef) akActionRef.AddItem(ItemToGive, GiveCount) EndEventI have not tested if that works, but the idea should be there. The smart part of it is the use of properties in the Creation Kit:first, one would place two simple levers in the gameworld somewhere, and add the script to each reference separately (to avoid having to create a new base object) by opening the scripts tab for both and adding a new scriptthen, in the first lever reference in the world, one would open the scripts tab, open the property editor for the new script and assign ItemToGive to Gold001 (or somesuch, the gold object) and set GiveCount to 20in the second lever, do the same, except that the item would be the burnt book object and count would be 123So while properties can be a bit tricky to wrap the head around at first, once you get the idea and understand how brilliant they are, you just cannot live without them! In the previous titles (like Oblivion), that two lever scenario would have required two distinct scripts with the items and counts hardcoded of sorts (or a clever scripting trick, but nothing as straightforward as a property). :happy: Edited February 6, 2017 by Contrathetix Link to comment Share on other sites More sharing options...
Recommended Posts