Quick Questions -- Quick Answers, The 21st

Post » Thu May 19, 2011 1:55 pm

Returns the FormID of the key to target door/container
or
Returns if the door/container was unlocked via key or via lockpick/spell
GetOpenKey (obse) will tell you the key associated with a reference.

For the other one, I think you'd need to be able to script the door in question to flag it when the lockpicking menu is used, or to detect an "unlock" spell effect.
User avatar
Monika
 
Posts: 3469
Joined: Wed Jan 10, 2007 7:50 pm

Post » Thu May 19, 2011 9:55 pm

Is it possible to play a sound when an actor is hit by a particular weapon ?

I have this script on the weapon, but it doesn't work...

SCN FFweapontestBegin OnHitPlaySound aaaShiveringEnd


The sound plays OK when triggered by an activator. Is it possible to use an Onhit like this ?
User avatar
Mrs shelly Sugarplum
 
Posts: 3440
Joined: Thu Jun 15, 2006 2:16 am

Post » Fri May 20, 2011 1:12 am

Is there a script that will making the target attack a certain faction after casting a spell on them?
User avatar
David Chambers
 
Posts: 3333
Joined: Fri May 18, 2007 4:30 am

Post » Thu May 19, 2011 11:15 pm

The sound plays OK when triggered by an activator. Is it possible to use an Onhit like this ?
OnHit only works on actors.

Might need a magic effect, or some form of "isattacking" detection. Maybe someone else knows for sure.
User avatar
Teghan Harris
 
Posts: 3370
Joined: Mon Mar 05, 2007 1:31 pm

Post » Thu May 19, 2011 11:52 pm

Is there any way to extract a single file from a BSA from the command line (e.g. from a batch script)? TES4BSA and BSA commander seem to only extract an entire archive by command line, single file extraction seems possible only with graphical windows interface (no good for a script).
User avatar
Christine
 
Posts: 3442
Joined: Thu Dec 14, 2006 12:52 am

Post » Fri May 20, 2011 2:32 am

Is there a limit to a user function's size, or do they have other limitations that aren't mentioned on the CS Wiki? (By that I mean, does it stop running if a certain number of lines is exceeded?) I have moved a huge piece of code to a function to save space, but for some ungodly reason processing stops halfway through. I've tried narrowing down the possibilities, but there doesn't seem to be anything wrong.
User avatar
sam
 
Posts: 3386
Joined: Sat Jan 27, 2007 2:44 pm

Post » Thu May 19, 2011 10:24 pm

Is there a limit to a user function's size, or do they have other limitations that aren't mentioned on the CS Wiki? (By that I mean, does it stop running if a certain number of lines is exceeded?) I have moved a huge piece of code to a function to save space, but for some ungodly reason processing stops halfway through. I've tried narrowing down the possibilities, but there doesn't seem to be anything wrong.

As far as I know, the only limit is the usual script size limit.

I have a very large piece of code that I split into 4 user functions (each at the size limit) and they work fine
User avatar
Mackenzie
 
Posts: 3404
Joined: Tue Jan 23, 2007 9:18 pm

Post » Fri May 20, 2011 3:36 am

That's what I was afraid of. Now I'll have to dig through my code again. :P But it's better than not being able to use user functions at all, I suppose.
User avatar
Sunnii Bebiieh
 
Posts: 3454
Joined: Wed Apr 11, 2007 7:57 pm

Post » Thu May 19, 2011 4:38 pm

OnHit only works on actors.

Might need a magic effect, or some form of "isattacking" detection. Maybe someone else knows for sure.


That's not a problem, I want it to work only on actors. I just used the same script with OnActivate to test if the (custom) sound plays alright. It does but once I replace it with OnHit it doesn't play the sound if you hit an actor...

EDIT: Ok, it works now when I do it as an enchantment. Thanks for the advice! Now I know what OnHit actually does... :hubbahubba:
User avatar
K J S
 
Posts: 3326
Joined: Thu Apr 05, 2007 11:50 am

Post » Thu May 19, 2011 10:17 pm

That's not a problem, I want it to work only on actors. I just used the same script with OnActivate to test if the (custom) sound plays alright. It does but once I replace it with OnHit it doesn't play the sound if you hit an actor...

The point here is that the script will not work on a weapon, only on an actor. I.e OnHit is attached to an actor and fires when he gets hit by something, rather than being attached to a weapon and firing when it does the hitting. If you want to attach a script to a weapon, you need a different method, maybe ScriptEffectStart with an enchantment.
User avatar
David Chambers
 
