ChrissyMcp Posted July 14, 2011 Share Posted July 14, 2011 Okay so I've been trying this simple script for over 3 hours now, but it just wont save in geck.... So Here It is :- scn MyScriptPassport ref IplayerActualMoney begin SaytoDone Set iPlayerActualMoney to Player.GetItemCount caps001If (iPlayerActualMoney >= theitemcost) Player.RemoveItem caps001 theitemcost Player.additem RefYourItem 1 endif end __________________________________________ Any Solutions ?? Would be very appreciated + kudos chrissy_M_ Link to comment Share on other sites More sharing options...
davidlallen Posted July 14, 2011 Share Posted July 14, 2011 Please use "geck powerup" available at newvegasnexus.com. This will allow you to see syntax errors. It is very painful to debug scripts without this. It seems you have not defined "theitemcost". Link to comment Share on other sites More sharing options...
ChrissyMcp Posted July 14, 2011 Author Share Posted July 14, 2011 (edited) Ahh wrong script I have defined it in heck itself but I can't cnp so I have defined and I run my heck from geckpu anyway so that doesn't work either but thanks Edited July 14, 2011 by chrissy_M_ Link to comment Share on other sites More sharing options...
Glenstorm Posted July 14, 2011 Share Posted July 14, 2011 RefYourItem should be an object NOT a reference. I'm saying this coz I saw Ref in front.Reference is a holder to a specific object in the world. Eg. A random deathclaw in the Quarry.Object is the holder to the creature called Deathclaw. Link to comment Share on other sites More sharing options...
nosisab Posted July 14, 2011 Share Posted July 14, 2011 (edited) the iPlayerActualMoney should be an integer variable, not a Ref variable (that is the reason for the i in it, to remember it). That's a very important point and somewhat confuse to scripting newbies, to understand the difference between the ReferenceID, the ObjectID and normal variables. The ObjectID is that defined on CS, it never go into actual games, it is a template from what all actual items in game are created from The ReferenceID is that specif instance of that item in game, although the IronShortSword is the same (objectID), each occurrence of it in game is unique with it's proper ReferenceID. Some functions acts over the ObjectID, other acts only over the ReferenceID while some other can act on both being the scope defined explicitly. As example of function that acts on ObjectID we have the famous RefActor.Additem ItemObjectID # let us understand what happens: first we see the actor to receive the item is a referenceID, it must be that unique instance of the actor in game (commonly is the Player that actor but not necessarily). Now we see the function tell what template is to be used to create the amount (#) of instances of the item in the actor's container(inventory)... so, despite the function is over the item's objectID it creates # instances of the item each one with proper and unique ReferenceID. To cement the concept let's see the "Enable or Disable" function, on CS it is used always on a ReferenceID... you would not want to Disable ALL items of the kind when trying to disable that instance of it, so the function is disallowed at CS (GECK allow using enable/disable on objectID... that is powerful but clearly dangerous too). As last example let's see where the set command is used to initialize a Ref variable and a float variable: Ref rWeapon Float fWeaponSpeed . . Begin GameMode . . Set rWeapon to Player.GetEquippedObject 16 ; Notice that function gives the actual "referenceID" of that weapon (16) is equipped on the Player ; rWeapon can now be used in any function needing a reference If (rWeapon == MyItemID) ; Now MyItemID is the item's ObjectID as defined in CS, let say it is a weapon you created and gave a name and ID. The function verify if the refID rWeapon is from that "parent" ObjectID Set fWeaponSpeed to GetWeaponSpeed rWeapon ; a numerical value is given to fWeaponSpeed If (fWeaponSpeed < 1.6) SetWeaponSpeed 1.6 rWeapon ; Again we see a function acting on the ReferenceID, that specific function apply 1.6 (could be a float variable here) to that equipped instance of your weapon but not to all weapons of it's kind eventually in game Endif Endif . End Once you get the kinks, scripting on references and objects becomes clear and simple. PS: The script chunk is for showing purposes and not designed with purposes in mind, that test of the previous speed probably is totally not necessary. Edited July 14, 2011 by nosisab Link to comment Share on other sites More sharing options...
Recommended Posts