Quick Question -- Quick Answer, Part Fourteen

Post » Fri May 27, 2011 7:11 am

That might just be - You can't activate a base object. Your alternative - Have a remote copy of the book out side a container and activate it. If you plan on doing so dynamically, create placeAtMe refs and collect their refIDs. Once the player exits the book menu, use OBSE's deleteReference function to destroy the object.


thanks guys!

I knew that there was a command for removing the reference but I couldn't remember it, I kept searching for DestroyRef :)

thanks again, this is exactly what I needed.
a
User avatar
jessica sonny
 
Posts: 3531
Joined: Thu Nov 02, 2006 6:27 pm

Post » Fri May 27, 2011 9:27 am

GAHHHH!!!!! Ok seriously? How do you not get NPCs to follow the player. I have a basic companion NPC in a custom worldspace. Whenever I tell him to wait he still follows me only he now says I'm trespassing. This has me at my wit's end! I tired adding them to the player faction and it doesn't work, tried putting responsibility down, doesn't work. Really can someone help me with this??
User avatar
HARDHEAD
 
Posts: 3499
Joined: Sun Aug 19, 2007 5:49 am

Post » Fri May 27, 2011 9:19 am

That might just be - You can't activate a base object. Your alternative - Have a remote copy of the book out side a container and activate it. If you plan on doing so dynamically, create placeAtMe refs and collect their refIDs. Once the player exits the book menu, use OBSE's deleteReference function to destroy the object.

Thanks again Shademe, this did exactly what I needed. I have a question on DeleteReference that I posted in OBSE, but I think it is just ke not understanding the mechanics of that command.

Thanks again!
A
User avatar
Abi Emily
 
Posts: 3435
Joined: Wed Aug 09, 2006 7:59 am

Post » Fri May 27, 2011 11:11 am

Is it possible to check a quest script from one quest, in another quest?
User avatar
Tamara Primo
 
Posts: 3483
Joined: Fri Jul 28, 2006 7:15 am

Post » Fri May 27, 2011 12:38 am

I have a question about my http://planetelderscrolls.gamespy.com/View.php?view=OblivionMods.Detail&id=265498&id=5052 mod. Many people don't like the renaming feature, where i renamed renamed longswords into swords and caymores into longswords. Is there any way to undo this? I guess it is impossible with CS (except if i would manually rename everything back, which would take a lot of time), but what about other programs? Is TES4Edit or TES Gecko capable of undoing?

Anyone?
User avatar
Kelly Tomlinson
 
Posts: 3503
Joined: Sat Jul 08, 2006 11:57 pm

Post » Thu May 26, 2011 8:59 pm

GAHHHH!!!!! Ok seriously? How do you not get NPCs to follow the player. I have a basic companion NPC in a custom worldspace. Whenever I tell him to wait he still follows me only he now says I'm trespassing. This has me at my wit's end! I tired adding them to the player faction and it doesn't work, tried putting responsibility down, doesn't work. Really can someone help me with this??


Still getting this. Also how can I set a quest variable with a script. I can't seem to get it to work.
User avatar
Sarah Edmunds
 
Posts: 3461
Joined: Sat Jul 08, 2006 8:03 pm

Post » Fri May 27, 2011 1:00 am

Is there an OBSE command to get the last item the Player tried to equip (even if it is a potion/cannot be equipped item)?
User avatar
DarkGypsy
 
Posts: 3309
Joined: Tue Jan 23, 2007 11:32 am

Post » Fri May 27, 2011 10:56 am

Ok I seriously am being driven insane now. I think may have figured out that silly following the player thing. But now I need to change a quest variable and the CS says it;s an unknown variable. I copied the variable directly from the original script just to be sure and still won't let me. I've changed quest variables before but now it doesn't seem to want me to.

How do you change quest variables from another script??

I NEED to know how. Or else I'll have to a lot of rethinking to do.
User avatar
TIhIsmc L Griot
 
Posts: 3405
Joined: Fri Aug 03, 2007 6:59 pm

Post » Fri May 27, 2011 4:44 am

