The Nexus Forums: Oblivion script variable help - The Nexus Forums

Jump to content

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Oblivion script variable help

#1 User is offline   dontpanic 

  • Regular
  • PipPip
  • Group: Members
  • Posts: 78
  • Joined: 18-May 08

Posted 19 November 2009 - 12:02 AM

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?
0

#2 User is offline   David Budreck 

  • Fan
  • Icon
  • Group: Premium Member
  • Posts: 354
  • Joined: 11-June 08

Posted 20 November 2009 - 02:12 AM

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.
0

#3 User is offline   dontpanic 

  • Regular
  • PipPip
  • Group: Members
  • Posts: 78
  • Joined: 18-May 08

Posted 20 November 2009 - 11:16 PM

View Postdavidbudreck, on Nov 20 2009, 02:12 AM, said:

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?
0

#4 User is offline   David Budreck 

  • Fan
  • Icon
  • Group: Premium Member
  • Posts: 354
  • Joined: 11-June 08

Posted 20 November 2009 - 11:43 PM

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.elderscrol...x.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.
0

#5 User is offline   dontpanic 

  • Regular
  • PipPip
  • Group: Members
  • Posts: 78
  • Joined: 18-May 08

Posted 24 November 2009 - 12:35 AM

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 ID
scn 1CCtestScript

Short NPCFollow
Short NPCStay


Result script in dioluag
Set NPCReferenceID.NPCFollow to 1

0

#6 User is offline   David Budreck 

  • Fan
  • Icon
  • Group: Premium Member
  • Posts: 354
  • Joined: 11-June 08

Posted 24 November 2009 - 12:42 AM

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.
0

#7 User is offline   dontpanic 

  • Regular
  • PipPip
  • Group: Members
  • Posts: 78
  • Joined: 18-May 08

Posted 25 November 2009 - 03:54 AM

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".
0

#8 User is online   Pronam 

  • Member
  • Icon
  • Group: Premium Member
  • Posts: 2,880
  • Joined: 10-November 04

Posted 25 November 2009 - 04:15 AM

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.
0

#9 User is offline   David Budreck 

  • Fan
  • Icon
  • Group: Premium Member
  • Posts: 354
  • Joined: 11-June 08

Posted 26 November 2009 - 07:18 PM

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
ENDIF
End ; GameMode

Actually much simpler and far less trouble in the long run.
0

#10 User is offline   dontpanic 

  • Regular
  • PipPip
  • Group: Members
  • Posts: 78
  • Joined: 18-May 08

Posted 28 November 2009 - 11:29 PM

View Postdavidbudreck, on Nov 26 2009, 07:18 PM, said:

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
ENDIF
End ; GameMode

Actually much simpler and far less trouble in the long run.


I will try this as soon as I get home.
0

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Skin by Skinbox
Quality & cheap IPB skins, premade vBulletin styles, cheap Web templates and more! - Skinbox