Quick Questions -- Quick Answers, The Twentieth

Post » Sun Sep 20, 2009 6:53 am

Well, given that the game has no real sense of distance between 2 woldspaces, or where they join, it won't be able to do it in once clean swoop, but could you not use something like:

Short Dist1Short Dist2Short DistTotalSet Dist1 Player.GetDistance {OutsideDoorReference to the city}Set Dist2 {InsideDoorReference to the city}.GetDistance {MarkerReference}Set DistTotal to ( Dist1 + Dist2 )

However, this might kick up a few issues.
This won't measure the complete distance as the crow flies. It'll probably be slightly longer than that, due to using the door to the city as a joining point. For example, if the player were standing exactly where the marker would be in the city, then it would have a relatively high value, where it should be 0.

A few ways to make this simpler would be to either set the marker where the marker would be in the city, but in the real worldspace (if it's set out like tamriel, where every city is empty in the Tamriel worldspace, and then has it's own worldspace which is actually the city) and just have 1 GetDistance; or find out the distance between the Inside Door and the marker (presuming the marker won't move), and then just adding that value instead of Dist2.

Hope that helped!
User avatar
Killer McCracken
 
Posts: 3456
Joined: Wed Feb 14, 2007 9:57 pm

Post » Sun Sep 20, 2009 2:32 pm

Well, given that the game has no real sense of distance between 2 woldspaces, or where they join, it won't be able to do it in once clean swoop, but could you not use something like:
Thanks for the suggestion, but unfortunately, I don't think this is a solution for me. I wasn't clear in my previous post, but what I need is a general way to find the distance to any map marker the player may happen to point at in the world map. And there's no way of knowing which door that leads out of the worldspace that the marker happens to be in...
User avatar
BlackaneseB
 
Posts: 3431
Joined: Sat Sep 23, 2006 1:21 am

Post » Sun Sep 20, 2009 1:10 pm

Ah; well I'm not sure if that would be possible or not, especially given whatever height the terrain would be! Sorry.
User avatar
Imy Davies
 
Posts: 3479
Joined: Fri Jul 14, 2006 6:42 pm

Post » Sun Sep 20, 2009 4:50 pm

Is there any way to find the distance from the player to an object in another worldspace? Specifically, I need to find the distance from the player to various map markers. "set distance to marker.GetDistance Player" works fine as long as the markers are in the same worldspace as the player, but returns an extremely large number (floatmax+) for markers in other worldspaces, e.g. to a marker inside a city when the player is outside the city, or vice versa. But is there a way to find the distance to those markers too?
Very doubtful. Exterior cells aren't persistent in memory as it is, much less different worldspaces.
User avatar
Abi Emily
 
Posts: 3435
Joined: Wed Aug 09, 2006 7:59 am

Post » Sun Sep 20, 2009 2:38 pm

For map markers on the Tamriel map, you can take advantage of the fact that City worldspaces maintain the same coordinates as their exteriors in Tamriel worldspace and calculate the horizontal distance from the XY coordinates of the two points.

I use this User Function:
scn zuGetDistanceXYXY;---------------------------------------------------------------------	;	Returns the horizontal distance between two XY points;---------------------------------------------------------------------	float posX1float posX2float posY1float posY2float difXfloat difYfloat disbegin Function { posX1, posY1, posX2,  posY2 } 	let difX := posX1 - posX2 	let difY := posY1 - posY2 	let dis := ( difX * difX ) + ( difY * difY )	SetFunctionValue  sqrt disEnd



Or, if you want 3D distance, as retuned from GetDistance:

scn zuGetDistanceXYZXYZ;---------------------------------------------------------------------	;	Returns the 3D distance between two XYZ points;---------------------------------------------------------------------	float difXfloat difYfloat difZfloat disfloat posX1float posX2float posY1float posY2float posZ1float posZ2begin Function { posX1, posY1, posZ1, posX2,  posY2, posZ2 } 	let difX := posX1 - posX2 	let difY := posY1 - posY2 	let difZ := posZ1 - posZ2 	let dis := ( difX * difX ) + ( difY * difY )	let dis := sqrt dis	let dis := (difZ * difZ ) +  (dis * dis ) 	let dis := sqrt dis	SetFunctionValue  disEnd

User avatar
.X chantelle .x Smith
 
Posts: 3399
Joined: Thu Jun 15, 2006 6:25 pm

Post » Sun Sep 20, 2009 3:55 am

For map markers on the Tamriel map, you can take advantage of the fact that City worldspaces maintain the same coordinates as their exteriors in Tamriel worldspace and calculate the horizontal distance from the XY coordinates of the two points.
Does getPos (or any other function) return valid values when called on objects in remote worldspaces ?
User avatar
Nick Pryce
 
Posts: 3386
Joined: Sat Jul 14, 2007 8:36 pm

Post » Sun Sep 20, 2009 7:07 am

MapMarkers are always persistent, so GetPos should return the correct position.
Just tested and it does.
(I guess persistent objects have a Data Block somewhere in memory and all that GetPos does is give you the value of one of the fields)
User avatar
Andrew Lang
 
Posts: 3489
Joined: Thu Oct 11, 2007 8:50 pm

Post » Sun Sep 20, 2009 4:57 am

A quick question on the "IF" statement.

If I have 3 "IF" statements in a script, each one ended with an "ENDIF" statement, will the game process each "IF" statement until one is true? Or does it only move on to the next "IF" statement if the previous one was true?
User avatar
James Hate
 
Posts: 3531
Joined: Sun Jun 24, 2007 5:55 am

Post » Sun Sep 20, 2009 3:08 am

Depends on nesting:
if ( thing 1 )	if ( thing 2 )		if ( thing 3 )			; this code runs when all three things are true		endif	endifendif

versus
if ( thing 1 )	; this runs if thing 1 is true, regardless of the veracity of things 2 and 3endifif ( thing 2 )	; this runs if thing 2 is true, regardless of the veracity of things 1 and 3endifif ( thing 3 )	; this runs if thing 3 is true, regardless of the veracity of things 1 and 2endif

Does that make sense?

This is also why indenting your code is an exceptionally good idea.
User avatar
phil walsh
 
Posts: 3317
Joined: Wed May 16, 2007 8:46 pm

Post » Sun Sep 20, 2009 3:44 pm

Is there a way to save a script that has unknown variables in it.

For example, I want to create cross mod compatibility by using variables in another mod, however without having that mod loaded I cannot save the script. In a case like this one needs to create a seperate patch. However if the script could save with unknown variables, and didn't break ingame if they don't exist then you could make a "one size fits all .esp"
User avatar
adame
 
Posts: 3454
Joined: Wed Aug 29, 2007 2:57 am

Post » Sun Sep 20, 2009 3:08 pm

Is there a way to save a script that has unknown variables in it.
No, but there's a quite simple workaround provided by OBSE.

For example, I want to create cross mod compatibility by using variables in another mod, however without having that mod loaded I cannot save the script. In a case like this one needs to create a seperate patch. However if the script could save with unknown variables, and didn't break ingame if they don't exist then you could make a "one size fits all .esp"

You can do this by using OBSE. There are a number of OBSE functions to help you. The three most useful are:

IsModLoaded "Modname" Returns true if "Modname" is active in your load order.
GetFormFromMod "formId" "Modname" Returns a fully working reference to the formId defined in the other mod.
RunScriptLine "scriptline" Does not compile "scriptline" in the CS, but lets you run that line ingame. This can be used for what you're asking. Ex:
RunScriptLine "set OtherModsScriptName.VariableName to <something>"

User avatar
KIng James
 
Posts: 3499
Joined: Wed Sep 26, 2007 2:54 pm

Post » Sun Sep 20, 2009 3:25 pm

Thank you very, very much.
User avatar
Luis Longoria
 
Posts: 3323
Joined: Fri Sep 07, 2007 1:21 am

Post » Sun Sep 20, 2009 5:40 am

For map markers on the Tamriel map, you can take advantage of the fact that City worldspaces maintain the same coordinates as their exteriors in Tamriel worldspace and calculate the horizontal distance from the XY coordinates of the two points.

Thanks. That seems like a good solution. Is this specific for the Tamriel worldspace, or can I assume this for other city worldspaces as well (SI, Windfall, etc.).

I need this to implement a request in Map Marker Overhaul, to make Fast Travel useable only for short distances, and I therefore need the distance to the map marker the player happens to point at. Your function is still useful even if it doesn't work for all cities, as at worst it means that Fast Travel cannot be made into/out of those cities where it doesn't work.


As for MapMarkers being available even if its cell is not loaded, that is a general trait of persistent references, I believe. Ex, here's the description form OBSE's GetFirstRefInCell function: "Note that if the specified is not loaded in memory, this function will only return persistent references."
User avatar
Sheeva
 
Posts: 3353
Joined: Sat Nov 11, 2006 2:46 am

Post » Sun Sep 20, 2009 4:33 pm

... Is this specific for the Tamriel worldspace, or can I assume this for other city worldspaces as well (SI, Windfall, etc.).

I don't know about other worldspaces.
You can check by comparing the XYZ positions of the outside gate (in the exterior worldspace) and the inside gate (in the city worldspace). If they are about the same, it is like Tamriel.
User avatar
gemma king
 
Posts: 3523
Joined: Fri Feb 09, 2007 12:11 pm

Post » Sun Sep 20, 2009 3:52 am

I'm back!

I've just made a snazzy little rug; but when I hover a light over it, it doesn't get brighter (as every other object would). I've checked the material in NifSkope, and it's got the same ambient, diffuse, emissive... etc colours as the mesh it's placed on (a stone corridor thing I made too); and that lights up - just not the rug. When I place it in an outside worldspace, then it's lit up to the colour of the skybox light, but again, it won't respond to standalone lights that you can position in the CS.
Has this got anything to do with being so close to the other mesh, or because it only has about 4 faces? It has a normal map, too!

Cheers!

EDIT: some more info I just thought might be useful after testing.
It's part of the .NIF with the stone (to save me the hassle of placing lots of rugs!). Imagine one of those rugs that leads up to the throne in most of the castles in Vanilla Oblivion, that's the sort of rug we're talking about. It's attached in the .NIF in such a way: NiNode (Number 0, so it's the first thing) > NiNode > NiTriStrips; whereas everything else (except the pillars) are like NiNode > NiTriStrips. The texture file's called RedRug_01 and RedRug_01_n (would the multiple _'s confuse it for the _n part?). All of the other rugs light up and stuff (the vanilla rugs this is) so I'm doubting it's to do with being close to the floor!

Oh, don't worry, I've solved it. It was the multiple _'s in the filename. Does this mean you can't have underscores in any .DDSs, without it ignoring glow maps, normal maps, etc?

User avatar
Oscar Vazquez
 
Posts: 3418
Joined: Sun Sep 30, 2007 12:08 pm

Post » Sun Sep 20, 2009 2:57 pm

RunScriptLine "scriptline" Does not compile "scriptline" in the CS, but lets you run that line ingame. This can be used for what you're asking. Ex:
RunScriptLine "set OtherModsScriptName.VariableName to <something>"

Why does this line cause a CTD?

	RunScriptLine "Player.SetFactionRank xxxxGuardFaction, 0"


Where xxxxGuardFaction is a valid EditorID for a faction.

http://obse.silverlock.org/obse_command_doc.html#RunScriptLine
User avatar
Je suis
 
Posts: 3350
Joined: Sat Mar 17, 2007 7:44 pm

Post » Sun Sep 20, 2009 5:35 am

Why does this line cause a CTD?
The problem is your use of the EditorId "xxxxGuardFaction", since editorId's are only available in the CS, and not during runtime.
This is the same reason that "Player.Additem Gold001 10" works in a script, while "Player.Additem F 10" works in the console (or from RunScriptLine), where "F" (00000F) is the formID of Gold0001

When you save/compile a script in the CS, the CS replaces the editorId with the correct formId in the compiled script. So you must replace "xxxxGuardFaction" with its formId. But since I guess xxxxGuardFaction is defined in another, non-master mod, you must probably do something like:
set factionRef to GetFormFromMod "modname" "formId"...Player.SetFactionRank factionRef 0

where formId is the six last digits of the actual formId of xxxxGuardFaction.
User avatar
lolly13
 
Posts: 3349
Joined: Tue Jul 25, 2006 11:36 am

Post » Sun Sep 20, 2009 6:27 am

Thanks again.
User avatar
des lynam
 
Posts: 3444
Joined: Thu Jul 19, 2007 4:07 pm

Post » Sun Sep 20, 2009 6:38 am

Scripting

Is there a way to detect if a weapon is out? As opposed to just having it equipped?
User avatar
Gisela Amaya
 
Posts: 3424
Joined: Tue Oct 23, 2007 4:29 pm

Post » Sun Sep 20, 2009 3:31 am

Scripting

Is there a way to detect if a weapon is out? As opposed to just having it equipped?
isWeaponOut
User avatar
Colton Idonthavealastna
 
Posts: 3337
Joined: Sun Sep 30, 2007 2:13 am

Post » Sun Sep 20, 2009 2:52 am

isWeaponOut

Bah, of course! You could nearly guess that. :shakehead:
User avatar
Veronica Martinez
 
Posts: 3498
Joined: Tue Jun 20, 2006 9:43 am

Post » Sun Sep 20, 2009 2:02 am

Hi I'm making a town but in Distant LOD I can't see it. I understood you have to tick a box or something for each mesh (house) I want visible. Where is this box? Or is there a quicker way doing this? The LOD shows everything as it should and my question can be formulated this way also: How did Oblivion get the White Gold Tower visible from everywhere?
User avatar
Nicole Mark
 
Posts: 3384
Joined: Wed Apr 25, 2007 7:33 pm

Post » Sun Sep 20, 2009 6:46 am

Hi I'm making a town but in Distant LOD I can't see it. I understood you have to tick a box or something for each mesh (house) I want visible. Where is this box? Or is there a quicker way doing this? The LOD shows everything as it should and my question can be formulated this way also: How did Oblivion get the White Gold Tower visible from everywhere?

Double click on the object in the Render Window. The "Visible When Distant" box is just below the "Persistent Reference" box.
User avatar
Rhi Edwards
 
Posts: 3453
Joined: Fri Jul 28, 2006 1:42 am

Post » Sun Sep 20, 2009 2:28 pm

I'm having a problem with a custom misc item. I exported it with collision from max using this tutorial:
http://cs.gamesas.com/constwiki/index.php/3ds_Max:_Misc_Items

I can move it in-game with the move key, but each time I drop it to the ground/floor it falls through.

Any ideas what might cause this ? I'm pretty sure I've seen this one answered, but can't find it.
User avatar
Michael Korkia
 
Posts: 3498
Joined: Mon Jul 23, 2007 7:58 pm

Post » Sun Sep 20, 2009 2:12 pm

Anyone knows what this kind of message means?

"AnimGroup 'Foward' for 'InnAnvSherylHodgesRef (01005229) -> Sheryl Hodges (0100483F)' was exported with 'Animate in Place' from MAX"

Thanks in advance.
User avatar
Bellismydesi
 
Posts: 3360
Joined: Sun Jun 18, 2006 7:25 am

PreviousNext

Return to IV - Oblivion