dontpanic Posted November 19, 2009 Share Posted November 19, 2009 I am trying to make a disabled NPC enable and follow the player after a topic is finished using a result script. I cant seem to modify variable and change certain thing via the result script. I am able to do other things though like "Setstage TestQuest to 1" and "player.additem 0000000f 20" etc JohnDoeREF.Enable Set JohnDoeREF.Follow to 1 When I use the above script it keeps telling me it wont work. I was using exapmlles from the official constructionset Wiki. Can someone tell me what I am doing wrong? Link to comment Share on other sites More sharing options...
DavidBudreck Posted November 20, 2009 Share Posted November 20, 2009 What Variable are you trying to set here? "Follow"? If "Follow" is a variable in JohnDoe's script that when set makes him follow you by using an AI Package, then you would reference the variable using the script name, not the reference. Set JohnDoesScript.Follow to 1. Link to comment Share on other sites More sharing options...
dontpanic Posted November 20, 2009 Author Share Posted November 20, 2009 What Variable are you trying to set here? "Follow"? If "Follow" is a variable in JohnDoe's script that when set makes him follow you by using an AI Package, then you would reference the variable using the script name, not the reference. Set JohnDoesScript.Follow to 1. JohnDoe was the name of the reference NPC. So I have to add Script in there for it to work? Link to comment Share on other sites More sharing options...
DavidBudreck Posted November 20, 2009 Share Posted November 20, 2009 Not necessarily. There are other ways of doing it, but then the question is no longer about setting variables; it then becomes AI Packages. There is probably already an existing AI Package that would do exactly what you want, that is, follow the player. Step one would be to look through the existing AI Packages till you find one that suits you, or make a new one. Edit JohnDoe and give him that AI package. Then, in whatever script you want, you tell JohnDoe's Reference to use that AI Package. Check the WIKI for specifics on whatever you are not sure about. http://cs.elderscrolls.com/constwiki/index.php/Main_Page I've only done that once or twice, but I've seen it done lots of times. You can look at the Thieves' Guild Elven Maiden Quest (TG03elven). After Hieronymus Lex finds the bust that the player plants in the cupboard, Myvryna Arano follows him off to prison. Link to comment Share on other sites More sharing options...
dontpanic Posted November 24, 2009 Author Share Posted November 24, 2009 I am still getting nowhere with calling variable and modifying them in result scripts. I really do not know what I am doing wrong. I can show an example of what I am doing though. Script attached to a specific NPC with refrence IDscn 1CCtestScript Short NPCFollow Short NPCStay Result script in dioluagSet NPCReferenceID.NPCFollow to 1 Link to comment Share on other sites More sharing options...
DavidBudreck Posted November 24, 2009 Share Posted November 24, 2009 The variable is attached to the script, not the NPC Reference. So, it should be: Set 1CCtestScript.NPCFollow to 1 I presume you've got something else going on when NPCFollow == 1, because that variable in and of itself is not going to make the NPC follow you. To make them follow somebody, you need to use an AI Package with whomever you want to be followed as the target. Link to comment Share on other sites More sharing options...
dontpanic Posted November 25, 2009 Author Share Posted November 25, 2009 Yes I have the AI package conditions set for the variable. This is the error I get. Script "Defualtcompiler" , Line 1:Unknown variable "1CCtestScript.NPCFollo". Link to comment Share on other sites More sharing options...
Pronam Posted November 25, 2009 Share Posted November 25, 2009 You need to target the NPC-ref as every NPC with that script will have their own version. The variable is attached to the version of the script that the NPC-reference has :).. Now I've read the rest. If Joe is just activated you don't need any conditions to let him follow the player.You simple create a 'Follow'-package and set the player as the target (Using the Abandoned Mine and Player-Ref) What you need to worry about is when to let him stop following you..you'll need a condition for that one.Is that going to happen in the first place? Why is he following the player, when will that end? These questions tell what to fill in and what do to if you want to let the package end.You've stated a follow and stay, so I reckon he can be ordered to do so. You don't need to do all any difficult though. You can simply put a Wait on a follow package.Check Ilend Vonius of the main quest for that. You simply use Wait and StopWaiting for that specific package at the resultscript of the orders to let him stop and start following again. So JohnDoe doesn't really need a script unless you want things to happen for other reasons. Link to comment Share on other sites More sharing options...
DavidBudreck Posted November 26, 2009 Share Posted November 26, 2009 Hmmm. I'm sorry, I have never actually tried setting a variable attached to an NPC like that. Nothing should not be this much trouble. The CS is a bear to work with. Instead of continuing to bang your head against the wall, just code around it. Try creating an activator in the room where the action takes place. Then, you don't have to worry about setting a variable in a forign script. Something Like this... Short Follow Begin GameMode IF <whatever is supposed to trigger the event> && Follow == 0 Set Your AI Packages Here Set Follow to 1 ENDIFEnd ; GameMode Actually much simpler and far less trouble in the long run. Link to comment Share on other sites More sharing options...
dontpanic Posted November 28, 2009 Author Share Posted November 28, 2009 Hmmm. I'm sorry, I have never actually tried setting a variable attached to an NPC like that. Nothing should not be this much trouble. The CS is a bear to work with. Instead of continuing to bang your head against the wall, just code around it. Try creating an activator in the room where the action takes place. Then, you don't have to worry about setting a variable in a forign script. Something Like this... Short Follow Begin GameMode IF <whatever is supposed to trigger the event> && Follow == 0 Set Your AI Packages Here Set Follow to 1 ENDIFEnd ; GameMode Actually much simpler and far less trouble in the long run. I will try this as soon as I get home. Link to comment Share on other sites More sharing options...
Recommended Posts