Jac wrote:Yes you can, but you need MWEdit to compile MWSE scripts.
Fliggerty wrote:If your ingredients are in a container, it is a very simple thing to do. I can provide you some script snippets if you like. I have an MWSE alchemy mod in the works that you are free to use bits of.
Fliggerty wrote:MWSE alchemy mod
begin GHF_P__ALC_sort
long pcref
long invid
long invcount
long invtype
long invvalue
float invweight
long invname
long invref
long nameletter
long contref
short state
long temp
long pcname
if ( MenuMode )
Return
endif
setx pcref to xGetRef "player"
setx pcname to pcref->xGetName
ifx ( invref )
setx invid invcount invtype invvalue invweight invname invref to pcref->xContentList invref
else
setx invid invcount invtype invvalue invweight invname invref to pcref->xContentList 0
set state to 1
;xMessageFix "taking stuff from %s" pcname
;MessageBox "hee hee hee hee hee hee hee hee hee hee hee hee hee hee"
endif
if ( invref == 0 )
set state to 0
StopScript GHF_P__ALC_sort
endif
ifx ( state )
if ( invtype != 1380404809 ) ;not an ingredient
return
endif
setx nameletter to xStringBuild "%.1s" invname
ifx ( temp )
pcref->xRemoveItem invid invcount
setx contref to xGetRef "GHF_P__ALC_Chest"
contref->xAddItem invid invcount
return
endif
endif
end
begin GHF_P__ALC_sort
long pcref
long invid
long invcount
long invtype
long invvalue
float invweight
long invname
long invref
long nameletter
long contref
long temp
long pcname
if ( MenuMode )
Return
endif
setx pcref to xGetRef "player"
setx pcname to pcref->xGetName
ifx ( invref )
setx invid invcount invtype invvalue invweight invname invref to pcref->xContentList invref
else
setx invid invcount invtype invvalue invweight invname invref to pcref->xContentList 0
endif
if ( invref == 0 )
StopScript GHF_P__ALC_sort ;need to let the script loop one last time to get the last item
endif
if ( invtype != 1380404809 ) ;not an ingredient
return
endif
pcref->xRemoveItem invid invcount
setx contref to xGetRef "GHF_P__ALC_Chest"
contref->xAddItem invid invcount
end
begin GHF_P__ALC_sort
long pcref
long invid
long invcount
long invtype
long invvalue
float invweight
long invname
long invref
long nameletter
long contref
long temp
long pcname
if ( MenuMode )
Return
endif
setx pcref to xGetRef "player"
setx pcname to pcref->xGetName
ifx ( invref )
setx invid invcount invtype invvalue invweight invname invref to pcref->xContentList invref
else
setx invid invcount invtype invvalue invweight invname invref to pcref->xContentList 0
endif
if ( invref == 0 )
StopScript GHF_P__ALC_sort ;need to let the script loop one last time to get the last item
endif
if ( invtype != 1380404809 ) ;not an ingredient
return
endif
pcref->xRemoveItem invid invcount
setx contref to xGetRef "GHF_P__ALC_Chest"
contref->xAddItem invid invcount
ifx ( invref )
setx invid invcount invtype invvalue invweight invname invref to pcref->xContentList invref
else
setx invid invcount invtype invvalue invweight invname invref to pcref->xContentList 0
endif
if ( invref == 0 )
StopScript GHF_P__ALC_sort ;need to let the script loop one last time to get the last item
endif
if ( invtype != 1095782465 ) ;not an apparatus
return
endif
pcref->xRemoveItem invid invcount
setx contref to xGetRef "GHF_P__ALC_Chest"
contref->xAddItem invid invcount
end
begin GHF_P__ALC_sort
long pcref
long invid
long invcount
long invtype
long invvalue
float invweight
long invname
long invref
long nameletter
long contref
long temp
long pcname
if ( MenuMode )
Return
endif
setx pcref to xGetRef "player"
setx pcname to pcref->xGetName
ifx ( invref )
setx invid invcount invtype invvalue invweight invname invref to pcref->xContentList invref
else
setx invid invcount invtype invvalue invweight invname invref to pcref->xContentList 0
endif
if ( invref == 0 )
StopScript GHF_P__ALC_sort ;need to let the script loop one last time to get the last item
endif
if ( invtype != 1380404809 ) ;not an ingredient
else
( invtype != 1095782465 ) ;not an apparatus
return
endif
pcref->xRemoveItem invid invcount
setx contref to xGetRef "GHF_P__ALC_Chest"
contref->xAddItem invid invcount
end
ifx ( button ) ; inv to satchel
; xLogMessage "From inv to satchel"
setx cId cQuant cType junk crap junk cNextRef to plrRef->xContentList 0
xFileRewind "ASH_Temp" ; temporarily stores ingreds removed from player's inventory
whilex ( cNextRef )
; xLogMessage "Contents: ID=%s count=%d type=%d" cID cQuant cType
set junk to ( cType - 1380404809 )
ifx ( junk ) ; not an ingredient
; xLogMessage "Item %s is not ingredient" cID
else ; ingredient, so transfer it
; xLogMessage "Item == %s quant == %d" cID cQuant
; plrRef->xRemoveItem cId cQuant - do this later
guyRef->xAddItem cId cQuant
xFileWriteString "ASH_Temp" cID
xFileWriteLong "ASH_Temp" cQuant
endif
Users browsing this forum: No registered users and 1 guest