Setting An xMarker As An EnableDisableref

Post » Thu Jun 21, 2012 5:06 am

Instead of using an ontrigger event I would like something a little different

I placed an xMarker and put DefaultEnableDisableLinkedRef script that should enable another xMaker that has several bad guys attached to it as enabled parent.

What I need to do is have a condition where if the player is within Xunits of the xMaker it triggers the bandits.

Something like:

if game.getplayer().IsWithinXunits() == trueThen the script to enable the linked ref.endif

Any ideas?

I really don't want to use a trigger box because I would have to make it quite large and it would clutter up the area for future stuff I might want to add.

Thanks!
User avatar
Josh Lozier
 
Posts: 3490
Joined: Tue Nov 27, 2007 5:20 pm

Post » Thu Jun 21, 2012 4:36 pm

Don’t know if this will help, but I found this:

http://www.creationkit.com/GetDistance_-_ObjectReference

Also, you can select your trigger prim, hit the 1 key 2x to hide it while you’re cluttering your area, but you probably already know that. Also, hitting the M key hides stuff as well.
User avatar
Nick Jase Mason
 
Posts: 3432
Joined: Sun Jul 29, 2007 1:23 am

Post » Thu Jun 21, 2012 12:10 pm

Something like...
Spoiler
ScriptName ProximityBanditEnablerScript extends ObjectReferenceFloat fDistance = 2048.0Actor Property PlayerREF AutoEvent OnLoad()	If GetLinkedRef().IsDisabled()		RegisterForUpdate(1.5)	EndIfEndEventEvent OnUnload()	If GetLinkedRef().IsDisabled()		UnregisterForUpdate()	EndIf	EndEventEvent OnUpdate()	If GetDistance(PlayerREF) < fDistance		GetLinkedRef().Enable() ; Enable linked, initially disabled parent XMarker along with children Bandits		UnregisterForUpdate()	EndIfEndEvent
...should do it.

Edit: Syntax/Autocomplete mishaps
User avatar
Doniesha World
 
Posts: 3437
Joined: Sun Jan 07, 2007 5:12 pm

Post » Thu Jun 21, 2012 9:53 am

Thanks for the syntax Justin

But there are two Events for every event. So I had to delete one (you had Event Event)

But the other error I don't know how to fix, it says:

cannot initialize a float to 2048

I tired taking it down to 1048 but still got that error on compiling.
User avatar
phil walsh
 
Posts: 3317
Joined: Wed May 16, 2007 8:46 pm

Post » Thu Jun 21, 2012 10:27 am

I think floats have to have a decimal point. So 2048.00 should work. Good old fussy syntax.
User avatar
..xX Vin Xx..
 
Posts: 3531
Joined: Sun Jun 18, 2006 6:33 pm

Post » Thu Jun 21, 2012 7:02 am

Make it 2048.0 and it will compile.

Float fDistance = 2048 compiles if it is within an event, too. I'm not sure why there's a difference.
User avatar
Hayley O'Gara
 
Posts: 3465
Joined: Wed Nov 22, 2006 2:53 am

Post » Thu Jun 21, 2012 10:58 am

Thanks leonfenten

The script works now but it won't let me link to the other xMarker. The little target stays red.
User avatar
Isaiah Burdeau
 
Posts: 3431
Joined: Mon Nov 26, 2007 9:58 am

Post » Thu Jun 21, 2012 3:17 pm

It doesn't for me. Can you select the marker by name?
User avatar
X(S.a.R.a.H)X
 
Posts: 3413
Joined: Tue Feb 20, 2007 2:38 pm

Post » Thu Jun 21, 2012 10:38 am

It doesn't for me. Can you select the marker by name?

Naw

It only lists some of the objects around it. Like the bandit and some other things.

edit

I can select the bandit ok...but I don't know if the other bandits will be able to use that bandit as a parent in order to be enabled/disabled.
User avatar
Dan Scott
 
Posts: 3373
Joined: Sun Nov 11, 2007 3:45 am

Post » Thu Jun 21, 2012 8:48 pm

Justin

What does this line do?

UnregisterForUpdate()
User avatar
Stefanny Cardona
 
Posts: 3352
Joined: Tue Dec 19, 2006 8:08 pm

Post » Thu Jun 21, 2012 5:10 am

It'll stop the OnUpdate event from running when it's done its thing.
User avatar
Cash n Class
 
Posts: 3430
Joined: Wed Jun 28, 2006 10:01 am

Post » Thu Jun 21, 2012 5:56 pm

It'll stop the OnUpdate event from running when it's done its thing.

OK..thanks :smile:

It's not compiling though. :/

edit

I don't mean compiling ... I mean not allowing to point to the xmarker.
User avatar
Andrea P
 
Posts: 3400
Joined: Mon Feb 12, 2007 7:45 am

Post » Thu Jun 21, 2012 8:31 am

If the XMarker is as a property rather than a linked REF, the property will have to match the EditorID of the XMarker exactly or it'll not autofill.
User avatar
Matthew Barrows
 
Posts: 3388
Joined: Thu Jun 28, 2007 11:24 pm

Post » Thu Jun 21, 2012 7:04 pm

If the XMarker is as a property rather than a linked REF, the property will have to match the EditorID of the XMarker exactly or it'll not autofill.

I copied and pasted the editorID of the xMarker (EnableBanditsxMarker) and the bandit was enabled before I get within the 500 units I set it to.

edit

I just went back and the ref is set to None. So it didn't take
User avatar
Stephy Beck
 
Posts: 3492
Joined: Mon Apr 16, 2007 12:33 pm

Post » Thu Jun 21, 2012 7:38 pm

Mmmmm... That's odd. Try manually pointing it? Usually, if a properties name matches an EDID, autofill will point it correctly.
User avatar
Josh Trembly
 
Posts: 3381
Joined: Fri Nov 02, 2007 9:25 am

Post » Thu Jun 21, 2012 8:57 am

Mmmmm... That's odd. Try manually pointing it? Usually, if a properties name matches an EDID, autofill will point it correctly.

I even tried to point it to the location marker. But the marker didn't show in the drop down.

But I think the ForceGreet will work for this, but I still have a few bugs to work out.
User avatar
Eddie Howe
 
Posts: 3448
Joined: Sat Jun 30, 2007 6:06 am

Post » Thu Jun 21, 2012 7:42 am

Just to be clear: you know the PlayerRef property in JustinOther's code should be filled with the player, and then you should doubleclick on the marker reference you placed in the world, and in the LinkedRef tab of the edit window, add a new reference to the marker you want to enable?
User avatar
Cagla Cali
 
Posts: 3431
Joined: Tue Apr 10, 2007 8:36 am


Return to V - Skyrim