Posts: 3333
Joined: Fri May 18, 2007 4:30 am

Post » Thu May 19, 2011 7:04 pm

OnHit refers to the item the script is attached to.

Using it in a script on the weapon, it will only play if you hit the weapon with something. Well, actually, that wouldn't work either because Onhit only works on actors.

OnHit basically means "When something hits me", not "When I hit something".
User avatar
Janine Rose
 
Posts: 3428
Joined: Wed Feb 14, 2007 6:59 pm

Post » Thu May 19, 2011 11:06 pm

GetOpenKey (obse) will tell you the key associated with a reference.


Ah, that may prove helpful. I'm trying to run a script whenever you unlock a chest or door in the game (that either doesn't run when you use the key, or is ignored when you use the key) like this;
whenever the player successfully unlocks (via lockpick or magic, not key) there is an X% chance that it will have a deadbolt, in which case the only way to open it will be with a prybar tool. The prybar can only open deadbolts, and can result in the following possibilities based on Luck and Security; opens lock, doesn't open lock and you drop the prybar, the lock doesn't open and you injure yourself, or the lock doesn't open and the prybar breaks (small chance of the last three). No matter which happens there will be a noise that alerts NPC's within a very short distance that you opened a lock, and you will of course be in trouble if that lock was to a restricted area or someone elses chest. Players with high enough strength and hand to hand don't need a prybar to do what I just described.

I haven't yet figured any way to implement this properly though. Amongst my concerns is that in making there be a more complex lock on a shop door, it won't properly unlock in the mornings when the shop opens. Anyway, thank for your time!

CC
User avatar
Amanda savory
 
Posts: 3332
Joined: Mon Nov 27, 2006 10:37 am

Post » Fri May 20, 2011 1:32 am

Hi, simple question here, how do i get a custom topic to appear after a custom greeting? i madem some new greetings for NPC's in the rimmen mod and i made a new topic for them. i then clicked add topic and i added it to each of their topic lists but it doesnt show in game. what should i do or what have i forgotten to do? thx
User avatar
Valerie Marie
 
Posts: 3451
Joined: Wed Aug 15, 2007 10:29 am

Post » Fri May 20, 2011 1:52 am

Is there a way to force a leveled creature marker to spawn a new creature from its list?

I am trying to script something like Morrowind Comes Alive, where the NPC (spawned by a leveled creature list) has a random chance of dissapearing under certain conditions. When he disappears, though, I'd want the creature marker to spawn another NPC from its list to replace the one who disappeared.

Morrowind had a "Delete" command that basicly did this. It removed the reference from the world and spawned a new creature from the list when the player would leave the cell.

Thanks!
User avatar
Rach B
 
Posts: 3419
Joined: Thu Mar 08, 2007 11:30 am

Post » Thu May 19, 2011 3:13 pm

Nothing short of resetting the marker's parent cell.
User avatar
james kite
 
Posts: 3460
Joined: Sun Jul 22, 2007 8:52 am

Post » Fri May 20, 2011 2:25 am

Nothing short of resetting the marker's parent cell.


Thanks shadeMe!
I'll try to find a work around. :)
User avatar
stevie trent
 
Posts: 3460
Joined: Thu Oct 11, 2007 3:33 pm

Post » Thu May 19, 2011 5:16 pm

How do you make a merchant NOT wear armor and gear you sell him?
User avatar
Vivien
 
Posts: 3530
Joined: Fri Apr 13, 2007 2:47 pm

Post » Thu May 19, 2011 8:35 pm

Can you make a script to add a spell when a specific item is in the inventory (Fireball Spoon adds fireball spell when in inventory)?
User avatar
Emily Graham
 
Posts: 3447
Joined: Sat Jul 22, 2006 11:34 am

Post » Fri May 20, 2011 3:31 am

How do you make a merchant NOT wear armor and gear you sell him?
I think you just have to give him some really expensive clothing to wear. Make copies of cheap clothing, price them really high and put them in his inventory. See if that works.


Can you make a script to add a spell when a specific item is in the inventory (Fireball Spoon adds fireball spell when in inventory)?
Sure, just use an onAdd block and player.addspell
User avatar
Etta Hargrave
 
Posts: 3452
Joined: Fri Sep 01, 2006 1:27 am

Post » Thu May 19, 2011 8:52 pm

Hi, simple question here, how do i get a custom topic to appear after a custom greeting? i madem some new greetings for NPC's in the rimmen mod and i made a new topic for them. i then clicked add topic and i added it to each of their topic lists but it doesnt show in game. what should i do or what have i forgotten to do? thx

