Agnot2006 Posted September 21, 2011 Share Posted September 21, 2011 I don’t do scripting very often, and mostly glean bits from the forums and combine them to accomplish what I need. I have a quest with a script just for the variables to enable topics depending on what the count is from this object script. But as it stands the quest variables are never updated. Can anyone help with what I did wrong?The script should walk through when I enter an Interior cell and count how many actors, Creatures and dead bodies in the cell. I rem’d out a lot of it hoping to get at least an Actor count but still get nothing so only SBActorCount should contain anything.Can Anyone please help?Scn PennyCellCountObjectScript ref rSBCurrentRef Short SBDeadCount Short SBActorCount Short SBCreatureCount Short SBCountReset Begin GameMode ;If IsInInterior == 1 && SBCountReset == 0 set rSBCurrentRef to GetFirstRef 200 1 0 ; Actors Label 10 if rSBCurrentRef ;If rSBCurrentRef.getdead == 1 ;Set SBDeadCount to SBDeadCount +1 ;elseif rSBCurrentRef.GetIsCreature == 1 ;Set SBCreatureCount to SBCreatureCount + 1 ;else Set SBActorCount to SBActorCount + 1 ;endif ; Do stuff with rSBCurrentRef set rSBCurrentRef to Pencil01 ; Prevent apple bug set rSBCurrentRef to GetNextRef Goto 10 endif ;Set SBCountReset to 1 ;endif If SBDeadCount > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicDead to SBDeadCount ; Quest Topic Variable else Set aaPennyCellCount.SBTopicDead to 0 ; Quest Topic Variable endif If SBActorCount > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicActors to SBActorCount ; Quest Topic Variable else Set aaPennyCellCount.SBTopicActors to 0 ; Quest Topic Variable endif If SBCreatureCount > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicCreature to SBCreatureCount ; Quest Topic Variable else Set aaPennyCellCount.SBTopicCreature to 0 ; Quest Topic Variable endif ;If IsInInterior == 0 Set aaPennyCellCount.SBTopicActors to 0 Set aaPennyCellCount.SBTopicDead to 0 Set aaPennyCellCount.SBTopicCreature to 0 Set SBDeadCount to 0 Set SBActorCount to 0 Set SBCreatureCount to 0 Set SBCountReset to 0 ;endif end Link to comment Share on other sites More sharing options...
rickerhk Posted September 21, 2011 Share Posted September 21, 2011 Is the object in the same cell as the player? If not, the script won't run. You can just as easily add all this to a quest script so it always follows the player. Link to comment Share on other sites More sharing options...
Agnot2006 Posted September 22, 2011 Author Share Posted September 22, 2011 I Thank You for your reply. It’s actually connected to a companion. I am using RRCompanionVault by NosRhyfelwr’s companion scripts and this is embedded inside for this companion. That is a very large script on its own so I didn’t include it, but just to say there is ref Me and an Onload Set Me to GetContainer before the Begin Gamemode and this script.I cant see anything obviously wrong but I’m not a scripter, cutting and pasting from the forum is always risky when you don’t know if items will work together, for that I always use The Validator by Cipscis to check I’ve put the script together without major problems. Link to comment Share on other sites More sharing options...
rickerhk Posted September 22, 2011 Share Posted September 22, 2011 The reason I asked if it was in another cell is because by looking at it, it should be working. I have used ref-walks a bunch, but only in quest scripts. But others have used object scripts for ref walks with no problem. You can use printc to see if the script is even reaching certain points. Also, I guess another obvious question would be are you launching the game with fose_loader.exe since these are FOSE functions. <snip> Begin GameMode ;If IsInInterior == 1 && SBCountReset == 0 printc "Just before GetFirstref" set rSBCurrentRef to GetFirstRef 200 1 0 ; Actors printc "got first ref" Label 10 if rSBCurrentRef ;If rSBCurrentRef.getdead == 1 ;Set SBDeadCount to SBDeadCount +1 ;elseif rSBCurrentRef.GetIsCreature == 1 ;Set SBCreatureCount to SBCreatureCount + 1 ;else Set SBActorCount to SBActorCount + 1 printc "got an actor count" ;endif ; Do stuff with rSBCurrentRef set rSBCurrentRef to Pencil01 ; Prevent apple bug set rSBCurrentRef to GetNextRef Goto 10 endif ;Set SBCountReset to 1 ;endif <snip> Link to comment Share on other sites More sharing options...
Agnot2006 Posted September 23, 2011 Author Share Posted September 23, 2011 Your Right it does work, I like the idiot in my de-bugging I had un-clicked the quest start box I think, I tried so many things I’m not sure now but its working. Could you also help with 2 questions as you have used ref-walks a lot and this is my first time, and my internet PC at home’s Power supply just died on me so I cant find these thing until its fixed. How do I single out the player using the i.e. (if rSBCurrentRef == Player) which doesn’t work?And 2nd this works fine on single cell interiors and resets when were back outside, but I need it to run each time we enter a new cell for multiple cell systems, so the new cell is evaluated as soon as we enter but only once for each cell. So I would have to reset each variable then recheck the new cell as we enter. Can you help with that?I have added the latest version of the script with my attempts to find the player to eliminate him from the count remmed out.; Cell Count If IsInInterior == 1 && SBCountReset == 0 set rSBCurrentRef to GetFirstRef 200 1 0 ; Actors Label 10 if rSBCurrentRef If rSBCurrentRef.getdead == 1 Set SBDeadCount to SBDeadCount + 1 elseif rSBCurrentRef.GetIsCreature == 1 Set SBCreatureCount to SBCreatureCount + 1 else Set SBActorCount to SBActorCount + 1 ;If rSBCurrentRef == PlayerREF == 1 ;Set aaPennyCellCount.SBTopicPlayer to 1 ;else ;Set SBActorCount to SBActorCount + 1 ;endif If rSBCurrentRef.GetIsSex Male == 1 Set SBMales to SBMales + 1 endif If rSBCurrentRef.GetIsSex Female == 1 Set SBFemale to SBFemale + 1 endif endif ; Do stuff with rSBCurrentRef set rSBCurrentRef to Pencil01 ; Prevent apple bug set rSBCurrentRef to GetNextRef Goto 10 endif Set SBCountReset to 1 endif If SBFemale > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicFemales to SBFemale ; Copy to 2ndQuest Topic Variable else Set aaPennyCellCount.SBTopicFemales to 0 ; Copy to 2ndQuest Topic Variable endif If SBMales > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicMales to SBMales; Copy to 2ndQuest Topic Variable else Set aaPennyCellCount.SBTopicMales to 0 ; Copy to 2ndQuest Topic Variable endif If SBDeadCount > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicDead to SBDeadCount ; Copy to Quest Topic Variable else Set aaPennyCellCount.SBTopicDead to 0 ; Copy to Quest Topic Variable endif If SBActorCount > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicActors to SBActorCount ; Copy to Quest Topic Variable else Set aaPennyCellCount.SBTopicActors to 0 ; Copy to Quest Topic Variable endif If SBCreatureCount > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicCreature to SBCreatureCount ; Copy to Quest Topic Variable else Set aaPennyCellCount.SBTopicCreature to 0 ; Copy to Quest Topic Variable endif If IsInInterior == 0 && SBCountReset == 1 Set aaPennyCellCount.SBTopicActors to 0 ; reset Quest Topic Variable Set aaPennyCellCount.SBTopicDead to 0 ; reset Quest Topic Variable Set aaPennyCellCount.SBTopicCreature to 0 ; reset Quest Topic Variable Set aaPennyCellCount.SBTopicPlayer to 0 Set aaPennyCellCount.SBTopicFemales to 0 Set aaPennyCellCount.SBTopicMales to 0 Set SBDeadCount to 0 Set SBActorCount to 0 Set SBCreatureCount to 0 Set SBCountReset to 0 Set SBMales to 0 Set SBFemale to 0 endif ; Cell Count End Link to comment Share on other sites More sharing options...
rickerhk Posted September 23, 2011 Share Posted September 23, 2011 If rSBCurrentRef == PlayerAlways works for meIf rSBCurrentRef == PlayerREF == 1is not a construct that I ever use. I never use PlayerREF either, just Player, but I don't think that matters. You can use GetParentCell to track when your actor changes cells. Also, note that GetFirstRef 200 1 0 will pick up refs from 9 cells when exterior - the current cell and 8 surrounding cells. So that will throw off your counts unless you use GetFirstRef 200 0 0. ref rPreviousCell ref rCurrentCell short iDoScan ; Cell Count set rCurrentCell to GetParentCell ;Get current cell this actor is in if rCurrentCell == rPreviousCell set iDoScan to 0 ;No cell change else set iDoScan to 1 ;Enable scan endif if iDoScan If IsInInterior == 1 && SBCountReset == 0 set rSBCurrentRef to GetFirstRef 200 1 0 ; Actors Label 10 if rSBCurrentRef If rSBCurrentRef.getdead == 1 Set SBDeadCount to SBDeadCount + 1 elseif rSBCurrentRef.GetIsCreature == 1 Set SBCreatureCount to SBCreatureCount + 1 else Set SBActorCount to SBActorCount + 1 If rSBCurrentRef == Player Set aaPennyCellCount.SBTopicPlayer to 1 else Set SBActorCount to SBActorCount + 1 endif If rSBCurrentRef.GetIsSex Male == 1 Set SBMales to SBMales + 1 endif If rSBCurrentRef.GetIsSex Female == 1 Set SBFemale to SBFemale + 1 endif endif ; Do stuff with rSBCurrentRef set rSBCurrentRef to Pencil01 ; Prevent apple bug set rSBCurrentRef to GetNextRef Goto 10 endif Set SBCountReset to 1 endif If SBFemale > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicFemales to SBFemale ; Copy to 2ndQuest Topic Variable else Set aaPennyCellCount.SBTopicFemales to 0 ; Copy to 2ndQuest Topic Variable endif If SBMales > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicMales to SBMales; Copy to 2ndQuest Topic Variable else Set aaPennyCellCount.SBTopicMales to 0 ; Copy to 2ndQuest Topic Variable endif If SBDeadCount > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicDead to SBDeadCount ; Copy to Quest Topic Variable else Set aaPennyCellCount.SBTopicDead to 0 ; Copy to Quest Topic Variable endif If SBActorCount > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicActors to SBActorCount ; Copy to Quest Topic Variable else Set aaPennyCellCount.SBTopicActors to 0 ; Copy to Quest Topic Variable endif If SBCreatureCount > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicCreature to SBCreatureCount ; Copy to Quest Topic Variable else Set aaPennyCellCount.SBTopicCreature to 0 ; Copy to Quest Topic Variable endif If IsInInterior == 0 && SBCountReset == 1 Set aaPennyCellCount.SBTopicActors to 0 ; reset Quest Topic Variable Set aaPennyCellCount.SBTopicDead to 0 ; reset Quest Topic Variable Set aaPennyCellCount.SBTopicCreature to 0 ; reset Quest Topic Variable Set aaPennyCellCount.SBTopicPlayer to 0 Set aaPennyCellCount.SBTopicFemales to 0 Set aaPennyCellCount.SBTopicMales to 0 Set SBDeadCount to 0 Set SBActorCount to 0 Set SBCreatureCount to 0 Set SBCountReset to 0 Set SBMales to 0 Set SBFemale to 0 endif set rPreviousCell to rCurrentCell ;Setup for next cell change endif ; Cell Count End Link to comment Share on other sites More sharing options...
Agnot2006 Posted September 23, 2011 Author Share Posted September 23, 2011 I just finished fitting my new Power Supply and this is the first page I went too. That fantastic Info Thank You very much, I will give it a try as soon as I finish putting this PC back together and tucked away. Thank You Again Link to comment Share on other sites More sharing options...
Agnot2006 Posted September 23, 2011 Author Share Posted September 23, 2011 Everything is working fine after I made some adjustment to my part of the script.I removed the SBCountReset variable all together as it was stopping the re-scan and moved all my variable resets up right under your Set iDoScan to 1 so everything is reset to zero just before the next scan. Still No Joy with the Player variable SBTopicPlayer is just not being setI use SQV questname in the consol to get the variable status If I and my companion are in a room together and the SBActorCount is 1 Is it counting my companion (who is running the script) or the player? I have added a script copy of the changes I made.Is there a way of refining the scan even further i.e. detect Mutants and raiders? ; Cell Count set rCurrentCell to GetParentCell ;Get current cell this actor is in if rCurrentCell == rPreviousCell set iDoScan to 0 ;No cell change else set iDoScan to 1 ;Enable scan Set aaPennyCellCount.SBTopicActors to 0 ; reset Quest Topic Variable Set aaPennyCellCount.SBTopicDead to 0 ; reset Quest Topic Variable Set aaPennyCellCount.SBTopicCreature to 0 ; reset Quest Topic Variable Set aaPennyCellCount.SBTopicPlayer to 0 Set aaPennyCellCount.SBTopicFemales to 0 Set aaPennyCellCount.SBTopicMales to 0 Set SBDeadCount to 0 Set SBActorCount to 0 Set SBCreatureCount to 0 Set SBMales to 0 Set SBFemale to 0 endif if iDoScan If IsInInterior == 1 set rSBCurrentRef to GetFirstRef 200 0 0 ; Actors Label 10 if rSBCurrentRef If rSBCurrentRef.getdead == 1 Set SBDeadCount to SBDeadCount + 1 elseif rSBCurrentRef.GetIsCreature == 1 Set SBCreatureCount to SBCreatureCount + 1 else If rSBCurrentRef == Player Set aaPennyCellCount.SBTopicPlayer to 1 else Set SBActorCount to SBActorCount + 1 endif If rSBCurrentRef.GetIsSex Male == 1 Set SBMales to SBMales + 1 endif If rSBCurrentRef.GetIsSex Female == 1 Set SBFemale to SBFemale + 1 endif endif ; Do stuff with rSBCurrentRef set rSBCurrentRef to Pencil01 ; Prevent apple bug set rSBCurrentRef to GetNextRef Goto 10 endif endif If SBFemale > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicFemales to SBFemale ; Copy to 2ndQuest Topic Variable else Set aaPennyCellCount.SBTopicFemales to 0 ; Copy to 2ndQuest Topic Variable endif If SBMales > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicMales to SBMales; Copy to 2ndQuest Topic Variable else Set aaPennyCellCount.SBTopicMales to 0 ; Copy to 2ndQuest Topic Variable endif If SBDeadCount > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicDead to SBDeadCount ; Copy to Quest Topic Variable else Set aaPennyCellCount.SBTopicDead to 0 ; Copy to Quest Topic Variable endif If SBActorCount > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicActors to SBActorCount ; Copy to Quest Topic Variable else Set aaPennyCellCount.SBTopicActors to 0 ; Copy to Quest Topic Variable endif If SBCreatureCount > 0 && IsInInterior == 1 Set aaPennyCellCount.SBTopicCreature to SBCreatureCount ; Copy to Quest Topic Variable else Set aaPennyCellCount.SBTopicCreature to 0 ; Copy to Quest Topic Variable endif set rPreviousCell to rCurrentCell ;Setup for next cell change endif ; Cell Count End Link to comment Share on other sites More sharing options...
rickerhk Posted September 24, 2011 Share Posted September 24, 2011 Now that i'm thinking about it, I'm not sure scanning for actors will ever include the player.you can put a couple of printc statements to verify this.Right below both the GetFirstRef and the GetNextRef statements, put this line: printc "Actor FormID %i, Name %n", rSBCurrentRef, rSBCurrentRef You can capture all this to a file by going to the console, and typescof "MytestCellscan.txt" Then go into another cell, exit, and take a look at MytestCellscan.txt, located in your fallout3 directory (not data). If the player isn't there in the text file - it shouldn't matter because GetFirstRef and GetNextref only operate on the cell that the player is in anyway, so you know that statement If rSBCurrentRef == Player would have returned true every time the scan ran. The ref walk, by not including the player would also explain why the count is 1 when you are alone with the companion. It's just counting actors - your follower. The player is technically not an actor, I guess. To further distinguish between creatures, there is this: http://geck.bethsoft.com/index.php/GetIsCreatureType Link to comment Share on other sites More sharing options...
Agnot2006 Posted September 24, 2011 Author Share Posted September 24, 2011 Thank You, I will check it outI have grabbed the GetIsCreatureType Info will give that a go as well. I have also changed the script again to test for creature ect and then if its dead, so it will either show a live or dead creature not count it twice once as creature and once as dead. Thanks Again Link to comment Share on other sites More sharing options...
Recommended Posts