psrfreddyz06 Posted January 26, 2017 Share Posted January 26, 2017 (edited) I'm just trying to make a simple button which will restock (enable) some ammo on a shelf, and ammo itself are activators. I have this script from the different kinds of ammo: scriptname shelfscript begin OnActivate if Getisid EHAmmo9mmP player.additem Ammo9mmP 12 disable endif ;--------------------------- elseif Getisid EHAmmo556mm player.additem Ammo556mmArmorPiercing 24 disable endif ;--------------------------- elseif Getisid EHAmmo44magnum player.additem Ammo44MagnumHollowPoint 24 disable endif end And then on the restock button i have this script: scriptname infiniteammorestock ref linkammo Begin Onactivate Set linkammo to Getlinkedref if linkammo.GetDisabled linkammo.enable else showmessage alreadystockedXXXX endif end I'm a beginner when it comes to scripting and I've written these from scratch. All is working good except that i have the button linked to the first ammo, so the script ONLY restocks one of the ammos.. I've tried using the linked ref and linked all the ammo togheter. But only the first one get's enabled.. Any tips? Thanks! Edited January 27, 2017 by psrfreddyz06 Link to comment Share on other sites More sharing options...
psrfreddyz06 Posted January 26, 2017 Author Share Posted January 26, 2017 (edited) Update: The only way i managed to get it to work is if i use a different restock button for every type of ammo.. Which is not what i want. Damn this is hard sometimes haha Or if anyone could tell me if/how it is possible to link a button to multiple objects at once.. Edited January 27, 2017 by psrfreddyz06 Link to comment Share on other sites More sharing options...
psrfreddyz06 Posted January 27, 2017 Author Share Posted January 27, 2017 Another Update: Been reading on the GECK wiki over and over again, and I've looked through scripts that other have done, but they look so advanced for such a "simple" thing.. Is it really complicated to do this? Link to comment Share on other sites More sharing options...
SGTbayk47 Posted January 27, 2017 Share Posted January 27, 2017 (edited) You could try giving each ammo activator it's own ref ID and referencing them in the script that way. It makes the script longer, but will allow you to restock several activators at once. Just add a new if statement for how ever many ammo activators you're using. For example; scn restockscript begin onactivate if ammo1ref.getdisabled == 1 ammo1ref.enable endif if ammo2ref.getdisabled == 1 ammo2ref.enable endif end Hope that helps. Edited January 27, 2017 by SGTbayk47 Link to comment Share on other sites More sharing options...
psrfreddyz06 Posted January 27, 2017 Author Share Posted January 27, 2017 You could try giving each ammo activator it's own ref ID and referencing them in the script that way. It makes the script longer, but will allow you to restock several activators at once. Just add a new if statement for how ever many ammo activators you're using. For example; scn restockscript begin onactivate if ammo1ref.getdisabled == 1 ammo1ref.enable endif if ammo2ref.getdisabled == 1 ammo2ref.enable endif end Hope that helps.Dude you are AWESOME!! Exactly what i wanted. Thank you. Curious, if i where to put "if ammo1ref.getdisabled == 0" instead of 1, would that mean IF ammo1ref is enabled instead of disabled? Link to comment Share on other sites More sharing options...
Mktavish Posted January 28, 2017 Share Posted January 28, 2017 (edited) Yes ... getdisabled returns 1 if the ref is disabled ... therefore 0 = not disabled , or in other words enabled Most all of the functions are that way ... the intuitive question they ask is ... true =1 , false = 0 err I should say that another way ... If the function is asking a yes or no question ... 1 = yes , 0 = no With "GetDisabled" there is no other possibility than ... Disabled = 1/yes or Enabled =0/no All of the "Get" & "Is" functions are for asking questions (conditions)and the "has" and just a few others.The rest are commands Edited January 28, 2017 by Mktavish Link to comment Share on other sites More sharing options...
psrfreddyz06 Posted January 28, 2017 Author Share Posted January 28, 2017 Yes ... getdisabled returns 1 if the ref is disabled ... therefore 0 = not disabled , or in other words enabled Most all of the functions are that way ... the intuitive question they ask is ... true =1 , false = 0 err I should say that another way ... If the function is asking a yes or no question ... 1 = yes , 0 = no With "GetDisabled" there is no other possibility than ... Disabled = 1/yes or Enabled =0/no All of the "Get" & "Is" functions are for asking questions (conditions)and the "has" and just a few others.The rest are commandsThank you very much! I understand much better now! :D Link to comment Share on other sites More sharing options...
Recommended Posts