RemoveAreaGrassOverride(object oArea, int nMaterialId)

From NWN Lexicon
Jump to navigationJump to search
Note: This article documents Neverwinter Nights: Enhanced Edition new content or changes/updates/fixes to 1.69 functions. These are all listed under the category and patches pages.

Removes the grass override for nMaterialId in oArea.

void SetAreaGrassOverride(
    object oArea,
    int nMaterialId
);

Parameters

oArea
The area to remove the override for.
nMaterialId
A surface material, see surfacemat.2da. 3 is the default grass material.

Description

Removes the grass override for nMaterialId in oArea (which was previously set with SetAreaGrassOverride).

Remarks

For convenience, here's a list of the Material IDs that exist in the default surfacemat.2da:

   0 = NotDefined
   1 = Dirt
   2 = Obscuring
   3 = Grass
   4 = Stone
   5 = Wood
   6 = Water
   7 = Nonwalk
   8 = Transparent
   9 = Carpet
   10 = Metal
   11 = Puddles
   12 = Swamp
   13 = Mud
   14 = Leaves
   15 = Lava
   16 = Bottomless Pit
   17 = DeepWater
   18 = Door
   19 = Snow
   20 = Sand
   21 = Barebones
   22 = StoneBridge
   23-29 = Template
   30 = Trigger

Version

This function was added in 1.88.8193.36 of NWN:EE.

Example

The below loops through all areas in a module and clears all grass overrides from each.

void main(){
    // Get the first area in the module, loop while valid.
    object oArea = GetFirstArea();
    while (GetIsObjectValid(oArea)){
        // Remove grass overrides for all materials for the area.
        int i;
        for(i = 0; i <= 30; i++) // 30 is assuming the default surfacemat.2da. A better solution would be to iterate through the 2da to ensure all materials are accounted for.
        {
            RemoveAreaGrassOverride(oArea, 1);
        }
	//Get the next area.	
        oArea = GetNextArea();
    }
}

See Also

functions: SetAreaGrassOverride() SetAreaDefaultGrassDisabled()

---