Hey, so I'm making a map and it involves items spawning on the ground, but I want it to spawn somewhere pathable.
In short: How do I use JASS to check for terrain at a given point?
I want a given item to only spawn on the ground if the terrain is, say, Dalaran - Grass. (I'm using this terrain because I've set... say, Dalaran - Trim Grass, under unpathable things like trees and doodads.) I have a trigger for the rest of the item spawning that's all fine and well, but this is the part of the trigger I want to troubleshoot:
EDIT:
I used this guide by deathismyfriend to convert a trigger with only "If (Terrain type at (L)) equal to Dalaran - Grass" to JASS. I pulled what I think is what I need from that, so now my trigger looks like this:
Am I right to use this, or is there a better/less stupid way?
EDIT 2: Looks like it works. Items are generating and I noticed none of them generating on tiles that weren't Dalaran - Grass. I'll strike this edit out and bump the thread if I later on notice that they're generating on other terrain types. Until then, leaving this up for posterity because Google didn't help me how I wanted when I was originally trying to figure this out.
In short: How do I use JASS to check for terrain at a given point?
I want a given item to only spawn on the ground if the terrain is, say, Dalaran - Grass. (I'm using this terrain because I've set... say, Dalaran - Trim Grass, under unpathable things like trees and doodads.) I have a trigger for the rest of the item spawning that's all fine and well, but this is the part of the trigger I want to troubleshoot:
-
Custom script: loop
-
Set L = (Random point in safe zone west <gen>)
-
Custom script: exitwhen //need to find terrain type here to check against preset variable 'dalaran_grass'
-
Custom script: endloop
EDIT:
I used this guide by deathismyfriend to convert a trigger with only "If (Terrain type at (L)) equal to Dalaran - Grass" to JASS. I pulled what I think is what I need from that, so now my trigger looks like this:
-
Custom script: loop
-
Set L = (Random point in safe zone west <gen>)
-
Custom script: exitwhen exitwhen (GetTerrainTypeBJ(udg_L) == udg_dalaran_grass)
-
Custom script: endloop
Am I right to use this, or is there a better/less stupid way?
EDIT 2: Looks like it works. Items are generating and I noticed none of them generating on tiles that weren't Dalaran - Grass. I'll strike this edit out and bump the thread if I later on notice that they're generating on other terrain types. Until then, leaving this up for posterity because Google didn't help me how I wanted when I was originally trying to figure this out.
Last edited: