Jump to content

G.E.C.K Script Help.


KingofPenguins

Recommended Posts

Hey guys, I'm really really new at the geck and I was trying to create a script but I can't get it to work :(

Anyways whats its suppose to do is add Gauss Rifle to the high ranking Outcast members inventory! (I was just messing around in the geck)

 

scn OutcastUseGaussRifeSCRIPT

ref rsibley
ref rMcGraw
ref rMorrill
ref rCasdin
ref rRockfowl
ref rOutcast1
ref rOGuard

Begin GameMode

set rsibley to DLC02DefenderSibley
set rMcGraw to DLC02ProtectorMcGraw
set rMorrill to DLC02DefenderMorrill
set rCasdin to ProtectorCasdin
set rRockfowl to DefenderRockfowl
set rOutcast1 to DLC02BaseOutcast1
set rOGuard to DLC02GuardOutcast1

if (GetQuestCompleted DLC02OA4 == 1)

rsibley.additem DLC02WeapGaussRifleWasteland 1
rMcGraw.additem DLC02WeapGaussRifleWasteland 1
rMorrill.additem DLC02WeapGaussRifleWasteland 1
rCasdin.additem DLC02WeapGaussRifleWasteland 1
rRockfowl.additem DLC02WeapGaussRifleWasteland 1
rOutcast1.additem DLC02WeapGaussRifleWasteland 1
rOGuard.additem DLC02WeapGaussRifleWasteland 1

rSibley.additem AmmoMicroFusionCell 20
rMcGraw.additem AmmoMicroFusionCell 20
rMorrill.additem AmmoMicroFusionCell 20
rCasdin.additem AmmoMicroFusionCell 20
rRockfowl.additem AmmoMicroFusionCell 20
rOutcast1.additem AmmoMicroFusionCell 20
rOGuard.additem AmmoMicroFusionCell 20

endif

end

 

Thanks!

Once again, this is my first script so I am very noobie at the geck :P

Link to comment
Share on other sites

I believe that ref variables need to be set to reference IDs, not baseIDs.

So try, for example "set rRockfowl to DefenderRockfowlRef" instead.

Apologies if I steer you wrong, I've never personally used ref vars.

If it was me I would have done away with them and just put

"DefenderRockfowlRef.additem xyz 1"

Link to comment
Share on other sites

While it is possible for "ref" variables to store any type of FormID, Quetzlsacatanango is correct that you want them to store a RefID in this case. If you attempt to call a reference function such as AddItem on an invalid RefID, your script will just stop running. In this case, I would expect the references in question to be persistent, so you should be able to refer to them via their EditorRefIDs instead of using "ref" variables.

 

I also think it's worth mentioning that when checking a boolean condition, such as the return value of GetQuestCompleted, there's no point in using "== 1". The "==" operator, like all other operators, is only useful when you need to transform data. If you compare a boolean value with "1" in this way, your data will not be transformed but your script will be less efficient.

 

Once you've got AddItem working, you'll also want to include some method of preventing the items from being added multiple times.

 

You might want to have a look at my Scripting for Beginners tutorial before you go any further, to familiarise yourself more with the syntax used in Fallout 3 scripting.

 

Please indent your scripts, unindented code is very difficult to read. If you don't know how to properly indent your code, here is a web-based utility that can do it for you, as well as checking it for various structural errors - Script Validator

 

Cipscis

Link to comment
Share on other sites

  • Recently Browsing   0 members

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