mentilreq Posted November 8, 2011 Share Posted November 8, 2011 I am having trouble figuring out why my game crashes when this script runs. I did notice it seems to happen if the player and the mannequin are the only ones in the cell (Victors Shack, Good Springs Home 4) SCN MrMannequinQuestScript Ref Man Begin GameMode Set Man to GetFirstRef 200 0 0 Label 1 If Man.GetIsRace aaaMRMannequinRace Man.SetActorsAi 0 Set Man to Pencil01; Apple Bug Set Man to GetNextRef GoTo 1 EndIfEnd Any help would be greatly appreciated. Link to comment Share on other sites More sharing options...
tunaisafish Posted November 8, 2011 Share Posted November 8, 2011 Don't run functions on references that could possibly be NULL (which will return 'false' in a conditional).Simply add a 'If Man' statement directly after the 'Label 1' line, and the corresponding EndIf just before 'End'. Link to comment Share on other sites More sharing options...
mentilreq Posted November 8, 2011 Author Share Posted November 8, 2011 Don't run functions on references that could possibly be NULL (which will return 'false' in a conditional).Simply add a 'If Man' statement directly after the 'Label 1' line, and the corresponding EndIf just before 'End'. Not sure if you mean that I should remove the "If Man.GetIsRace aaaMRMannequinRace" and just use "If man". Doing that set the ai on all npc's to 0. Link to comment Share on other sites More sharing options...
tunaisafish Posted November 8, 2011 Share Posted November 8, 2011 No, add the extra condition so that you will be checking for the NULL value that is returned when the refwalk is complete. I changed the code within the loop too to what you probably want it to do. SCN MrMannequinQuestScript Ref Man Begin GameMode Set Man to GetFirstRef 200 0 0 Label 1 If Man ;We have a valid reference in Man If Man.GetIsRace aaaMRMannequinRace ;The ref is of the correct race Man.SetActorsAi 0 EndIf ;Go on to the next reference (if any) Set Man to Pencil01; Apple Bug Set Man to GetNextRef GoTo 1 EndIf End Link to comment Share on other sites More sharing options...
mentilreq Posted November 8, 2011 Author Share Posted November 8, 2011 Well that did it. Thank you. I have been beating my brains out over that for the last three days. Link to comment Share on other sites More sharing options...
Recommended Posts