TimeShadow Posted September 16, 2014 Share Posted September 16, 2014 (edited) I'm trying to write a script where a switch is activated but only if a condition is meet ( having an item in player inventory). This is a simple script, as I'm not a scripter (I just stumble through scripts), I don't see why this would not work. All that I have done is add the condition to the GetOpenState line. Line added: " && ( Player.GetItemCount Camera > 1 ) " scn aaBMHQstPAFusePanelSCRIPT Ref FusePanelRef BEGIN GameMode set FusePanelRef to GetLinkedRef If ( GetOpenState == 1 ) && ( Player.GetItemCount Camera > 0 ) FusePanelRef.Enable 0 elseif ( GetOpenState == 3 ) FusePanelRef.Disable 0 Endif END Camera in not the actual item, I will probably use a key or something that is not visible (or removable) in player inventory so that once the items are gathered the key will be added and then the switch will function as a normal switch. I have tried so many iterations of this and can't figure it out. I don't know what scripting language the GECK uses, so I don't know what to look for, for help. Any help would be greatly appreciated ...Thank you, ~TS Edited September 17, 2014 by TimeShadow Link to comment Share on other sites More sharing options...
rickerhk Posted September 17, 2014 Share Posted September 17, 2014 The way it is written, you need at least two cameras in your inventory for it to enable. Link to comment Share on other sites More sharing options...
grigoriprime Posted September 17, 2014 Share Posted September 17, 2014 if changing " > " to " >= " doesn't fix it... Try having two switches with one that does nothing. Then link them both to an X marker that is set as their enable parent. If you set the non functioning switch to have "set enable state to opposite of parent" and set the marker itself to be "initially disabled" then enabling the marker when the key is first picked up will swap out the dummy switch for the real one and you don't have to worry about it. If you either set your key item to have on pickup scripting (look at the magic 8 ball script as a reference) and set it as a quest item, it will do the swap when the player picks it up and will be un droppable (though you could also use "on drop" scripting to swap it back if you wanted to). As a footnote, you can use "on activate" scripting on items that you can't use. The game still says "you cannot equip this item" but trying will still trigger the scripts. Link to comment Share on other sites More sharing options...
TimeShadow Posted September 17, 2014 Author Share Posted September 17, 2014 (edited) Yes ... it is linked to an x-marker with it initially disabled. This was the only part of the script that was having problems, this is the actual script. The problem is that script that actually works (the one here), only turn on (activates) the panel (activator) once. You can't turn it on and off. scn aaBMHQstPAFusePanelSCRIPT Int SkillScience Int Item1 Int Item2 Int TurnOn BEGIN OnActivate Player If ( Player.GetAV Science >= 40 ) && ( Player.GetItemCount 00BMHQstPAGenPanelFuse01 >= 4 ) && ( Player.GetItemCount aaBMHQstPANoteStartQuest == 1 ) ShowMessage aaBMHQstPAFusePanelActvSuccesMSG Player.RemoveItem 00BMHQstPAGenPanelFuse01 4 1 Set TurnOn to 1 Elseif ( Player.GetAV Science >= 30 && Player.GetItemCount BookSkillScience >= 2 ) && ( Player.GetItemCount 00BMHQstPAGenPanelFuse01 >= 4 ) && ( Player.GetItemCount aaBMHQstPANoteStartQuest == 1 ) ShowMessage aaBMHQstPAFusePanelActvSuccesMSG Player.RemoveItem BookSkillScience 2 1 Player.RemoveItem 00BMHQstPAGenPanelFuse04 1 1 Set TurnOn to 1 Elseif ( Player.GetItemCount aaBMHQstPANoteStartQuest == 1 ) Set skillScience to Player.GetAV Science Set item1 to Player.GetItemCount 00BMHQstPAGenPanelFuse01 Set item2 to Player.GetItemCount BookSkillScience ShowMessage aaBMHQstPAFusePanelFailMSG, SkillScience, item1, item2 Set TurnOn to 0 Endif Endif If ( GetStage 00BMHPoweringArmoryQST == 10 ) SetStage 00BMHPoweringArmoryQST 20 ; Moves quest to the next stage. Endif END BEGIN GameMode If ( TurnOn == 1 ) If ( IsActionRef Player == 1 ) aaBMHFuseBoxON01REF.Enable 0 ; Will activate fuse panel. Endif Endif END ; Attach script to Fuse Panel (activator). You will notice that it no longer uses " GetLinkedRef " or " GetOpenState ". So once again, once it is turned on it stay on. I can live with that. But problem with this fixed script is that when the panel is activated from here on out it will always show the " ShowMessage aaBMHQstPAFusePanelFailMSG, SkillScience, item1, item2 " colored (pink) line . I would be nice to have a yet uncreated message the would appear (example - Fuse Panel is Active ... ). Edit: colored line didn't show up in the post. Edited September 17, 2014 by TimeShadow Link to comment Share on other sites More sharing options...
africaisstarving Posted September 26, 2014 Share Posted September 26, 2014 (edited) I didn't read thru the entire code but I can see what the problem is.Seems to me you got 2 endifs when you should have only one. That confuses the game and script doesn't run properly. Second what you want is toggle right? To toggle and item is really easy . Something like this:if REF.getDisabled == 0REF.disableelseif REF.getDisabled == 1REF.enableendifNow you can add a bit of delay between uses but when you click once it activate. When you click again it de-activates. For your code to work try combining all similar code short success ;default is always 0 if getItemCount questitem > 0 (better than == 1..safer in case user has 2 for whatever reason )if science skill >= 50show messageset success to 1elseif science skill >= 40 and science book && get item count skillbook > 0set succces to 1remove item skillbookelseif science skill < 40show mesage failendifendif ; endif of the quest itemif success == 1if REF.getDisabled == 0REF.disableelseif REF.getDisabled == 1REF.enableendifendifthat way when an user has the quest item and has proper skil lor skill book he can toggle on off the REF . Not my code is not real code is pseudo code. Is up to you to make it work for your variable names etc. Edited September 26, 2014 by africaisstarving Link to comment Share on other sites More sharing options...
africaisstarving Posted September 26, 2014 Share Posted September 26, 2014 (edited) TO clarify. The problem you are having is here if 1>>>>> If ( Player.GetAV Science >= 40 ) && ( Player.GetItemCount 00BMHQstPAGenPanelFuse01 >= 4 ) && ( Player.GetItemCount aaBMHQstPANoteStartQuest == 1 ) ShowMessage aaBMHQstPAFusePanelActvSuccesMSG Player.RemoveItem 00BMHQstPAGenPanelFuse01 4 1 Set TurnOn to 1 end of if 1>>>>>> Elseif ( Player.GetAV Science >= 30 && Player.GetItemCount BookSkillScience >= 2 ) && ( Player.GetItemCount 00BMHQstPAGenPanelFuse01 >= 4 ) && ( Player.GetItemCount aaBMHQstPANoteStartQuest == 1 ) ShowMessage aaBMHQstPAFusePanelActvSuccesMSG Player.RemoveItem BookSkillScience 2 1 Player.RemoveItem 00BMHQstPAGenPanelFuse04 1 1 Set TurnOn to 1 end of if 2>>>> Elseif ( Player.GetItemCount aaBMHQstPANoteStartQuest == 1 ) Set skillScience to Player.GetAV Science Set item1 to Player.GetItemCount 00BMHQstPAGenPanelFuse01 Set item2 to Player.GetItemCount BookSkillScience ShowMessage aaBMHQstPAFusePanelFailMSG, SkillScience, item1, item2 Set TurnOn to 0 end of if 3 >>>> Endif ????? >>>> Endif Edited September 26, 2014 by africaisstarving Link to comment Share on other sites More sharing options...
Recommended Posts