Jump to content

Advanced Recon Range Finder port to FO4?


Recommended Posts

I've been looking for a range finder mod to use in conjunction with Weapons of Fate. Then I remembered that I used Advanced Recon Range Finder for New Vegas. I wondered what would be needed to make a successful port to FO4?

 

Obviously fo4se would be a requirement, but could it be implemented with just a dll or go the way Gopher did with an esp?

Link to comment
Share on other sites

Pretty sure you'd need to completely rebuild the mod. I can imagine the scripts are not transferable. Though I thought there was one sort of mod of Gopher's that someone basically made their own version of for FO4, but I can't recall if it was like Advanced Recon Rangefinder or something else.

Link to comment
Share on other sites

I think the script functions I need to use are GetLOS and GetDistance

 

something like

 

 

Begin OnEquip
if (Game.GetPlayer().GetLOS("GetReference"()))
messagebox GetDistance
endif
end

 

 

just not sure what I should put for "GetReference"

Link to comment
Share on other sites

`HasDetectionLOS` is the new FO4 version of `GetLOS` - but that just returns a bool. You might be able to get `GetDistance` working by using a dummy projectile to get the ObjRef of the item you're looking at, then using that to find the distance though.

 

F4SE doesn't open up any relevant functionality yet, so a plugin would be needed to get it working properly.

Link to comment
Share on other sites

`HasDetectionLOS` is the new FO4 version of `GetLOS` - but that just returns a bool. You might be able to get `GetDistance` working by using a dummy projectile to get the ObjRef of the item you're looking at, then using that to find the distance though.

 

F4SE doesn't open up any relevant functionality yet, so a plugin would be needed to get it working properly.

So, if i'm hearing you right the script would look something like this

 

Begin OnHit

if (Game.GetPlayer().HasDetectionLOS(GetDistance()))

messagebox GetDistance

endif

end

 

Edited by jackjack86
Link to comment
Share on other sites

I've been reading up on OnHit Events and I guess I have to register and unregister. Just not sure how to begin and end those

 

Here's my script so far (CK is not compiling for "Object reference not set to an instance of an object.")

 

Scriptname RangeFinderScript extends ObjectReference

Event OnBeginState
RegisterForHitEvent(akAggressorFilter = Game.GetPlayer(), akProjectileFilter = RangeFinderProjectile, abMatch = true)
EndEvent

Event OnEndState
UnregisterForAllHitEvents()
EndEvent

Event OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked, string apMaterial)
Debug.MessageBox(GetDistance)
EndEvent

 

Edited by jackjack86
Link to comment
Share on other sites

 

So, if i'm hearing you right the script would look something like this

Begin OnHit
if (Game.GetPlayer().HasDetectionLOS(GetDistance()))
messagebox GetDistance
endif
end

 

`GetDistance` takes an ObjectReference and returns a float value for that distance, so you can't pass that information into `HasDetectionLOS`, because that also takes an ObjectReference. It would be more like:

if (Game.GetPlayer().HasDetectionLOS(EnemyReference))
    return Game.GetPlayer().GetDistance(EnemyReference)
endif

The difficult part is getting the EnemyReference of the thing you are looking at.

 

If you want to use an OnHit event to do it then you'll need to attach the script to the NPC in order to register it for hits before it is actually hit. This means you will probably want to attach scripts dynamically to all Actors in a certain range of the player while the rangefinders are equipped, but that might be a lot of actors if you want the rangefinders to have a long maximum range.

Link to comment
Share on other sites

Got through most of that with minimal compiling issues but I can't add scripts to my PlayerAlias. Tried to compile a similar PlayerScript to my weapon

Scriptname RangeFinderPlrRef extends ObjectReference Const

Actor Property PlayerRef Auto Const

Weapon Property RangeFinder Auto Const

SPELL Property RangeFinderCloakAbility Auto Const

Event OnEquipped(Actor akActor)
if akActor = PlayerRef
RegisterForSingleUpdate(1)
endif
EndEvent

Event OnUnequipped(Actor akActor)
if akActor = PlayerRef
PlayerRef.RemoveSpell(RangeFinderCloakAbility)
endif
EndEvent

Event OnUpdate()
PlayerRef.AddSpell(RangeFinderCloakAbility, false)
; How long you would like to keep the cloak active
Utility.Wait(1)
PlayerRef.RemoveSpell(RangeFinderCloakAbility)
; How long until the cloak activates again
RegisterForSingleUpdate(4)
EndEvent

 

but it won't compile. I'm not sure but I think it's the OnUpdate (edit: just found out that's a skyrim event, need to use FO4 equivalents(OnTimer and StartTimer)) conflicting with the OnEquipped/Unequipped Events.

 

 

Also, everytime I save in the CK it removes Binoculars.esp from the Master List...

Edited by jackjack86
Link to comment
Share on other sites

Reworked it some

Scriptname RangeFinderPlrRef extends ObjectReference

Actor Property PlayerRef Auto

Weapon Property RangeFinder Auto

SPELL Property RangeFinderCloakAbility Auto

ScriptObject Property aiTimerID Auto

ScriptObject Property RangeFinderTimerID Auto

float RangeFinderTimerID = 10


Event OnEquipped(Actor akActor)
if akActor = PlayerRef
StartTimer(1, RangeFinderTimerID)
endif
EndEvent

Event OnUnequipped(Actor akActor)
if akActor = PlayerRef
PlayerRef.RemoveSpell(RangeFinderCloakAbility)
endif
EndEvent

Event OnTimer(int aiTimerID)
if aiTimerID == RangeFinderTimerID
PlayerRef.AddSpell(RangeFinderCloakAbility, false)
; How long you would like to keep the cloak active
StartTimer(1, RangeFinderTimerID)
PlayerRef.RemoveSpell(RangeFinderCloakAbility)
; How long until the cloak activates again
StartTimer(4, RangeFinderTimerID)
endif
EndEvent

 

But now I'm getting "no viable alternative at input '='" at lines 17 & 23 ("if akActor = PlayerRef")

Edited by jackjack86
Link to comment
Share on other sites

  • Recently Browsing   0 members

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