XGetService

From Morrowind Modding Wiki
Jump to: navigation, search

A function added by MWSE.

xGetService combines the features of xIsTrader, xIsTrainer, and xIsProvider in a single function with one return value. The service values are shown in the following table and if an NPC offers more than one service the sum of the service numbers will be returned. The mask parameter can be used as a filter to limit the return value to only consider the services indicated.

Value Service
1 Barters for Weapons
2 Barters for Armour
4 Barters for Clothing
8 Barters for Books
16 Barters for Ingredients
32 Barters for Lockpicks
64 Barters for Probes
128 Barters for Lights
256 Barters for Alchemical Apparatus
512 Barters for Repair Tools
1024 Barters for Miscellaneous Items
2048 Sells Spells
4096 Barters for Enchanted Items
8192 Barters for Potions
16384 Provides Training
32768 Provides Spellmaking Service
65536 Provides Enchanting Service
131072 Repairs Armor and Weapons

Use a mask of 16384 to see if the NPC is a trainer and the function will either return 16384 or 0. Use a mask of 96 (32+64) to see if the NPC sells thieving equipment. The value returned could be 0, 32, 64, or 96, but won't any other values even if the NPC provides other services too.

Syntax

service_mask (long): ref->xGetService service_mask (long)

Example

long npcRef
long service

Setx npcRef to xGetRef "npc_ID"
Setx service to npcRef->xGetService 262143

See Also

xIsFemale
xIsTrader
xIsTrainer
xIsProvider
xSetService
xModService
xGetBaseGold
xGetGold
xSetBaseGold
xSetGold