Programmatic access to grass objectsform types via Papyrus?

Post » Fri Feb 14, 2014 12:29 pm

Hi guys.

I have just started playing about with Creation Kit/Papyrus. I am a professional software developer by trade so I am fairly happy with picking up the Papyrus scripting language quickly and have already got a few test plugins working.

I have been inspecting the official Papyrus documentation and can't see a way to programmatically access or create a reference to a Grass object (WorldObjects -> Grass in Creation Kit object window). It seems possible to do this for pretty much every other object type in the game... which is annoying.

Is this a deliberate choice by the developers, or am I missing something?

User avatar
Neliel Kudoh
 
Posts: 3348
Joined: Thu Oct 26, 2006 2:39 am

Post » Fri Feb 14, 2014 4:15 am

Although there is no explicit Grass type, you can still refer to a grass object generically as a base Form or specific ObjectReference. There are currently no Grass-specific scripting functions, so you won't be able to change the unique attributes of your Grass object via script, but you can still manipulate it like any other generic object, and you can use Form or ObjectReference scripting functions on it.

One thing to keep in mind is that the C.K. will not let you fill a property of type Form in the editor. But you can still fill a Form property using TES5Edit or manually in your script using GetFormFromFile. e.g.:

Form SnowGrass01 = Game.GetFormFromFile(0x01cc70, "Skyrim.esm")
User avatar
Sophie Payne
 
Posts: 3377
Joined: Thu Dec 07, 2006 6:49 am

Post » Fri Feb 14, 2014 10:15 am

Thanks egocarib, I got this working, but it looks like once you have a given Grass Form type loaded into Papyrus, there is virtually nothing you can actually do with it. Eg you can't use any of the Game.FindClosest() methods to retrieve some grass instances, and SKSE Cell.GetNumRefs() returns 0 for the count of objects of that type (37) in the current cell.

It's basically like the grass objects don't actually exist as objects (I know they are procedurally created based on the landscape textures, so that's probably why).

Oh well, that's my mod idea out the window!

Thanks anyway. For reference, here was the script I was playing about with:

ScriptName GrassTest Extends Quest{}Event OnInit()	Debug.Notification("GrassTest: init");		RegisterForSingleUpdate(3.0);	EndEventEvent OnUpdate()	Debug.Notification("GrassTest: onUpdate");			; Load grass  from Form ID.	Form FieldGrass01 = Game.GetFormFromFile(0x000135BE, "Skyrim.esm");			; Get the decimal ID.	Int grassID = FieldGrass01.GetFormID();				; Get the SKSE type: kGrass = 37	Int grassType = FieldGrass01.GetType();				; Count how many instances of this type exist in current cell.		Cell kCell = Game.GetPlayer().GetParentCell();	Int totalInstances = kCell.GetNumRefs(grassType);		Debug.Notification("GrassTest: loaded grass! id:"+grassID+" type:"+grassType+" total:"+totalInstances);		; Locate closest instance (never seems to find any!).	ObjectReference closestGrass = Game.FindClosestReferenceOfTypeFromRef(FieldGrass01, Game.GetPlayer(), 20.0);EndEvent
User avatar
GEo LIme
 
Posts: 3304
Joined: Wed Oct 03, 2007 7:18 pm

Post » Fri Feb 14, 2014 1:38 pm

Looks like you're right about this one. Right clicking a Grass object in the CK and getting "Use Info" shows that grass is used as part of texture data, so it must be loaded as part of the actual texture of the landscape itself instead of as ObjectReferences in the world. And some texture sets have three or four different types of grass in their "Grass" list, so it would be difficult to determine which is being used. Sorry to mislead you. :confused:

User avatar
Jenna Fields
 
Posts: 3396
Joined: Mon Dec 11, 2006 11:36 am

Post » Fri Feb 14, 2014 4:02 am

No problem at all.

I guess this explains why nobody has ever made a Skyrim mod that interacts with grass before :D I just wanted to create a simple mod that made the grass react to the players movement, ie. have it part slightly as the player moves through it, like you see in some other games (Fable, Guild Wars etc). Not physics based(that would pretty much destroy even the fastest gaming rigs), but just slightly tweak the rotation and/or angle of the grass sprite to make it "appear" to move.

I don't think this will be possible if we can't gain access to the grass sprites however!

User avatar
Devils Cheek
 
Posts: 3561
Joined: Sun Aug 13, 2006 10:24 pm

Post » Fri Feb 14, 2014 4:51 am

It is done by changing the code of grass shader, not by a mod.
User avatar
Stephanie Kemp
 
Posts: 3329
Joined: Sun Jun 25, 2006 12:39 am

Post » Fri Feb 14, 2014 12:40 am

Care to elaborate on this? I didn't realize we could customize/override things like the grass shaders?

User avatar
No Name
 
Posts: 3456
Joined: Mon Dec 03, 2007 2:30 am

Post » Fri Feb 14, 2014 12:06 am

Try to ask on ENB forum.
User avatar
Rebecca Clare Smith
 
Posts: 3508
Joined: Fri Aug 04, 2006 4:13 pm


Return to V - Skyrim