Jump to content

Does this script look ok?


Thingamajig

Recommended Posts

scn SurvivalHomeEndTRIG

 

begin Gamemode

 

if getStage SurvivalHome < 100

if player.GetItemCount NVSlaveBackpack || player.getitemcount MegatonHouseKey || Player.getitemcount TenpennySuiteKey || player.getitemcount ArefuHouseKey || player.getitemcount RCHouseKey

setStage SurvivalHome 100

endif

endif

 

end

 

Basically, this script is ran once a quest is activated (player leaves vault 101). Once the player finds any ONE of the above items (line 6) it completes the quest by loading the next stage of it (line 7)

 

To me, it looks messy. I've never scripted before and i get the feeling having the game constantly check for 5 items for god knows how long isn't as resource-friendly as i'd like. Especially given how unstable Fallout 3 is anyway.

 

Any advice for a total NOOB scripter? (i don't even know the basics, honest. so go easy on me!)

Edited by Thingamajig
Link to comment
Share on other sites

Rather than constantly checking for the items, have the items tell your quest to advance (through a script). Don't ask me how, I don't know how to script, I'm just using common sense :P

 

This might be a problem, especially in regards to one object (first, slavebackpack) as a script is already running on it - or at least planned to.

 

any other alternatives?

 

Thanks for the response :)

Link to comment
Share on other sites

You could add all of these items to a new form list, Then call GetItemCount with the form list as its parameter.

 

Adding items to a form list doesn't modify the items, so you can check vanilla items without causing any compatibility issues, and you can alter the list of items without having to modify the script. It also allows you to easily use the same list multiple times in one or more scripts and still be able to change the group of items by only changing it in a single place.

 

Cipscis

Link to comment
Share on other sites

You could add all of these items to a new form list, Then call GetItemCount with the form list as its parameter.

 

Adding items to a form list doesn't modify the items, so you can check vanilla items without causing any compatibility issues, and you can alter the list of items without having to modify the script. It also allows you to easily use the same list multiple times in one or more scripts and still be able to change the group of items by only changing it in a single place.

 

Cipscis

 

I gave this a quick go. I've created the form list and i adjusted the script which looks like:

 

scn SurvivalHomeEndTRIG

 

begin Gamemode

 

if getStage SurvivalHome < 1

if player.GetItemCount SurvivalHomeList >= 1

setStage SurvivalHome 10

endif

endif

 

end

 

(survivalHomeList being the lists name)

 

However, it doesn't appear to work.

 

What am i doing wrong?

Link to comment
Share on other sites

Hmm... In my experience, using GetItemCount has always worked flawlessly with form lists, and your code seems fine.

 

Perhaps try printing the output of GetItemCount to the console, both with The form list and with the individual items.

 

On a semi-related note, it would be nothing but more efficient to remove the ">= 1" from your condition, as the only value which GetItemCount can return that doesn't fit this condition is 0 anyway.

 

Cipscis

Link to comment
Share on other sites

Hmm... In my experience, using GetItemCount has always worked flawlessly with form lists, and your code seems fine.

 

Perhaps try printing the output of GetItemCount to the console, both with The form list and with the individual items.

 

On a semi-related note, it would be nothing but more efficient to remove the ">= 1" from your condition, as the only value which GetItemCount can return that doesn't fit this condition is 0 anyway.

 

Cipscis

 

I removed the >= 1, it did nothing. I then tried running the command in the game console (player.getitemcount survivalhomelist) and it cannot find the list saying:

Item "SurvivalHomeList" not found for parameter ObjectID

 

I've double checked the spelling, so it's not that. The script is using it according to the GECK..so i'm out of idea's.

 

Could it be related to the fact that the formlist isn't a "quest" ?

 

The command works if i type out the individual baseID's for each item (ie: player.getitemcount 0001522e) but doesn't if i use the editor id: (player.getitemcount TenpennySuiteKey) Does this ring any bells?

Edited by Thingamajig
Link to comment
Share on other sites

Removing the ">= 1" won't change how the script works - it's just entirely unnecessary (and slightly less efficient, due to the lack of compile-time optimisation) to include the extra comparison.

 

When using the console (with the exclusion of quests only if you're running the script extender, I believe) you need to use the formID as opposed to the editorID. When you use the for list's formID in the console, do you get the expected result?

 

Cipscis

Link to comment
Share on other sites

Removing the ">= 1" won't change how the script works - it's just entirely unnecessary (and slightly less efficient, due to the lack of compile-time optimisation) to include the extra comparison.

 

When using the console (with the exclusion of quests only if you're running the script extender, I believe) you need to use the formID as opposed to the editorID. When you use the for list's formID in the console, do you get the expected result?

 

Cipscis

 

edit--

 

Aha, i realize where i've been going wrong. The geck had the FormID column collapsed, so all i could see was the EditorID - which lead me to believe this was also the FormID *duh*

 

Thanks for your help Cipscis, much appreciated :D

 

edit2---

 

Ok, new problem :(

 

The form ID of the formlist is 0300B536.

 

Whenever i load the game though, it just loops at the main menu slides - doesn't do a thing. till it finally crashes.

 

Doesn't the second digit (3) change depending on how many esp's are loaded in the GECK? (in which case, it's "3" because i rely on two other ESP's for content) in the geck the form id is 0300B536, but once i load my game (Plus additional mods like FWE, etc.) i assume it changes the FormID based on the number of ESP's are loaded in the FOMM at the time.

 

Am i right in believing this is the problem? If it is, then i cant imagine my mod being very compatible with other people's mod lists! lol!

 

Thanks again.

Edited by Thingamajig
Link to comment
Share on other sites

Don't worry about the formID having the first two digits set to 03 in the GECK - those digits are assigned when the data files are loaded, so when you load up Fallout that formID will probably be assigned another number to prefix its formIDs with - whichever one is appropriate for its position in the load order. The prefixes it uses for its master files' formIDs are linked to its list of masters, so you needn't worry about issues arising there either.

 

What did you change prior to your game starting to crash instead of loading the main menu? If I remember correctly (which I may not - it's been a while) that's a symptom of a missing master file, so make sure all the appropriate files are being loaded.

 

Cipscis

Link to comment
Share on other sites

  • Recently Browsing   0 members

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