Quick Questions -- Quick Answers, The Seventeenth

Post » Thu May 26, 2011 10:01 pm

What is the best way to check if the NPC you're in dialog with is a merchant?

I consider using OBSE's GetServicesMask funtion, and then use the result and make a LogicalAnd with 13727 (all service flags except Spells, Training, Recharge and Repair) - or simply calling all the relevant OffersXXX functions and assuming he is a merchant if at least one returns true.

But is there a simpler way of finding out if he is a merchant?


GetServices would be best way for Modded Merchants, Since there are some merchants that do not have services until they are activated once again.

For Vanilla Merchants you could just use GetisClass "MerchantTrader" for example and ref them in script.
User avatar
sally R
 
Posts: 3503
Joined: Mon Sep 25, 2006 10:34 pm

Post » Fri May 27, 2011 9:47 am

Too bad nobody answered my previous question, I'll try with something more practical.
I'm trying to make a script that will add crime gold to your character if you try to sell something "illegal", but I don't know how to force an exit of the bartering menu or some way to avoid the sell to take place. Is there some way? Also, what's better or less prone to conflicts, using modcrimegold or setcrimegold?
Use modCrimeGold.

IIRC, there isn't a method to detect stolen items inside an inventory.
User avatar
Kelly James
 
Posts: 3266
Joined: Wed Oct 04, 2006 7:33 pm

Post » Fri May 27, 2011 1:54 am

GetParentCell returns the ObjectID of the cell the reference is in.

Can this be passed to PositionCell in place of the cell name?

I'll try this tomorrow anyway, but thought I'd ask.
User avatar
Rachel Cafferty
 
Posts: 3442
Joined: Thu Jun 22, 2006 1:48 am

Post » Thu May 26, 2011 11:46 pm

GetParentCell returns the ObjectID of the cell the reference is in.

Can this be passed to PositionCell in place of the cell name?
I suppose so. Most vanilla functions support the use of a ref. variable as a pointer.
User avatar
KRistina Karlsson
 
Posts: 3383
Joined: Tue Jun 20, 2006 9:22 pm

Post » Fri May 27, 2011 5:57 am

Yes!

I decided to go ahead and give it a try before going to bed, and it solved my issue of having to change x/y coordinates into offsets.

Which was weird, because last time I had to change an offset into x/y coordinates.

Oblivion isn't very cooperative sometimes, is it?
User avatar
Rudy Paint fingers
 
Posts: 3416
Joined: Sun Nov 11, 2007 1:52 am

Post » Fri May 27, 2011 9:25 am

GetServices would be best way for Modded Merchants, Since there are some merchants that do not have services until they are activated once again.
I guess you're talking Tamriel Travellers here. Are they of one of the normal merchant classes, but without offering any services for some periods? If so, checking for merchant classes is probably good enough, as it is more important in Enhanced Economy to catch all merchants than to avoid false positives. The false positives only results in EE calculating and storing new barter gold for that NPC even if it cannot trade. And this data will be reset if the NPC isn't activated again within the reset period.

If they're not of one of the normal merchant classes, then I need additional checks (like seeing if the barter button is visible, or whether they offer relevant services), as it is highly important to not miss out on anyone that can be traded with.
User avatar
Lucie H
 
Posts: 3276
Joined: Tue Mar 13, 2007 11:46 pm

Post » Fri May 27, 2011 8:54 am

Have you considered adding a player controlled override? If someone encounter the zero gold bug with a particular merchant, they can select them in the console and run a command to force them to be added to the merchant list?

Might help them continue playing while you track down any further issues.
User avatar
Laura Mclean
 
Posts: 3471
Joined: Mon Oct 30, 2006 12:15 pm

Post » Thu May 26, 2011 10:09 pm

I guess you're talking Tamriel Travellers here.

If they're not of one of the normal merchant classes, then I need additional checks (like seeing if the barter button is visible, or whether they offer relevant services), as it is highly important to not miss out on anyone that can be traded with.


Correct Tamriel Travellers, custom class merchant's, not standard class merchants,

but their classes has services checked and set for each type of Class.

How Travellers works

Depending on what they are doing. Wandering, Eating, services are always activated in these packages.

It is when they are traveling from X to X Location is when services are not activated. Has barter does not work in travel packages.

But once you activate them - dialouge - the script kicks in and will change their aipackage from travel to wander package with Offer Services activated. And once you exit dialgoue will evp itself and travel packages will kick back in taking them to location has needed.

So I think no matter how you do in EE they will be covered either using GetServices or checking their class to see if services are offered will work for them.

Once again I am not a great scripter, so really not sure. But from what I have read it should work fine.

Corepc
User avatar
Shannon Lockwood
 
Posts: 3373
Joined: Wed Aug 08, 2007 12:38 pm

Post » Fri May 27, 2011 2:46 am

How do you make an NPC perform a specific animation? Not sure if that's a simple question.
User avatar
Angus Poole
 
