jackjack86 Posted March 8, 2017 Share Posted March 8, 2017 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 More sharing options...
iXenite Posted March 8, 2017 Share Posted March 8, 2017 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 More sharing options...
jackjack86 Posted March 8, 2017 Author Share Posted March 8, 2017 Yeah I found PreWar Binoculars by a_blind_man but its bassically just a standalone scope (ie doesn't give you range to target) Link to comment Share on other sites More sharing options...
jackjack86 Posted March 9, 2017 Author Share Posted March 9, 2017 I think the script functions I need to use are GetLOS and GetDistance something like Begin OnEquipif (Game.GetPlayer().GetLOS("GetReference"()))messagebox GetDistanceendifend just not sure what I should put for "GetReference" Link to comment Share on other sites More sharing options...
ablindm4n Posted March 9, 2017 Share Posted March 9, 2017 `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 More sharing options...
jackjack86 Posted March 9, 2017 Author Share Posted March 9, 2017 (edited) `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 OnHitif (Game.GetPlayer().HasDetectionLOS(GetDistance()))messagebox GetDistanceendifend Edited March 9, 2017 by jackjack86 Link to comment Share on other sites More sharing options...
jackjack86 Posted March 10, 2017 Author Share Posted March 10, 2017 (edited) 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 ObjectReferenceEvent OnBeginStateRegisterForHitEvent(akAggressorFilter = Game.GetPlayer(), akProjectileFilter = RangeFinderProjectile, abMatch = true)EndEventEvent OnEndStateUnregisterForAllHitEvents()EndEventEvent OnHit(ObjectReference akTarget, ObjectReference akAggressor, Form akSource, Projectile akProjectile, bool abPowerAttack, bool abSneakAttack, bool abBashAttack, bool abHitBlocked, string apMaterial)Debug.MessageBox(GetDistance)EndEvent Edited March 10, 2017 by jackjack86 Link to comment Share on other sites More sharing options...
ablindm4n Posted March 10, 2017 Share Posted March 10, 2017 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 More sharing options...
jackjack86 Posted March 11, 2017 Author Share Posted March 11, 2017 (edited) 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 ConstActor Property PlayerRef Auto ConstWeapon Property RangeFinder Auto ConstSPELL Property RangeFinderCloakAbility Auto ConstEvent OnEquipped(Actor akActor)if akActor = PlayerRefRegisterForSingleUpdate(1)endifEndEventEvent OnUnequipped(Actor akActor)if akActor = PlayerRefPlayerRef.RemoveSpell(RangeFinderCloakAbility)endifEndEventEvent OnUpdate()PlayerRef.AddSpell(RangeFinderCloakAbility, false); How long you would like to keep the cloak activeUtility.Wait(1)PlayerRef.RemoveSpell(RangeFinderCloakAbility); How long until the cloak activates againRegisterForSingleUpdate(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 March 11, 2017 by jackjack86 Link to comment Share on other sites More sharing options...
jackjack86 Posted March 11, 2017 Author Share Posted March 11, 2017 (edited) Reworked it some Scriptname RangeFinderPlrRef extends ObjectReferenceActor Property PlayerRef AutoWeapon Property RangeFinder AutoSPELL Property RangeFinderCloakAbility AutoScriptObject Property aiTimerID AutoScriptObject Property RangeFinderTimerID Autofloat RangeFinderTimerID = 10Event OnEquipped(Actor akActor)if akActor = PlayerRefStartTimer(1, RangeFinderTimerID)endifEndEventEvent OnUnequipped(Actor akActor)if akActor = PlayerRefPlayerRef.RemoveSpell(RangeFinderCloakAbility)endifEndEventEvent OnTimer(int aiTimerID)if aiTimerID == RangeFinderTimerIDPlayerRef.AddSpell(RangeFinderCloakAbility, false); How long you would like to keep the cloak activeStartTimer(1, RangeFinderTimerID)PlayerRef.RemoveSpell(RangeFinderCloakAbility); How long until the cloak activates againStartTimer(4, RangeFinderTimerID)endifEndEvent But now I'm getting "no viable alternative at input '='" at lines 17 & 23 ("if akActor = PlayerRef") Edited March 11, 2017 by jackjack86 Link to comment Share on other sites More sharing options...
Recommended Posts