Demeggy Posted February 7, 2015 Share Posted February 7, 2015 Afternoon, So I've had a gander around the internet, and seem to have come up blank. Basically I'm trying to set the reference of a player cloned NPC via NVSE withina quest script. Attempting to use the following breaks the script; ref playerBody set playerBody to 00000007 ;should in theory spawn the player NPC clone (I have a feeling this is where it breaks) player.placeAtMe playerBody playerBody.setRefVariable "clonedBodyRef" questNameHereAny suggestions would be much appreciated! D Link to comment Share on other sites More sharing options...
tomm434 Posted February 7, 2015 Share Posted February 7, 2015 (edited) You can use this code ref PlayerBodyRef set PlayerBodyRef to Player.PlaceAtMe 7 1 PlayerBodyRef.setRefVariable "clonedBodyRef" questNameHere Edited February 7, 2015 by tomm434 Link to comment Share on other sites More sharing options...
Demeggy Posted February 7, 2015 Author Share Posted February 7, 2015 Cheers Tomm, unfortunately that doesn't appear to work. SetRefVariable consistently breaks on the cloned playerRef :( Link to comment Share on other sites More sharing options...
Fallout2AM Posted February 8, 2015 Share Posted February 8, 2015 (edited) That's not the way I used SetRefVariable. I used that when I buildref something, not when I had to refer to something inside my own mod. Am I missing something? Edited February 8, 2015 by Fallout2AM Link to comment Share on other sites More sharing options...
tomm434 Posted February 8, 2015 Share Posted February 8, 2015 Demeggy, what are you trying to achive with this code? I my version player clones is already set to be "PlayerBodyRef". Do what you want with this reference. Link to comment Share on other sites More sharing options...
Demeggy Posted February 8, 2015 Author Share Posted February 8, 2015 That's not the way I used SetRefVariable. I used that when I buildref something, not when I had to refer to something inside my own mod. Am I missing something? I can't quite find any clear info on what parameters the setrefvar uses. From what I can establish; nameofReftoModifyhere.setRefVariable "refNameIwantHere" nameofquestthisScriptRunsInHere The last parameter (quest) I'm dubious about... It should basically create a new ref for the player clone, as I eventually want to be able to utilise multiple clones of the player, each with their own unique ref (I'll be storing these ref's in an array). Thanks, D Link to comment Share on other sites More sharing options...
jazzisparis Posted February 8, 2015 Share Posted February 8, 2015 The player doesn't use a script, therefore that variable doesn't exist anywhere. You will have to store the clones' references in some other script. The quest parameter is optional, and should only be used if the target variable is in a quest script. Link to comment Share on other sites More sharing options...
Fallout2AM Posted February 8, 2015 Share Posted February 8, 2015 That's not the way I used SetRefVariable. I used that when I buildref something, not when I had to refer to something inside my own mod. Am I missing something?It should basically create a new ref for the player clone, as I eventually want to be able to utilise multiple clones of the player, each with their own unique ref (I'll be storing these ref's in an array). Thanks, D Then as Tomm says you don't need that.You just Let MyCloneRef := PlaceAtMe 7 1 and then Let MyArray[someindex] := MyCloneRef Link to comment Share on other sites More sharing options...
Demeggy Posted February 9, 2015 Author Share Posted February 9, 2015 That's not the way I used SetRefVariable. I used that when I buildref something, not when I had to refer to something inside my own mod. Am I missing something?It should basically create a new ref for the player clone, as I eventually want to be able to utilise multiple clones of the player, each with their own unique ref (I'll be storing these ref's in an array). Thanks, D Then as Tomm says you don't need that.You just Let MyCloneRef := PlaceAtMe 7 1 and then Let MyArray[someindex] := MyCloneRef That's so beautifully simple, it's bound to work :) Thanks, I'll give it a shot and post back my findings! D Link to comment Share on other sites More sharing options...
Gribbleshnibit8 Posted February 13, 2015 Share Posted February 13, 2015 When reading function descriptions on GECK wiki, NVSE docs or whatever, when a parameter is in italics then it means it's optional. For NVSE there are a LOT of functions that can be called two ways: reference.FunctionName param1 param2 reference and param2 are in this case probably interchangeable. if you call it in the form: reference.FunctionName param1then you're calling it on a reference in the manner of say: refVar.SetWeaponAmmo Ammo10mmIf you say: FunctionName param1 param2then you're calling it in the way of: SetWeaponAmmo Ammo10mm WeapNV9mmThe first way is called "Calling by reference" and has a few extra rules. The second is "Calling by base" and applies to all forms of that type, the base form. When calling by reference, you have a few methods to work with. You can call by ref variable from a quest script or some other object script, or you can call from a script that runs on the object. http://www.gribbleshnibit.com/projects/NVSEDocs/#Function_Calling_Convention Link to comment Share on other sites More sharing options...
Recommended Posts