5ivexxxxx Posted October 11, 2009 Share Posted October 11, 2009 I made a script so that if the player is using one of two weapons and presses the right key, a message will appear and they can select the ammo loadout. However, when I tried to use the IsWeaponInList function, an error appears, saying that I'm 'missing parameter int'. Here's the script: scn SniperChangeSCRIPT short Switch short Reload float Button ref Projectile Begin GameMode if IsKeyPressed == 38 && player.IsWeaponInList SniperChange set Switch to 1 else set Switch to 0 endif End Begin MenuMode if Switch == 1 set Button to GetButtonPressed if ( Button == 1 ) Set Projectile to SniperNormal SetWeaponProjectile Projectile Set Switch to 0 set Reload to 1 elseif ( Button == 2 ) Set Projectile to SniperAP SetWeaponProjectile Projectile Set Switch to 0 Set Reload to 1 Elseif ( Button == 3 ) Set Projectile to SniperIncendiary SetWeaponProjectile Projectile Set Switch to 0 Set Reload to 1 Elseif ( Button == 4 ) Set Projectile to SniperExplosive SetWeaponProjectile Projectile Set Switch to 0 Set Reload to 1 Endif if Reload == 1 TapKey 19 set reload to 0 endif End What do I need to do to fix this? Link to comment Share on other sites More sharing options...
Holty07 Posted October 11, 2009 Share Posted October 11, 2009 I made a script so that if the player is using one of two weapons and presses the right key, a message will appear and they can select the ammo loadout. However, when I tried to use the IsWeaponInList function, an error appears, saying that I'm 'missing parameter int'. Here's the script: *code* What do I need to do to fix this?That error means you're missing a number there. Check the line it says and make sure you've used the function on the line correctly. Although looking at it I can't spot the problem. Link to comment Share on other sites More sharing options...
Cipscis Posted October 11, 2009 Author Share Posted October 11, 2009 @portbash:I know that you can detect when the player grabs/releases an object via the OnGrab and OnRelease blocks, but I don't know of any way in which you can prevent the player from picking up an object short of either using FOSE's TapControl to force the reference to be instantly released or using FOSE's GetCrosshairRef along with DisableControl/EnableControl in order to prevent the "grab" control from being used while the appropriate object is being targeted. Neither of these are even close to perfect solutions, however, and the both require FOSE. I'm not familiar enough with NIF structure to be able to tell you if there's any way to prevent grabbing on that end, but I wouldn't be surprised if there was. @spammster:Fawkes is still a creature, just like all other super mutants. However, if he is able to sit, eat and sleep via AI packages (I haven't played enough of Fallout 3 to observe this behaviour or any noticeable lack of it) then other super mutants will have the same animations available to them, as they use the same skeleton. @Five_X:The first thing I notice about your code is that you seem unsure about indentation of "else", "endif" and "End" statements. You also have a missing "endif" statement in your MenuMode block. I recommend that you have a look at my Script Validator, as it will help you find and correct these errors. IsWeaponInList only takes one parameter of type FormList, so your missing "int" parameter error is coming from elsewhere. Looking at your script, I notice that you've used the following expression in the same condition as IsWeaponInList:IsKeyPressed == 38However, if you look at the FOSE documentation of IsKeyPressed, you'll see that it returns a boolean value, and takes the DirectX scancode as a parameter - this is your missing "int" parameter. That condition should read like this:if IsKeyPressed 38 && player.IsWeaponInList SniperChangeCipscis Link to comment Share on other sites More sharing options...
5ivexxxxx Posted October 11, 2009 Share Posted October 11, 2009 I made some changes, and now the script kinda works. The problem is, when I press the J key (I switched IsKeyPressed 38 to 36), nothing happens when I have the right weapon equipped. I made all the changes you suggested, and used your script validator, but it still won't open the menu when I press the key. Link to comment Share on other sites More sharing options...
Cipscis Posted October 11, 2009 Author Share Posted October 11, 2009 That would be because you never actually call ShowMessage. Try using this instead for your GameMode block:Begin GameMode if Switch if IsKeyPressed 36 if player.IsWeaponInList SniperChange else;if player.IsWeaponInList SniperChange == 0 set Switch to 0 endif else;if IsKeyPressed 36 == 0 set Switch to 0 endif elseif IsKeyPressed 36 if player.IsWeaponInList SniperChange set Switch to 1 ShowMessage <YourMessage> endif endif EndCipscis Link to comment Share on other sites More sharing options...
5ivexxxxx Posted October 12, 2009 Share Posted October 12, 2009 Alright, it works now. At first it wouldn't switch projectiles (the menu would still appear) but I fixed that. Thanks! Link to comment Share on other sites More sharing options...
crom131 Posted October 12, 2009 Share Posted October 12, 2009 Question? is there a way that i can use just the warhamer 40K Edition Enclave commander, and not change all the remainding enclave and all else i just whant to be able to have enclave, ,brotherhood,etc, and all outhers match there fire power,and fight warhammer troop's as my own faction,do i have to overhal all enclave and outher factions to use this mod or can i just use the call strike of my own personal warhammer 2k troop's to mix and match my fun,please if anyone has done this without the replacer let me know,looks like a nice mix of a mod.. ;] Link to comment Share on other sites More sharing options...
Cipscis Posted October 12, 2009 Author Share Posted October 12, 2009 @Five_X:Glad to hear you've got it working. @crom131:From the OP:Don't...ask questions about using mods - this thread is for answering questions about creating modsYou did read the OP before you posted here, didn't you? I've never used "Enclave Commander" so I don't know if your request is possible, but I recommend that you either ask in the comments section of that mod (or its [RELz] thread if one is linked to) or create a new thread for your question. P.S. I don't want to sound like a grammar nazi, but please place a space character after your commas (i.e. "word, word" as opposed to "word,word"). Your post is quite difficult to read in its current state. Cipscis Link to comment Share on other sites More sharing options...
EARACHE42 Posted October 14, 2009 Share Posted October 14, 2009 New Quick Question: Can I use the getbuttonpress function within the GameMode block of a quest script? I have used button press before, but always within an OnActivate block. Here's the (abbreviated) code that is giving me trouble. Begin Gamemode Showmessage SelectAction ; 0=one, 1=both, 2=Exitset Button to getbuttonpressedIF Button != 2 ; if exit is selected, skips all the codeif Button == 1 ; both selected, so include the second actionAction on second itemEndifAction on first itemEndIFENDShowmessage box displays fine, but code reacts as if no choice was selected. Do I have to make a token and an onEquip block to get this to work? This is a utility mod design to load run and exit., so I want the menu to display immediately upon game load. Link to comment Share on other sites More sharing options...
Cipscis Posted October 14, 2009 Author Share Posted October 14, 2009 Yes you can. In fact, GetButtonPressed should just about always be used in a GameMode block. The reason why your script isn't working is probably because you're calling ShowMessage right before GetButtonPressed each time. This means that the script is looking for a button press from the most recent message, but since no time has passed (it's in the same frame) the player can't possibly have pressed a button. You'll want to use a "bDoOnce" variable in order to only call ShowMessage once:int bDoOnce Begin Gamemode if bDoOnce else;if bDoOnce == 0 set bDoOnce to 1 Showmessage SelectAction; 0=one, 1=both, 2=Exit endif set Button to getbuttonpressed IF Button != 2; if exit is selected, skips all the code if Button == 1; both selected, so include the second action Action on second item Endif Action on first item EndIF ENDCipscis Link to comment Share on other sites More sharing options...
Recommended Posts