Jump to content

Trying to add ammo to ammolist


Yamatohime

Recommended Posts

So, I created script and added it to simple quest. However, it doesn't seem to work. Is it script problem or I need to look at quest? If it is quest what should I look into?

scn MyAmmoListSCN

short iDoOnce

BEGIN GameMode
  if (iDoOnce == 0)
  ListAddForm AmmoList556mm MyAmmo556mm 0
  ListAddForm AmmoList308 MyAmmo308 0
  ListAddForm AmmoList12Ga MyAmmo12Ga 0
  ListAddForm AmmoList9mm MyAmmo9mm 0
  set iDoOnce to 1
  StopQuest 00AddAmmoToList
  endif
END
Link to comment
Share on other sites

Check that you have definitely chosen the script in the quest, have the quest set as start game enabled, priority 55 etc.

 

If all that has been done, try removing the '0' from the 'ListAddForm' functions. The wiki page says 'Adds the form to the list at the given index (or at the end if not provided)' so your script may be working but since they are added at the same index they may be overwriting each other?

 

Never mind just seen that they are all added to different lists.

Edited by SGTbayk47
Link to comment
Share on other sites

I wonder, does the quest (and script) run once after New Game or does it always run once during gamemode?

 

Do not use numbers for Editor-IDs (e.g. "00AddAmmoToList"). They confuse the game engine which thinks they are references. Please see 'TIP Best Practice Do not begin EditorIDs with numbers' under the "Scripting" section of the wiki "Getting started creating mods using GECK" article.

I renamed but it seems that problem will be persistent in the save file. Maybe it was not smart move to add items into the script in the middle of playthrough?

Link to comment
Share on other sites

"Gamemode" blocks run every frame. Which is why you are using the "iDoOnce" variable as a "gateway" to prevent the "ListAddForm" process from occurring more than once.

 

Your quest (and the subsequent call to the script) will run in a similar manner depending upon how you trigger it. Something like this (adding to existing lists) should be in a "Begin" block (also with a "gateway variable"). If the script is a "leveledItem", then you might want to have it to be an "object script" triggered when a container is opened (e.g. "OnActivate" or "OnLoad"). See 'TIP Block Types Multiple vs Single Frame processing' under the "Scripting" section of the wiki "Getting started creating mods using GECK" article.

 

I would re-examine how you are trying to implement that script. See 'TIP Preload Scripts' under the "Scripting" section.

 

You should not "test" scripts with an "in progress" game. Always test with a "new game". Include testing what happens when you "uninstall" your plugin so you know the possible consequences. (If you do test with an "in progress" game, note and revert to the save prior to testing when you continue.) Objects added via a script should not get "baked" into a save game when added correctly. If added as "dynamic/spawned" references, then they will simply disappear when the plugin is removed because they are no longer added. OTOH, if you "place" the object into the game world so it is a "persistent" reference, then it will get "baked" into the the save game file.

 

-Dubious-

Link to comment
Share on other sites

Hey there Yamatohime,

 

"listAddForm" is a clean way to add something to a form list, BUT it doesn't get saved into your savegame.

So you have to run the same block, everytime your game restarts.

 

First of all, I recommend to use JIP LN NVSE plugin. As you have way more functions available to mess with the game, but beside of messing with the game, these functions work often better than the regular one and you even got a brand new menu mode block.

Which is perfect for such initialization.

scn 00AddAmmoToList ;=> Lets assume this is the actual quest script. :)

;=> I also recommend to NOT use any numbers in front of the name, as that might confuse the engine.
;=> Rather give it a quick brand of your mod. Like "NVAmmPL" for "New Vegas Ammo Plus" or whatsoever.
;=> But starting with two zeros can cause engine issues and instabilities.
;=> Even though Oblivion was a bit more concerning in that regard.

BEGIN MenuMode 4 ;=> This menu mode is the main menu and essential for setting up stuff once before
  if GetGameRestarted  ;=> even starting to play. FormLists can be perfectly manipulated in that block.
    ListAddForm AmmoList556mm MyAmmo556mm  ;=> "GetGameRestarted" is a one-time ingame variable that
    ListAddForm AmmoList308 MyAmmo308     ;=> returns 1 only if the game got restarted. After calling that
    ListAddForm AmmoList12Ga MyAmmo12Ga   ;=> variable once, it will always return 0 afterwards, until the
    ListAddForm AmmoList9mm MyAmmo9mm     ;=> game is restarted another time.
    ;StopQuest 00AddAmmoToList   ;=> Be sure to remove this as we want to add the ammos to the list
  endif                          ;=> everytime the game is restarted, so the quest needs to continue running. As I said, "ListAddForms" does
END                              ;=> add new items to FormLists, but the changes are not persistent in the 
                         ;=> savegame. Do NOT use "AddFormToFormList", as that is persistent, but can cause
                          ;=> issues. Adding items everytime the game starts might appear bad, but it's the
                           ;=> cleanest way to mod actually. As persistent stuff can mess with your savegame.

Be aware that "MenuMode 4" is part of JIP LN NVSE plugin. This plugin is almost mandatory to mod and even play New Vegas nowadays. :wink:

 

Just one more thing:

    ListAddForm AmmoList556mm MyAmmo556mm 0
    ListAddForm AmmoList308 MyAmmo308 0

You add all your ammo types to index 0. Which means they overwrite each other. XD

Don't add any index number there and they will be added into the next line, instead of overwriting the same line over and over. :wink:

Link to comment
Share on other sites

  • Recently Browsing   0 members

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