Posted By: Racebert69
identify a terrain (*.hmp) - 02/15/13 08:33
Hi,
I have a level with 4 terrains (t01.hmp, ..., t04.hmp).
How can I identify a tile with a mouseclick?
Because of memory I do not want to generate *.wmb files.
Any idea for that?
Thanks in advance.
Bert
Posted By: fogman
Re: identify a terrain (*.hmp) - 02/15/13 12:01
Give every terrain an own id value in a skill or use
http://www.conitec.net/beta/astr_for_entfile.htmYou can get the pointer to the terrain through "mouse_ent".
Then you can use the pointer to get the skill id or the filename.
Posted By: Racebert69
Re: identify a terrain (*.hmp) - 02/15/13 12:36
Hi Fogman,
wie kann ich einer Terrain-Entity eine ID verpassen?
Bin Jahre raus aus 3dgs, muss mich wieder richtig reinfinden.
Danke
Posted By: fogman
Re: identify a terrain (*.hmp) - 02/15/13 13:00
Am besten direkt beim erstellen der Terrains:
var vTerrainCounter = 0; // Der Zähler für die id
...
action aTerrain()
{
vTerrainCounter+= 1; // Zähler mit jedem neu erschaffenen Terrain erhöhen
my.skill1 = vTerrainCounter; // id in skill1 speichern
...
...
}
Oder auch so, falls die Terrains keine Action haben:
you = ent_create("deinTerrain.hmp", position, NULL);
vTerrainCounter+= 1;
you.skill1 = vTerrainCounter;
Posted By: HeelX
Re: identify a terrain (*.hmp) - 02/15/13 13:08
If the terrains have uniform file names like "t01.hmp", "t02.hmp" and so on, you can first identity if a clicked entity is a terrain via ent_type ( = 4 means it is a terrain). Then, you can use str_for_entfile or the ->type field of the ENTITY-struct to get the filename, e.g. "t01.hmp". If you use str_trunc(str, 4) and str_clip(str, 1), you only have then "01", which you can use together with str_to_int to get the numeric value (= 1).
Posted By: Racebert69
SOLVED: Re: identify a terrain (*.hmp) - 02/15/13 13:36
Super! Hab es über den Skill gelöst.
Fanatstic, I solved it with the entities skill
Thanks alot fogman and HeelX!!!