Jump to content

Help with NONE ref ownership


lasere200

Recommended Posts

This is what I came up with. I don't know if it's gonna work without problems though. This game is such a mess.

				set ORefEvil to 0
				set OCellEvil to 0
				if player.IsInInterior
					set ORef to WeaponRef.GetParentCellOwner
				else
					set ORef to WeaponRef.GetOwner
				endif
				set OCell to WeaponRef.GetParentCellOwner
				
				if ORef && (ORef != Player) && (ORef != PlayerFaction)
					MessageEx "%n - %n" OCell ORef					
					if GetType ORef == 8
						set ORefEvil to (ListGetFormIndex ALEnhLEvilFactions ORef >= 0)
					elseif ORef.IsActorEvil
						set ORefEvil to 1
					endif
				elseif OCell && (OCell != Player) && (OCell != PlayerFaction)
					if GetType OCell == 8
						set OCellEvil to (ListGetFormIndex ALEnhLEvilFactions OCell >= 0)
					elseif OCell.IsActorEvil
						set OCellEvil to 1
					endif
				endif

As for Rooster Cogburn... That's my Rad Child build :D

Link to comment
Share on other sites

This is a little tricky, but I think I understand what the problem is. GetOwner returns a base form, not a reference. Therefore, (ORef != Player) or (OCell != Player) will always evaluate as true. The player is a special object and does not actually have a persistent base form in the GECK you could use here. Try replacing Player with Player.GetBaseObject. The result should be interesting.

Link to comment
Share on other sites

Well it works. Thank you. I thought I was done but... unfortunately ORef.IsActorEvil is ending the script on NPCs like Carter from Prison Cell B. I think this is because ORef is set to Carter by GetOwner while in the geck he has the faction abbreviation in front - NCRCFCarter. Is there any way to deal with this?

 

In case it matters the item this happens on is the Powder Charge Schematic in Prison Cell B which is a Note (49).

	if ALEnhGNotes
		set NoteRef to GetFirstRef 49 1 0
		Label 49
		if IsFormValid NoteRef
			if Player.GetDistance NoteRef < 200 && NoteRef.GetDisabled == 0
				set ORefEvil to 0
				set OCellEvil to 0
				set ORef to NoteRef.GetOwner
				set OCell to NoteRef.GetParentCellOwner
				if ORef && (ORef != Player.GetBaseObject) && (ORef != PlayerFaction)
					if GetType ORef == 8
						set ORefEvil to (ListGetFormIndex ALEnhLEvilFactions ORef >= 0)
					elseif ORef.IsActorEvil
						set ORefEvil to 1
					endif
				elseif OCell && (OCell != Player.GetBaseObject) && (OCell != PlayerFaction)
					if GetType OCell == 8
						set OCellEvil to (ListGetFormIndex ALEnhLEvilFactions OCell >= 0)
					elseif OCell.IsActorEvil
						set OCellEvil to 1
					endif
				endif
				if ((OCell == 0) && (ORef == 0)) || (ORef == Player.GetBaseObject) || (ORef == PlayerFaction) || (OCell == Player.GetBaseObject) || (OCell == PlayerFaction) || ((ALEnhGModeSteal == 1) && (Detected == 0)) || ORefEvil || OCellEvil
					NoteRef.Activate Player 1
				endif
			endif
			set NoteRef to Pencil01
			set NoteRef to GetNextRef
			Goto 49
		endif
	endif
Edited by lasere200
Link to comment
Share on other sites

Oh, of course, I completely forgot about IsActorEvil. It fails for the very same reason IsActor does - it expects a reference and you provide a base form. I'm afraid I can't think of any way this can be worked around, since you will face the very same issue with every alignment/faction function. I suppose you could compile a list of all evil NPCs' base forms, but it may prove to be unbelievably tedious. You may need to settle for checking faction ownership only. Though not perfect, I'm pretty sure it would work well 90% of the time, since ownership, in most cases, is by a faction and there are probably not many objects in the game that are owned by evil NPCs.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...