Jump to content

Script Double-Standards?


Radioactivelad

Recommended Posts

I'm trying to add a Reloading Bench as one of the purchasable upgrades for the Lucky 38 Suite, but for whatever reason, it refuses to work as the vanilla upgrades do.

 

If you don't know how the Suite upgrades work, here's a crash course:

 

  1. The player buys a Token object from a vendor.
  2. When the player accepts the transaction and the token is added to their inventory, an OnAdd Script fires, immediately removing the token, and the Upgrade is enabled.

 

 

 

However, my Reloading Bench Token does not get removed automatically. The script itself works, but the player has to drop the token from their inventory and pick it up again for the OnAdd script to run. Why???

 

I'm literally copying the scripts that the vanilla game uses for all the other upgrades word-for-word. (Obviously substituting my Reloading Bench Reference for the Enable target.)

 

Link to comment
Share on other sites

The problem might lie with "the token" being used. Did you create your own or reuse that same one used by the original script? Might there be some property needing change?

 

Otherwise you might post the relevant section of your script so we can see if there is something your eyes are missing.

 

-Dubious-

Link to comment
Share on other sites

It's a different object, I'm simply following the same "template", so to speak, as the vanilla Upgrades.

As it stands, I have found that it will work if I add the Token to the Lucky38VendorChest via another script as opposed to placing it in the Lucky 38 Vendor Chest directly.


I'm more or less satisfied with this workaround, but if any one is curious, this is my Script:

SCN OXUpgradeReloadingBenchSCRIPT

Begin OnAdd
    OXReloadBench.enable 1
    removeme
end

And this is the script used by the vanilla suite upgrades:

scn L38upgradefridgeSCRIPT

begin onadd
	L38RefrigeratorWithLiquorNEWREF.enable 1
	removeme
end

Just to reiterate, my Script *works*, in that it does what it says it will do, but it would not trigger in the same situations the vanilla example does. (*Unless* I add the Token to the vendor chest via the indirect method.)

Link to comment
Share on other sites

The issue might be when the "Add Token to Chest" event took place. The Lucky38VendorChest script (as part of the vanilla game) is going to be loaded when the game starts. Perhaps your own script doing so was not run prior to the situation where it failed to be found. See 'TIP Best Practice Sharing Variables between Scripts' under the "Scripting" section of the wiki "Getting started creating mods using GECK" article.

 

But HEY! :thumbsup: You got it working!

 

-Dubious-

Link to comment
Share on other sites

  • Recently Browsing   0 members

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