Jump to content

MWSE- GetItemCount Broken?


Recommended Posts


Im new to scripting with MWSE and one issue Ive run into Is that the following bit will run find in vanilla morrowind but will not with mwse.

My first assumption was that with mwse I had to assign the player as a reference but havent had much luck. Any help would be appreciated.


Begin vsthisworks

if ( player->GetItemCount, "vs_ingred_Ember_01" == 1 )
	messagebox "pholdember"

if ( player->GetItemCount, "vs_ingred_ember_01" == 0 )
	messagebox "noember"
end vsthisworks


It all stems from testing some simple detection

Begin vs_mwseTest

long pRef		; The Player
long pcTarget	; The Players target

long ContCheck
long ContName ;TypeString "Burning Coals"
long ContNCheck

short cCont
short isCont

Setx pRef to xGetRef, "Player"
Setx pcTarget to xGetPCTarget
Setx ContCheck to pcTarget->xRefType
Setx ContName to xStringBuild, "Burning Coals" 
Setx ContNCheck to pcTarget->xGetName

;ifx ( pRef->GetItemCount, "vs_ingred_ember_01" == 0 )
	;messagebox "no ember"

if ( pcTarget == 0 )
	;messagebox "nothing looked at"
	return; do nothing

if ( ContName != ContNCheck )
	set cCont to 1 ;player looking at wrong container
	if ( cCont == 1 )
		;Messagebox "not looking at rock"
	set cCont to 2 ;player looking at right container
	if ( cCont == 2 )
		;Messagebox "looking at rock"

;container detection;
if ( ContCheck == 1414418243 ) ;reftpe container
	set isCont to 1
	;Messagebox "container"

;container detection;
end vs_mwseTest


Link to comment
Share on other sites

  • 4 months later...

Depending on what kind of mod you're creating, you may use Lua instead of mwscript with mwse, you'll find lots of information here https://mwse.github.io/MWSE/guides/introduction/ and if you want some examples on how container / inventory works with, go check QuickLoot source code https://www.nexusmods.com/morrowind/mods/46283 or my mod https://www.nexusmods.com/morrowind/mods/52918

Edited by cpassuel
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...