Can you clarify the "added it to each of their topic lists" bit?

In general, AddTopic makes a topic globally available, and you control who uses it with the conditions you add to it, usually with GetIsId to make it a specific NPC. So I always think in terms of adding the NPC restriction to the topic, rather than any kind of "adding the topic to the NPC". What are you doing?
User avatar
kitten maciver
 
Posts: 3472
Joined: Fri Jun 30, 2006 2:36 pm

Post » Fri May 20, 2011 1:08 am

I think you just have to give him some really expensive clothing to wear. Make copies of cheap clothing, price them really high and put them in his inventory. See if that works.

That doesn't make sense, the stock NPC's who buy/sell gear don't wear anything special. Maybe its a package flag on his merchant package to not wear armor or something.
User avatar
lacy lake
 
Posts: 3450
Joined: Sun Dec 31, 2006 12:13 am

Post » Thu May 19, 2011 11:07 pm

That doesn't make sense, the stock NPC's who buy/sell gear don't wear anything special. Maybe its a package flag on his merchant package to not wear armor or something.

You probably need both. The Weapon unequipped and Armor unequipped flags will avoid those two categories, but if you sell clothing to them, the value comes into play. Nothing is going to happen until they evaluate their AI again, and most of the time they'll stay in the same UseItem or Wander package that they use while trading, but if they get into a fight with another NPC who comes into the shop, they may not go back to the same outfit afterward, which I assume you'd want.
User avatar
Mrs. Patton
 
Posts: 3418
Joined: Fri Jan 26, 2007 8:00 am

Post » Thu May 19, 2011 10:37 pm

If it's a custom NPC merchant, did you give him a merchant container?

Perhaps vanilla ones don't equip the gear because it goes into their container instead of their personal inventory?
User avatar
Lil'.KiiDD
 
Posts: 3566
Joined: Mon Nov 26, 2007 11:41 am

Post » Thu May 19, 2011 11:09 pm

Can you clarify the "added it to each of their topic lists" bit?

In general, AddTopic makes a topic globally available, and you control who uses it with the conditions you add to it, usually with GetIsId to make it a specific NPC. So I always think in terms of adding the NPC restriction to the topic, rather than any kind of "adding the topic to the NPC". What are you doing?

well ive got a topic, i want to use for the people in the city of Rimmen mod. i meant added the topic by right clicking the little topics box at the right of the quest editor and choosing add topic then choosing my topic. i cant find faction anywhere in the fxn parametres box, can we not choose that? to the end of your response how would i restrict an NPC from saying a topic, by using the conditions box to choose getisID? thx for the help :)
User avatar
NAkeshIa BENNETT
 
Posts: 3519
Joined: Fri Jun 16, 2006 12:23 pm

Post » Thu May 19, 2011 3:49 pm

well ive got a topic, i want to use for the people in the city of Rimmen mod. i meant added the topic by right clicking the little topics box at the right of the quest editor and choosing add topic then choosing my topic. i cant find faction anywhere in the fxn parametres box, can we not choose that? to the end of your response how would i restrict an NPC from saying a topic, by using the conditions box to choose getisID? thx for the help :)


Adding the topics via the "AddTopics" box on the right is not recommended. Actually it messes up something, though I do not remember what.
When you want to add new topics, the best thing to do is to type the following line in the "Result Script" box:

AddTopic XXXXXXX

The XXXXX represent the topic ID, that you typed when you created the new topic.

If the dialogue is something said by all of your city's citizens, you have to create a new Faction (Rimmen Citizens, for example) and put all inhabitants in it. (If not done already)
Then, in your custom topic dialogue, the condition's name is "GetInFaction". You then select your Rimmen Citizens faction, and set it to 1.

If you want to restrict some NPCs to not have your topic available, add another condition:

GetIsId XXXXXXX == 0

Where XXXX is your NPC's ID Name.

If you do this, make sure the GetInFaction condition is set to "AND"
If you have more than one specific NPC you want to impose the same restriction, put the "OR" setting on every "GetIsID" condition.


Though if you want to have certain NPCs say something different, simply create a new dialogue line and impose the "GetIsID" condition, setting it the NPC's name and putting to "1".
Make sure that dialogue lines with the GetIsID condition are ordered at the top of the topic's dialogue lines. The game reads from top to bottom when it checks for conditions.
User avatar
TRIsha FEnnesse
 
Posts: 3369
Joined: Sun Feb 04, 2007 5:59 am

PreviousNext

Return to IV - Oblivion