blazeda59 Posted January 3, 2011 Share Posted January 3, 2011 Hey Im working on a activator that takes an object from the player when a button is pressed and then after a sort time unhides a couple of new objects which I can do. What I want to do next is make it so the player can only use the activator twice at one time ie they use it twice then have to wait a while until being able to use it again. Can someone please tell me how this is done? any help would be great thanks. Link to comment Share on other sites More sharing options...
DPErny Posted January 3, 2011 Share Posted January 3, 2011 I think this might help. http://geck.bethsoft.com/index.php/Scripting_Tutorial:_Creating_a_Simple_Timer Link to comment Share on other sites More sharing options...
blazeda59 Posted January 3, 2011 Author Share Posted January 3, 2011 thanks for the reply but thats not what Im after. Its not the time limit I cant figure out its making it so the player can only press two buttons from the activator message (not including the exit button) then is unable to access the activator again until the timer finishes. Link to comment Share on other sites More sharing options...
DPErny Posted January 3, 2011 Share Posted January 3, 2011 How many buttons do you have? I'm not that familiar with New Vegas scripting, but I know a thing or two about coding. Can you try better explaining what you're trying to do? Link to comment Share on other sites More sharing options...
blazeda59 Posted January 3, 2011 Author Share Posted January 3, 2011 im setting up a box that spawns fruit after the player puts in an object, after the player has put 2 objects into the box they cant put anymore in until the timer has finished. the message has 7 buttons one for each item the player can spawn plus the exit but the idea is the player can only chose to spawn 2 at a time. Link to comment Share on other sites More sharing options...
DPErny Posted January 3, 2011 Share Posted January 3, 2011 This should work: Create an integer value, set it to zero. Whenever the function to do your thing is called, check the value of the integer. If it's less than 2, let the function do its thing, and then add 1 to that value. If it equals 2, stop and start the timer. Like in this fake code here, which should hopefully illustrate my point. int iStuffInBox set iStuffInBox to 0 On Activatorthingyif iStuffinBox < 2LetShitHappeniStuffInBox + 1 elseif iStuffInBox >= 2PrintMessage "CAN'T DO THAT, BUB."CreateTimer "Timersyntaxstuff"endif Get what I mean? Link to comment Share on other sites More sharing options...
rickerhk Posted January 3, 2011 Share Posted January 3, 2011 thanks for the reply but thats not what Im after. Its not the time limit I cant figure out its making it so the player can only press two buttons from the activator message (not including the exit button) then is unable to access the activator again until the timer finishes.Give the activator a persistent reference. Define a short variable on it, buttonCount, for example. In your script that checks to see what button you have hit, it also increments the buttom count by one. Use this variable as a condition of less than 2 on your buttons. If it has reached 2, then none of the buttons are visible, except for exit. Then let the timer reset this variable back to zero. Or let the activator do the variable check, like DPErny suggested, and intercept with a message in the ONActivate block, and not actually activating itself. Link to comment Share on other sites More sharing options...
blazeda59 Posted January 3, 2011 Author Share Posted January 3, 2011 (edited) Yeah Im not the best programmer in the world but I see what your doing. Thanks heaps for the help I'll see what I can do with it, if I run into anymore trouble I'll send you a PM. Thanks again @ rickerhk I know what your saying in words but I suck at programming and not sure how to do that, could you please give me an example like DPErny did. Helps me if I see the code. Edited January 3, 2011 by blazeda59 Link to comment Share on other sites More sharing options...
rickerhk Posted January 4, 2011 Share Posted January 4, 2011 Here's an example. With this you don't need conditions on the buttons. scn MyActivatorScript short iButtonCount short iButton short iShowMenu short iAwaitInput float fTimer BEGIN ONActivate if IsActionRef Player == 1 if iButtonCount == 2 ShowMessage YouHaveToWaitMSG else Set iShowMenu to 1 endif endif END BEGIN GameMode if iButtonCount == 2 if fTimer <= 0 set iButtonCount to 0 else set fTimer to fTimer - GetSecondsPassed endif else if iShowMenu == 1 ShowMessage PickItemsPlease set iShowMenu to 0 set iAwaitInput to 1 endif if iAwaitInput == 1 set iButton to GetButtonPressed if iButton < 0 return else set iAwaitInput to 0 if iButton == 0 ;Do stuff with your item1 here set iButtonCount to iButtonCount + 1 if iButtonCount == 2 set fTimer to 10 else set iShowMenu to 1 ;Show menu again endif elseif iButton == 1 ;Do stuff with your item2 here set iButtonCount to iButtonCount + 1 if iButtonCount == 2 set fTimer to 10 else set iShowMenu to 1 ;Show menu again endif ;...etc elseif iButton == 8 ;Exit set fTimer to 10 set iButtonCount to 2 endif endif endif endif END Link to comment Share on other sites More sharing options...
DPErny Posted January 4, 2011 Share Posted January 4, 2011 I have to thank you myself, rickerhk. To be honest, I've never done any scripting for Fallout of TES4, so this shows me some really great examples of the language and efficient coding. Link to comment Share on other sites More sharing options...
Recommended Posts