masternetra Posted September 17, 2012 Share Posted September 17, 2012 I'm trying to do a generic version of the Player Nuka Cola machine so that it can be added multiple places and still work locally is there anyway for a script to generically add items to a activated item? Instead of having to create a script for each item? Link to comment Share on other sites More sharing options...
Ladez Posted September 18, 2012 Share Posted September 18, 2012 I assume you're talking about the Pristine Vending Machines placed in the player homes in Megaton and Tenpenny Tower. Actually the script attached to them only needs one minor adjustment to make it work when placed everywhere. This is the script in its full form:scn HD01NukaVendingMachineScript ;This script is designed to handle the Nuka-Cola Machine that the Player buys for his house ;The Player can add Nuka-Colas to the machine and have them changed to Ice-Cold Nuka-Colas ;He can then dispense them as he wants to take some or drink them short Button short NukasOnMe short GoNuka begin OnActivate if ( IsActionRef Player == 1 ) if ( Player.GetItemCount NukaCola >= 1 ) ShowMessage HD00NukaMachineWith set GoNuka to 2 elseif ( Player.GetItemCount NukaCola < 1 ) ShowMessage HD00NukaMachineWithout set GoNuka to 1 endif endif end begin gamemode set Button to GetButtonPressed if ( Button == 0 ) && ( GoNuka >= 1 ) Activate set GoNuka to 0 elseif ( Button == 1 ) && ( GoNuka == 2 ) set NukasOnMe to ( Player.GetItemCount NukaCola ) Player.RemoveItem NukaCola NukasOnMe HD01NukaMachineRef.AddItem MS05IceNukaCola NukasOnMe set NukasOnMe to 0 set GoNuka to 0 elseif ( Button == 1 ) && ( GoNuka == 1 ) ;Do Nothing set GoNuka to 0 elseif ( Button == 2 ) && ( GoNuka == 2 ) ;Do Nothing set GoNuka to 0 endif endThis line:HD01NukaMachineRef.AddItem MS05IceNukaCola NukasOnMeShould be changed to this:AddItem MS05IceNukaCola NukasOnMeWhat happens is that AddItem is called on the very object it is attached to, instead of a specific reference (HD01NukaMachineRef) which in this case is placed in the Megaton player home. Now I would create a new container based on one of the existing Pristine Vending Machines to avoid incompatibilities if another mod changes these, make a new script like described above and attach it to the container. And then you have your generic version of it, that you can place anywhere you want. Link to comment Share on other sites More sharing options...
masternetra Posted September 18, 2012 Author Share Posted September 18, 2012 Thanks very much! I considered that possibility with additem, but the whole HD01NukaMachineRef before it kinda confused me. Guessing its a outdated script? Link to comment Share on other sites More sharing options...
Gribbleshnibit8 Posted September 24, 2012 Share Posted September 24, 2012 The game devs did that a lot. For some reason they didn't like doing the whole "lets write one script and use it in a lot of places" for that kind of thing. There's also a version of that script in my Nuka-Cola Enhanced mod that does the same thing, allowing the machines to be placed in lots of locations. Link to comment Share on other sites More sharing options...
Recommended Posts