Posts: 3594
Joined: Fri Aug 03, 2007 9:04 pm

Post » Thu May 26, 2011 11:54 pm

How do you make an NPC perform a specific animation? Not sure if that's a simple question.

The http://cs.elderscrolls.com/constwiki/index.php/Idle_Animations on the WIKI is a good place to start.
User avatar
T. tacks Rims
 
Posts: 3447
Joined: Wed Oct 10, 2007 10:35 am

Post » Fri May 27, 2011 10:16 am

Is an actor just NPCs or is it NPCs and creatures?
User avatar
Suzy Santana
 
Posts: 3572
Joined: Fri Aug 10, 2007 12:02 am

Post » Fri May 27, 2011 10:34 am

Sort of a doublecheck question, does the Small World flag for worldspaces determine if the world map stays in the same position regardsless of the player's position in the worldspace itself (only for parented worldspaces ofcourse)? Or does the map always move and it just seems like it doesn't due to the small size of most (small world) parented worldspaces? :unsure:Nvm, I found my anwser.
User avatar
Queen Bitch
 
Posts: 3312
Joined: Fri Dec 15, 2006 2:43 pm

Post » Fri May 27, 2011 5:41 am

Is an actor just NPCs or is it NPCs and creatures?


NPCs, creatures and the Player character are actors.
User avatar
Lori Joe
 
Posts: 3539
Joined: Tue Jun 20, 2006 6:10 am

Post » Fri May 27, 2011 8:51 am

I'm sure this has been asked/answered before but I couldn't find anything in a search.

What's the maximum number of items you can have in one container? I know the more items, the more lag you will get opening the inventory, but I was wondering if there's a fixed limit.
User avatar
Karine laverre
 
Posts: 3439
Joined: Tue Mar 20, 2007 7:50 am

Post » Fri May 27, 2011 2:22 am

Can someone write a spell script that has the effet of toggleing essential NPC off and removing the ability ABkingofdead
User avatar
Devin Sluis
 
Posts: 3389
Joined: Wed Oct 24, 2007 4:22 am

Post » Fri May 27, 2011 10:27 am

Okay, this pretty easy to fix, but the "why?" is bugging me.

http://i35.tinypic.com/2hn55pj.jpg

Quest script, acquires a few variables: player's position (current cell, xpos, ypos, zpos and rot = player rotation on z) and some calculated adjustments (trigrot = trig rotation adjustment of rot, rotmirror is a 180 twist from rot, xposmirror = a cosine offset from the player, yposmirror = a sine offset from the player) All the variables are listed in the image and appear correct.

Then it's fed into a PositionCell command: jawArmorStandRef.positioncell, xposmirror, yposmirror, zpos, rotmirror, yourcurrentcell

In the image you can see the x & y pos of where the stand ends up, which are correct, and the rotation (getangle z) which has mysteriously increased from 193.4529 to 11084.04, 57 times higher.

Easy enough to fix by using setangle, but why is it doing that? Am I missing something obvious about PositionCell?
User avatar
SamanthaLove
 
Posts: 3565
Joined: Mon Dec 11, 2006 3:54 am

Post » Fri May 27, 2011 6:53 am

What's the maximum number of items you can have in one container? I know the more items, the more lag you will get opening the inventory, but I was wondering if there's a fixed limit.

I don't remember any mention to a limit on the number of different items, but there is a limit on the number of items shown on inventory lists. If memory serves, it only shows the first 200 items or so.

. . . Am I missing something obvious about PositionCell?

Yup! 57.3 is the number! Any number you use for zRot gets multiplied by 57.3 by positionCell. A bug, of course, although I can't imagine why 57.3.
User avatar
Alessandra Botham
 
Posts: 3440
Joined: Mon Nov 13, 2006 6:27 pm

Post » Fri May 27, 2011 5:31 am

Yup! 57.3 is the number! Any number you use for zRot gets multiplied by 57.3 by positionCell. A bug, of course, although I can't imagine why 57.3.
Wow. That is weird. This is thoroughly confirmed enough to put on the wiki page?
User avatar
Silvia Gil
 
Posts: 3433
Joined: Mon Nov 20, 2006 9:31 pm

Post » Fri May 27, 2011 6:32 am

