AnotherGuy98 Posted December 4, 2016 Share Posted December 4, 2016 (edited) Hi, I made a mod "QuestSide" and along the way during the development one of the quests stopped working correctly, the issue is that during part of the quest if you put a specific item in the proper container it is supposed to update the quest, in game it doesn't do this. I can't find the problem with the script... looking at it, it should work but idk. Any Idea why it doesn't work? The quest starts with iDoOne set to 1, the problem comes when it's time for the pick up to be set, Which is when the item is placed in the container by the PC SCN PackageDeliveryQuestScript Short iDoOnceShort PickupShort DecisionShort RockShort DoneBeforeShort SpawnShort Ambush Begin Gamemode If iDoOnce ==1 && Decision ==0 && getstage aaPD ==1Set Decision to (Decision + GetRandomPercent)Set iDoOnce to 2Endif;__________________________________________________________________________; Which box If Decision ==0 && iDoOnce ==2Set Decision to (Decision + GetRandomPercent)Endif If Decision >0 && Decision <=10 && iDoOnce ==2Setstage aaPD 10Set iDoOnce to 3Endif If Decision >10 && Decision <=20 && iDoOnce ==2Setstage aaPD 20Set iDoOnce to 3Endif If Decision >20 && Decision <=30 && iDoOnce ==2Setstage aaPD 30Set iDoOnce to 3Endif If Decision >30 && Decision <=40 && iDoOnce ==2Setstage aaPD 40Set iDoOnce to 3Endif If Decision >40 && Decision <=50 && iDoOnce ==2Setstage aaPD 50Set iDoOnce to 3Endif If Decision >50 && Decision <=60 && iDoOnce ==2Setstage aaPD 51Set iDoOnce to 3Endif If Decision >60 && Decision <=70 && iDoOnce ==2Setstage aaPD 52Set iDoOnce to 3Endif If Decision >70 && Decision <=80 && iDoOnce ==2Setstage aaPD 53Set iDoOnce to 3Endif If Decision >80 && Decision <=90 && iDoOnce ==2Setstage aaPD 54Set iDoOnce to 3Endif If Decision >90 && Decision <=100 && iDoOnce ==2Setstage aaPD 55Set iDoOnce to 3Endif ;__________________________________________________________________________ If iDoOnce ==3 && Pickup ==0Set Pickup to (Pickup + GetRandomPercent)Set iDoOnce to 4Endif;__________________________________________________________________________; Rock one stages If Pickup ==0 && iDoOnce ==4Set Pickup to (Pickup + GetRandomPercent)Endif If Pickup >0 && Pickup <=50 && iDoOnce ==4 && aaDBox1.Getitemcount aaChems >=1 && getstage aaPD 10Setstage aaPD 60Set iDoOnce to 5Player.additem aaRockNote1 1aaDBox1.removeitem aaChems 1aaRock1.additem aaPay 1Endif If Pickup >0 && Pickup <=50 && iDoOnce ==4 && aaDBox2.Getitemcount aaChems >=1 && getstage aaPD 20Setstage aaPD 61Set iDoOnce to 5Player.additem aaRockNote1 1aaDBox2.removeitem aaChems 1aaRock1.additem aaPay 1Endif If Pickup >0 && Pickup <=50 && iDoOnce ==4 && aaDBox3.Getitemcount aaChems >=1 && getstage aaPD 30Player.additem aaRockNote1 1aaRock1.additem aaPay 1aaDBox3.removeitem aaChems 1Setstage aaPD 62Set iDoOnce to 5Endif If Pickup >0 && Pickup <=50 && iDoOnce ==4 && aaDBox4.Getitemcount aaChems >=1 && getstage aaPD 40Setstage aaPD 63Set iDoOnce to 5Player.additem aaRockNote1 1aaDBox4.removeitem aaChems 1aaRock1.additem aaPay 1Endif If Pickup >0 && Pickup <=50 && iDoOnce ==4 && aaDBox5.Getitemcount aaChems >=1 && getstage aaPD 50 Setstage aaPD 64Set iDoOnce to 5Player.additem aaRockNote1 1aaDBox5.removeitem aaChems 1aaRock1.additem aaPay 1Endif If Pickup >0 && Pickup <=50 && iDoOnce ==4 && aaDBox6.Getitemcount aaChems >=1 && getstage aaPD 51 Setstage aaPD 65Set iDoOnce to 5Player.additem aaRockNote1 1aaDBox6.removeitem aaChems 1aaRock1.additem aaPay 1Endif If Pickup >0 && Pickup <=50 && iDoOnce ==4 && aaDBox7.Getitemcount aaChems >=1 && getstage aaPD 52Setstage aaPD 66Set iDoOnce to 5Player.additem aaRockNote1 1aaDBox7.removeitem aaChems 1aaRock1.additem aaPay 1Endif If Pickup >0 && Pickup <=50 && iDoOnce ==4 && aaDBox8.Getitemcount aaChems >=1 && getstage aaPD 53Setstage aaPD 67Set iDoOnce to 5Player.additem aaRockNote1 1aaDBox8.removeitem aaChems 1aaRock1.additem aaPay 1Endif If Pickup >0 && Pickup <=50 && iDoOnce ==4 && aaDBox9.Getitemcount aaChems >=1 && getstage aaPD 54Setstage aaPD 68Set iDoOnce to 5Player.additem aaRockNote1 1aaDBox9.removeitem aaChems 1aaRock1.additem aaPay 1Endif If Pickup >0 && Pickup <=50 && iDoOnce ==4 && aaDBox10.Getitemcount aaChems >=1 && getstage aaPD 55Setstage aaPD 69Set iDoOnce to 5Player.additem aaRockNote1 1aaDBox10.removeitem aaChems 1aaRock1.additem aaPay 1Endif ;_________________________________________________________________________; Rock two stages If Pickup >50 && Pickup <=100 && iDoOnce ==4 && aaDBox1.Getitemcount aaChems >=1Setstage aaPD 70Set iDoOnce to 5Player.additem aaRockNote2 1aaDBox1.removeitem aaChems 1aaRock2.additem aaPay 1Endif If Pickup >50 && Pickup <=100 && iDoOnce ==4 && aaDBox2.Getitemcount aaChems >=1Setstage aaPD 71Set iDoOnce to 5Player.additem aaRockNote2 1aaDBox2.removeitem aaChems 1aaRock2.additem aaPay 1Endif If Pickup >50 && Pickup <=100 && iDoOnce ==4 && aaDBox3.Getitemcount aaChems >=1Setstage aaPD 72Set iDoOnce to 5Player.additem aaRockNote2 1aaDBox3.removeitem aaChems 1aaRock2.additem aaPay 1Endif If Pickup >50 && Pickup <=100 && iDoOnce ==4 && aaDBox4.Getitemcount aaChems >=1Setstage aaPD 73Set iDoOnce to 5Player.additem aaRockNote2 1aaDBox4.removeitem aaChems 1aaRock2.additem aaPay 1Endif If Pickup >50 && Pickup <=100 && iDoOnce ==4 && aaDBox5.Getitemcount aaChems >=1Setstage aaPD 74Set iDoOnce to 5Player.additem aaRockNote2 1aaDBox5.removeitem aaChems 1aaRock2.additem aaPay 1Endif If Pickup >50 && Pickup <=100 && iDoOnce ==4 && aaDBox6.Getitemcount aaChems >=1Setstage aaPD 75Set iDoOnce to 5Player.additem aaRockNote2 1aaDBox6.removeitem aaChems 1aaRock2.additem aaPay 1Endif If Pickup >50 && Pickup <=100 && iDoOnce ==4 && aaDBox7.Getitemcount aaChems >=1Setstage aaPD 76Set iDoOnce to 5Player.additem aaRockNote2 1aaDBox7.removeitem aaChems 1aaRock2.additem aaPay 1Endif If Pickup >50 && Pickup <=100 && iDoOnce ==4 && aaDBox8.Getitemcount aaChems >=1Setstage aaPD 77Set iDoOnce to 5Player.additem aaRockNote2 1aaDBox8.removeitem aaChems 1aaRock2.additem aaPay 1Endif If Pickup >50 && Pickup <=100 && iDoOnce ==4 && aaDBox9.Getitemcount aaChems >=1Setstage aaPD 78Set iDoOnce to 5Player.additem aaRockNote2 1aaDBox9.removeitem aaChems 1aaRock2.additem aaPay 1Endif If Pickup >50 && Pickup <=100 && iDoOnce ==4 && aaDBox10.Getitemcount aaChems >=1Setstage aaPD 79Set iDoOnce to 5Player.additem aaRockNote2 1aaDBox10.removeitem aaChems 1aaRock2.additem aaPay 1Endif ;__________________________________________________________________________; Spawn some raiders If Pickup >75 && Pickup <=100 && iDoOnce ==4 && Spawn ==0Set Spawn to 1aaRock2.placeatme EncFiendRandom 4Endif If Pickup >25 && Pickup <=50 && iDoOnce ==4 && Spawn ==0Set Spawn to 1aaRock1.placeatme EncFiendRandom 4Endif ; Box spawn If Decision >6 && Decision <=10 && iDoOnce ==4 && Ambush ==0Set Ambush to 1aaDBox1.Placeatme EncFiendRandom 3Endif If Decision >16 && Decision <=20 && iDoOnce ==4 && Ambush ==0Set Ambush to 1aaDBox2.Placeatme EncFiendRandom 3Endif If Decision >26 && Decision <=30 && iDoOnce ==4 && Ambush ==0Set Ambush to 1aaDBox3.Placeatme EncFiendRandom 3Endif If Decision >36 && Decision <=40 && iDoOnce ==4 && Ambush ==0Set Ambush to 1aaDBox4.Placeatme EncFiendRandom 3Endif If Decision >46 && Decision <=50 && iDoOnce ==4 && Ambush ==0Set Ambush to 1aaDBox5.Placeatme EncFiendRandom 3Endif If Decision >56 && Decision <=60 && iDoOnce ==4 && Ambush ==0Set Ambush to 1aaDBox6.Placeatme EncFiendRandom 3Endif If Decision >66 && Decision <=70 && iDoOnce ==4 && Ambush ==0Set Ambush to 1aaDBox7.Placeatme EncFiendRandom 3Endif If Decision >76 && Decision <=80 && iDoOnce ==4 && Ambush ==0Set Ambush to 1aaDBox5.Placeatme EncFiendRandom 3Endif If Decision >86 && Decision <=90 && iDoOnce ==4 && Ambush ==0Set Ambush to 1aaDBox5.Placeatme EncFiendRandom 3Endif If Decision >96 && Decision <=100 && iDoOnce ==4 && Ambush ==0Set Ambush to 1aaDBox5.Placeatme EncFiendRandom 3Endif ;__________________________________________________________________________; complete the correct stages If iDoOnce ==5 && Getstage aaPD <70 && GetStage aaPD >=60 && player.Getitemcount aaPay >=1Setstage aaPD 80Set iDoOnce to 6Endif If iDoOnce ==5 && Getstage aaPD <80 && GetStage aaPD >=70 && Player.Getitemcount aaPay >=1Setstage aaPD 85Set iDoOnce to 6Endif;__________________________________________________________________________; ask about delivery If DoneBefore ==1 && Player.gethasnote aaPDLoc ==0player.additem aaPDLoc 1Endif End Edited December 4, 2016 by zombieslaya1990 Link to comment Share on other sites More sharing options...
dubiousintent Posted December 4, 2016 Share Posted December 4, 2016 (edited) Without digging into details, overall you have too many compound conditionals (&&) which make it both difficult and unlikely to work out which are succeeding. ALL of the conditions in the compound chain must be true to proceed to the "then" statements. So it could be any one of them which is causing the failure. Try splitting them up along the lines of any condition which is repeated should have subsequent instances as nested conditions under it instead. For example, In "Rock one stage": If Pickup >0 && Pickup <=50 if iDoOnce ==4 IF aaDBox1.Getitemcount aaChems >=1 if getstage aaPD 10 Setstage aaPD 60 Set iDoOnce to 5 Player.additem aaRockNote1 1 aaDBox1.removeitem aaChems 1 aaRock1.additem aaPay 1 elseif getstage aaPD 20 Setstage aaPD 61 Set iDoOnce to 5 Player.additem aaRockNote1 1 aaDBox2.removeitem aaChems 1 aaRock1.additem aaPay 1 elseif getstage aaPd (##) etc. ; else "fall through" endif ;getstage aaPD ; Else "fall through" Endif ;aaDBox1.Getitemcount IF aaDBox2.Getitemcount aaChems >=1 if getstage aaPD 20 ... (etc.)... ; else "fall through" endif ;getstage aaPD ; Else "fall through" Endif ;aaDBox2.Getitemcount ; else "fall through" endif ;iDoOnce ==4 ;ELSE "do nothing" Endif ;Pickup >0 && Pickup <=50 Then you can insert messages to tell which conditions are actually returning "true". This will also be more efficient as you will only need to test unique conditions once instead of repeatedly. Though I do believe there is a limit (12?) to how deep you may nest conditions in GECK. You should also always bear in mind what will happen when a condition "fails" (returns false). In effect every "If" (or "elseif") should have an "else". If you intent that nothing should happen in that circumstance, then leave a comment to that effect so you know later that was considered and the intended result. All of that takes more lines of code but makes it easier to follow and narrow down where your logic is failing. In the long run, that is much more important. -Dubious- Edited December 5, 2016 by dubiousintent Link to comment Share on other sites More sharing options...
AnotherGuy98 Posted December 5, 2016 Author Share Posted December 5, 2016 (edited) the problem is with the getitemcount for each container... every other part worked, I tried as you had sugestedI don't understand how it wouldn't work, the refid is correct, and the item to place is the correct one given to the player when the quest starts. this is quite frustraitingit doesn't work regardless of the item that it is set to, but it does work if it is supposed to find 0 of the item in it Edited December 5, 2016 by zombieslaya1990 Link to comment Share on other sites More sharing options...
dubiousintent Posted December 5, 2016 Share Posted December 5, 2016 (edited) Here is where someone much more familiar with GECK than I should be able to help, but in the meantime try putting a space after the comparison operator (i.e. ">= 1"). Sometimes parsers get finicky about spaces when doing comparisons as opposed to assignments. You can also try assigning the result of the "Getitemcount" to a variable and then comparing the variable. That way you can display the variable value in a message to confirm you are actually getting something to compare with. Testing against a variable instead of repeatedly calling a function is also more efficient. -Dubious- Edited December 5, 2016 by dubiousintent Link to comment Share on other sites More sharing options...
Mktavish Posted December 6, 2016 Share Posted December 6, 2016 If Pickup ==0 && iDoOnce ==4 Set Pickup to (Pickup + GetRandomPercent) ; has potential to = 0 Endif If Pickup >0 ~~~~~~~~~~~~~ Are you wanting that 1% chance to not be true ? And do you have some scripting in the Quest stages ? what do they look like? Plus the containers ??? Link to comment Share on other sites More sharing options...
AnotherGuy98 Posted December 6, 2016 Author Share Posted December 6, 2016 (edited) in that part if pickup ==0 again then If i am right it would still meet the requirements for the if statement and be tried again. i've since changed the script a lot to no avail, it works up until the GetItemCount and then wont work .i've used messages to show each part working, the only time the message doesn't show is at the getitemcount stage, I even tried changing the object which didn't work either. Edited December 6, 2016 by zombieslaya1990 Link to comment Share on other sites More sharing options...
Mktavish Posted December 6, 2016 Share Posted December 6, 2016 Is "aaDBox1" a base-id object or a reference ? If it's a base-id try checking the Quest Item box.Otherwise I would say to pass the ref-id. Link to comment Share on other sites More sharing options...
AnotherGuy98 Posted December 6, 2016 Author Share Posted December 6, 2016 It's a ref ID, I tried changing it to a base ID, and checking quest item before and it didn't work Link to comment Share on other sites More sharing options...
Mktavish Posted December 6, 2016 Share Posted December 6, 2016 Well after running a quick test my self ... Dropped a container in at good springs ... placed a 10mm pistol next to it. Gave the container a ref-ID and flagged persistent. Then made a Quest script that looks like this ... SCN MyTestAddScript Begin GameMode If zzmytestFootRef.GetItemCount Weap10mmPistol >= 1 Player.additem WeapAlienBlaster 1 100 endifend ~~~~~~~~~~~~~~~~~ Then made a quest ... set it as start game enabled , set it's delay to 1.0 and attached the script. Went in game and it's adding AlienBlasters to my inventory every second (that I'm in game mode)After placing the 10mm in the footlocker. Stops when taking it out. So should be working for you ... unless there is a problem with the item it's checking for ?What is "aaChems" exactly ? Link to comment Share on other sites More sharing options...
AnotherGuy98 Posted December 6, 2016 Author Share Posted December 6, 2016 It's a misc item, I also tried switching the item to TinCan01... it didn't do anything either, same result Link to comment Share on other sites More sharing options...
Recommended Posts