Jump to content

What's the problem with this script?


AxlDave

Recommended Posts

It's a quest script, it's supposed to check if you have a particular item upon leaving Doc Mitchell's house for the first time, and if you do not have it, it will add it to his vendor inventory. If you do have it, the script makes itself defunct.

 

Here's the script which will not save:

 

short DoOnce

BEGIN GameMode

if ( DoOnce == 0 )
if Player.GetStage VCG01 == 200
if Player.GetItemCount MyItem >= 1
set DoOnce to 1
else
set DoOnce to 2
endif
endif
endif

if ( DoOnce == 2 )
VendorContainerDocMitchell.AddItem MyItem 1
endif

END

 

 

Where am I going wrong? I bet it's something simple...

Link to comment
Share on other sites

Just a quick and probably stupid question but is that the whole script? I mean do you have "scn Myscriptname" at the top?


Also download geck powered up and run that it allows you to save unfinished scripts.


Link to comment
Share on other sites

You can only add items to containers and NPCs through their reference in the cell editor, not the base entry like what you're trying to do with "VendorContainerDocMitchell.AddItem". Unfortunately VendorContainerDocMitchell doesn't have name in the cell editor (for the script to find it) so you'll have to add one if you want your script to work.

 

To do this right-click on the "VendorContainerDocMitchell" entry under Container and hit "Use Info" in the menu that pops up. When the new window opens up double-click on "NVVendorChestsCell", this should lead you to the "VendorContainerDocMitchell" reference in the cell editor. Double-click on the container shown in the editor and make sure it says "VendorContainerDocMitchell" next to Base Object. Reference Editor ID will be right above that, this is where you'll want to add a name so your script can find the container reference. You can simply name it VendorContainerDocMitchellREF if you want.

 

After that hit OK and change your script to point to "VendorContainerDocMitchellREF" instead of just "VendorContainerDocMitchell". See if your script compiles and if it doesn't just save your mod, close the GECK and open it again then load your mod and try to save the script again.

Link to comment
Share on other sites

 

Just a quick and probably stupid question but is that the whole script? I mean do you have "scn Myscriptname" at the top?

Also download geck powered up and run that it allows you to save unfinished scripts.

 

 

Yes, I have an scn MyScript, I didn't think it was relevant to include it. I've heard about GECK powered, but I generally don't do complicated enough scripts to make it worthwhile.

 

 

Also your if doonce == 0 and 2 doesn't need to be in brackets I don't think but im really no expert at all on scripting

 

They don't need to be, but it helps keep things organised in my head, which is basically all that matters.

 

 

You can only add items to containers and NPCs through their reference in the cell editor, not the base entry like what you're trying to do with "VendorContainerDocMitchell.AddItem".

 

...

 

See if your script compiles and if it doesn't just save your mod, close the GECK and open it again then load your mod and try to save the script again.

 

Excellent, that did the trick nicely, cheers man. I didn't even need to restart the GECK.

Edited by AxlDave
Link to comment
Share on other sites

  • Recently Browsing   0 members

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