How do you set a secret door to open with a switch (in an ayleid ruin) do you parent the door to the switch then just use the switches default script (it's really weird cause it locks prison doors for some reason or am i using the wrong button)
User avatar
Emily Shackleton
 
Posts: 3535
Joined: Sun Feb 11, 2007 12:36 am

Post » Thu May 26, 2011 8:14 pm

An array is a series of variables that are stored together. So, for example, in a baseball game you could have an array of scores for each team in each inning - say, two arrays of nine integers. So you'd have Team1Score, which is an array, and Team1Score[0] is their score in the 1st inning, Team1Score[1] is their score in the 2nd inning, etc etc. Team2Score[0] would be the other team's score in the 1st, etc.

You could just have 18 variables - Team1Score1st, Team1Score2nd, etc. But what happens if the game goes to extra innings? You could have more variables defined, but you have a limit - however many you need. You could have 60 variables, 30 innings each; that will probably be enough (record for an MLB game is 26 innings), but now you have 42 variables more than you'll usually need. But when you have an array, you can just refer to Team1Score[9] for the 10th inning, and the code will create a slot for Team1Score[9] the first time you assign something to it (in Oblivion script; some programming languages require preparation of the slot first).

Further, you can refer to an inning with a variable. So instead of something like this to add a run to Team 1:
if ( inning == 1 )	set Team1Score1st to Team1Score1st + 1elseif ( inning == 2 )	set Team1Score2nd to Team1Score2nd + 1etc
You can just do this:
Team1Score[inning] = Team1Score[inning] + 1

This kind of just touching the tip of the iceberg; there's a lot more you can do with arrays. For example, you can have multidimensional arrays - like a table, perhaps. So you could actually just do Score[0][2] for Team 1's score in the 3rd.

The big thing to remember is that arrays start at 0. It can be easy to forget that.

OBSE arrays can also have things other than numbers as the "key", so you can do something like have an array called NPC, which stores a variety of information about an NPC, and then use NPC[name] to get its name, or NPC[lastSpokeTo] to get the time when you last spoke to them. Or whatever, it's up to you to define how they're used.

What you said about the array[0][1]: Des that mean I can have array[0] be a weapon reference and array[0][1] be the weapon reference's reach?
And how many variables are allowed per array?
User avatar
maria Dwyer
 
Posts: 3422
Joined: Sat Jan 27, 2007 11:24 am

Post » Fri May 27, 2011 6:52 am

What you said about the array[0][1]: Des that mean I can have array[0] be a weapon reference and array[0][1] be the weapon reference's reach?
No. but you can let array[0] be another array, array[0][0] be the weapon reference and array[0][1] the weapon's reach. Then array[1] be a new array that holds the reference and reach of the next weapon etc.

ex:

let array := ar_Construct Array

let array[0] := ar_Construct Array
let array[0][0] := myweapon1
let array[0][1] := weaponreach1

let array[1] := ar_Construct Array
let array[1][0] := myweapon2
let array[1][1] := weaponreach2

etc.

And how many variables are allowed per array?
Enough, I think.
User avatar
Cedric Pearson
 
Posts: 3487
Joined: Fri Sep 28, 2007 9:39 pm

Post » Fri May 27, 2011 12:52 am

The [x][y] notation is for a 2-dimensional array. It may help to think of it like this:
+---------------------------------------+| a[0]  +---------+---------+---------+ ||	   | a[0][0] | a[0][1] | a[0][2] | ||	   +---------+---------+---------+ |+---------------------------------------+| a[1]  +---------+---------+---------+ ||	   | a[1][0] | a[1][1] | a[1][2] | ||	   +---------+---------+---------+ |+---------------------------------------+| a[2]  +---------+---------+---------+ ||	   | a[2][0] | a[2][0] | a[2][0] | ||	   +---------+---------+---------+ |+---------------------------------------+
That shows how a[0] is an array of three values, a[0][0], a[0][1], and a[0][2]. This is a 3x3 array because a is an array of 3 arrays of three elements. You can have non-square arrays (e.g. 100x5), you can have arrays of more dimensions (e.g. 3x4x5), and in OBSE you can even have arrays of differing lengths (though this is not recommended because it can be very difficult to keep track of).
User avatar
Ashley Tamen
 
Posts: 3477
Joined: Sun Apr 08, 2007 6:17 am

Post » Fri May 27, 2011 2:28 am

That shows how a[0] is an array of three values, a[0][0], a[0][1], and a[0][2]. This is a 3x3 array because a is an array of 3 arrays of three elements. You can have non-square arrays (e.g. 100x5), you can have arrays of more dimensions (e.g. 3x4x5), and in OBSE you can even have arrays of differing lengths (though this is not recommended because it can be very difficult to keep track of).

Well, in Enhanced Economy, I have one two-dimensional array, where each sub-array is of different length, and contains a container or actor ref + all loot I removed from that actor/container, which may be anything from 1 and upwards, and it isn't too difficult to keep track of either, as I simply use "let length := ar_Size myarr[i]" for sub-element i.
User avatar
Charlie Ramsden
 
Posts: 3434
Joined: Fri Jun 15, 2007 7:53 pm

Post » Fri May 27, 2011 8:02 am

Is there a way to check if a random person in a faction dies? in a script
User avatar
Floor Punch
 
Posts: 3568
Joined: Tue May 29, 2007 7:18 am

Post » Thu May 26, 2011 9:50 pm

How do I make a race take negative sun damage?
Like Vampires take damage from the sun,
I want it to heal this race, not damage.
User avatar
Emma
 
Posts: 3287
Joined: Mon Aug 28, 2006 12:51 am

PreviousNext

Return to IV - Oblivion