When setting a variable in another quest script you need to qualify with the quest name not the script name (assuming they're different). I.e "Set Questname.Var to value" rather than "Set QuestnameScript.Var to value"
User avatar
Luis Reyma
 
Posts: 3361
Joined: Fri Nov 02, 2007 11:10 am

Post » Fri May 27, 2011 11:11 am

Is there an OBSE command to get the last item the Player tried to equip (even if it is a potion/cannot be equipped item)?

No. Can be added if it would be useful to you.
User avatar
Bambi
 
Posts: 3380
Joined: Tue Jan 30, 2007 1:20 pm

Post » Fri May 27, 2011 1:30 am

When setting a variable in another quest script you need to qualify with the quest name not the script name (assuming they're different). I.e "Set Questname.Var to value" rather than "Set QuestnameScript.Var to value"


Thanks :D
User avatar
Connor Wing
 
Posts: 3465
Joined: Wed Jun 20, 2007 1:22 am

Post » Fri May 27, 2011 7:24 am

No. Can be added if it would be useful to you.


It could be, but right now I only need it for one, relatively small idea, so feel free to leave it out if no-one else has a use for it.
User avatar
latrina
 
Posts: 3440
Joined: Mon Aug 20, 2007 4:31 pm

Post » Thu May 26, 2011 9:04 pm

How do I stop container menus appearing before messageboxes in OnActivate scripts?

e.g. "Opened the Chest with a Key" gets hidden by the actual chest inventory, stopping the player from being able to do anything.
User avatar
IM NOT EASY
 
Posts: 3419
Joined: Mon Aug 13, 2007 10:48 pm

Post » Thu May 26, 2011 10:23 pm

I have a question about my http://planetelderscrolls.gamespy.com/View.php?view=OblivionMods.Detail&id=265498&id=5052 mod. Many people don't like the renaming feature, where i renamed renamed longswords into swords and caymores into longswords. Is there any way to undo this? I guess it is impossible with CS (except if i would manually rename everything back, which would take a lot of time), but what about other programs? Is TES4Edit or TES Gecko capable of undoing?

In the CS, in the Open/Data Files menu, highlight your mod and hit Details. Select those items, and press Delete - this will remove all changes to those items (possibly not what you want, but I'm a bit unclear on how you went about doing the renaming). This is the standard practice for cleaning a mod. TES4Edit or TES Gecko could very well have more nuanced options - for only undoing the name changes - but I'm not sure. If you have skill with Python, and there are no other options, you could also write a Bash Script to do this for you...

Is there any way to have a section of code executed once per load without using OBSE functions?

Thanks

Not really, no. Why are you avoiding OBSE? Generally speaking, there are only an extremely limited set of reasons to do that...

How do I stop container menus appearing before messageboxes in OnActivate scripts?

e.g. "Opened the Chest with a Key" gets hidden by the actual chest inventory, stopping the player from being able to do anything.

Something like this:
Begin OnActivate player	MessageBox "Message" "OK"	set shortVar to 1EndBegin GameMode	if ( shortVar == 1 )		set buttonVar to GetButtonPressed		if ( buttonVar != -1 ) ; a button has been pressed			set shortVar to 0			Activate player		endif	endifEnd
Basically, don't call Activate until after they've hit the button.
User avatar
Jesus Lopez
 
Posts: 3508
Joined: Thu Aug 16, 2007 10:16 pm

Post » Fri May 27, 2011 12:55 am

Something like this:
Begin OnActivate player	MessageBox "Message" "OK"	set shortVar to 1EndBegin GameMode	if ( shortVar == 1 )		set buttonVar to GetButtonPressed		if ( buttonVar != -1 ); a button has been pressed			set shortVar to 0			Activate player		endif	endifEnd
Basically, don't call Activate until after they've hit the button.


The "OK" button in one case is on the default "Opened the box with a key" message that oblivion gives on Needs a Key chests, so I don't have any control over the message box (as far as I know), so I'm still stuck on that one.

But that script will help in another case, thank you!
User avatar
Josh Lozier
 
Posts: 3490
Joined: Tue Nov 27, 2007 5:20 pm

Post » Fri May 27, 2011 9:27 am

Not really, no. Why are you avoiding OBSE? Generally speaking, there are only an extremely limited set of reasons to do that...

Not avoiding it; all my mods do/will use OBSE.

The piece of code that I wanted to run once per load, was to detect whether OBSE was installed. Obviously if OBSE isn't there I can't use GetGameLoaded.
User avatar
Julie Serebrekoff
 
Posts: 3359
Joined: Sun Dec 24, 2006 4:41 am

Post » Thu May 26, 2011 8:56 pm

Not avoiding it; all my mods do/will use OBSE.

The piece of code that I wanted to run once per load, was to detect whether OBSE was installed. Obviously if OBSE isn't there I can't use GetGameLoaded.

There are several ways to do that. I know haama has an example posted somewhere, don't have a link though.
Thieves Arsenal uses a quest stage result script. Don't remember exactly how it's set up, something like
scn QuestSCRshort IsOBtikstalledbegin gamemode  if IsOBtikstalled == 0	setstage Quest 10	if IsOBtikstalled == 0	  MessageBox "OBSE isn't installed, blah blah blah, Oblivion will now close."	  player.disable; there are probably more elegant ways of doing this	endif  endifend; stage 10 result scriptGetOBSEVersion; if OBSE is not installed, the following line will not executeSet Quest.IsOBtikstalled to 1

Except there's something in there to reset IsOBtikstalled so the stage script executes when the game is restarted. I'd have to go back and look at the script, it's been a long time.
User avatar
naomi
 
Posts: 3400
Joined: Tue Jul 11, 2006 2:58 pm

Post » Thu May 26, 2011 8:38 pm

Hi I need a little dialogue help here. I'm trying to get my custom NPC to say one thing if the player does NOT have a certain book in his/her inventory, and then say a different thing when the player DOES have the book. So my setup looks like this under the Topics tab:

INFO
What the NPC says if the player has the book | (no flags) | # responses: 7 | LarryTheNPCWhat the NPC says if player does NOT have book | (no flags) | # responses: 1 | LarryTheNPC


-skipping down to the bottom-

CONDITIONS FOR 1ST INFO LINE
(no target) | Funct Name: GetItemCount | Funct Info: Book 'MyBook' | Comp: == | Value: 1 | AND(no target) | Funct Name: GetIsID | Funct Info: LarryTheNPC | Comp: == | Value: 1 | AND


CONDITIONS FOR 2ND INFO LINE
(no target) | Funct Name: GetItemCount | Funct Info: Book 'MyBook' | Comp: == | Value: 0 | AND (no target) | Funct Name: GetIsID | Funct Info: LarryTheNPC | Comp: == | Value: 1 | AND


So I add the book to my inventory in game and talk to the NPC but he ALWAYS says the 2nd line, the one if the player does NOT have the book, even though it is clearly in my inventory. Can anyone see something I'm doing wrong? I thought I understood the Condition box for dialogue, but maybe not. Is it actually checking the NPC's inventory for the book or the player's?

Thanks for any help.
User avatar
Dark Mogul
 
Posts: 3438
Joined: Tue Feb 20, 2007 11:51 am

Post » Thu May 26, 2011 9:42 pm

Hi I need a little dialogue help here. I'm trying to get my custom NPC to say one thing if the player does NOT have a certain book in his/her inventory, and then say a different thing when the player DOES have the book. So my setup looks like this under the Topics tab:

INFO
What the NPC says if the player has the book | (no flags) | # responses: 7 | LarryTheNPCWhat the NPC says if player does NOT have book | (no flags) | # responses: 1 | LarryTheNPC


-skipping down to the bottom-

CONDITIONS FOR 1ST INFO LINE
(no target) | Funct Name: GetItemCount | Funct Info: Book 'MyBook' | Comp: == | Value: 1 | AND(no target) | Funct Name: GetIsID | Funct Info: LarryTheNPC | Comp: == | Value: 1 | AND


CONDITIONS FOR 2ND INFO LINE
(no target) | Funct Name: GetItemCount | Funct Info: Book 'MyBook' | Comp: == | Value: 0 | AND (no target) | Funct Name: GetIsID | Funct Info: LarryTheNPC | Comp: == | Value: 1 | AND


So I add the book to my inventory in game and talk to the NPC but he ALWAYS says the 2nd line, the one if the player does NOT have the book, even though it is clearly in my inventory. Can anyone see something I'm doing wrong? I thought I understood the Condition box for dialogue, but maybe not. Is it actually checking the NPC's inventory for the book or the player's?

Thanks for any help.

It is probably checking the NPC's inventory.
You need to check the "Run on Target" box for the GetItemCount conditions. This makes the condition run on the person the NPC is speaking to.
User avatar
Nathan Barker
 
Posts: 3554
Joined: Sun Jun 10, 2007 5:55 am

Post » Fri May 27, 2011 12:54 am

Is there a function to run another script?
User avatar
Jynx Anthropic
 
Posts: 3352
Joined: Fri Sep 08, 2006 9:36 pm

Post » Thu May 26, 2011 10:36 pm

Is there a function to run another script?

Not a function per se but several ways to run scripts or bits of scripts on demand:
-Stick code in a quest stage result script, use SetStage to run the code immediately
-Stick code in a dialog result script, use Say to run immediately
-Stick code in an OnActivate block of a script attached to a persistent ref, use ref.Activate someOtherRef 1 to run it
-Use OBSE's http://www.obse.silverlock.org/obse_command_doc.html#UserDefinedFunctions
User avatar
Nienna garcia
 
Posts: 3407
Joined: Wed Apr 25, 2007 3:23 am

Post » Fri May 27, 2011 2:16 am

Not a function per se but several ways to run scripts or bits of scripts on demand:
-Stick code in a quest stage result script, use SetStage to run the code immediately
-Stick code in a dialog result script, use Say to run immediately
-Stick code in an OnActivate block of a script attached to a persistent ref, use ref.Activate someOtherRef 1 to run it
-Use OBSE's http://www.obse.silverlock.org/obse_command_doc.html#UserDefinedFunctions

Correct me if I'm wrong, but it looks like the first three are all variations of "Add code to event, trigger event" which makes the piece of code run independently, whereas the user defined function is part of the script and can provide a result that you can test, a rather different beast, and potentially more useful.

@Uglulyx: what are you trying to do here? If it's code re-use (do the same as I did in that other script) then the User Defined Function is appropriate, especially if there are variable elements involved. E.g. do the same thing, but do it to a different target.
User avatar
Brandi Norton
 
Posts: 3334
Joined: Fri Feb 09, 2007 9:24 pm

Post » Thu May 26, 2011 10:38 pm

@Uglulyx: what are you trying to do here? If it's code re-use (do the same as I did in that other script) then the User Defined Function is appropriate, especially if there are variable elements involved. E.g. do the same thing, but do it to a different target.


I want to run a script separately to save FPS, I want to d this because the script is currently 200 lines. Way too much for a gamemode script.

Also: My CS seems to be acting odd. Whenever I try to save a script and then close the script window. Then it asks if I'd like to save the script so I hit yes and the window stays open, it does this until I click no.
User avatar
Alyce Argabright
 
Posts: 3403
Joined: Mon Aug 20, 2007 8:11 pm

Post » Fri May 27, 2011 7:18 am

Correct me if I'm wrong, but it looks like the first three are all variations of "Add code to event, trigger event" which makes the piece of code run independently, whereas the user defined function is part of the script and can provide a result that you can test, a rather different beast, and potentially more useful.

Depends on the application and whether or not you want to use OBSE. I am admittedly biased.
I want to run a script separately to save FPS, I want to d this because the script is currently 200 lines. Way too much for a gamemode script.

Also: My CS seems to be acting odd. Whenever I try to save a script and then close the script window. Then it asks if I'd like to save the script so I hit yes and the window stays open, it does this until I click no.

Length of a script doesn't directly correlate with its impact on performance, and sticking bits of it in other scripts doesn't help if those bits get called frequently anyway.
The best way to keep bits of your script from running unnecessarily is to structure it properly e.g.
if (some condition which is only true sometimes)  big long bunch of codeendif


There are a few syntax errors which the script editor will not display a message for but nevertheless prevent you from closing the editor window.
Look for mismatched parentheses. If the problem persists post the script.


EDIT: http://www.gamesas.com/bgsforums/index.php?showtopic=1027524#
User avatar
Ysabelle
 
Posts: 3413
Joined: Sat Jul 08, 2006 5:58 pm

Previous

Return to IV - Oblivion