Check blocked terrain
» Siedler Map Source Forum » Siedler DEdK Script Forum » Check blocked terrain
Seiten: 1
AdeBont
|
#1 04.04.2014 22:25 Beiträge: 666 |
Check blocked terrain
Two queries:
How can you check if a position is blocked terrain?
How can you find non-blocked position closest to a given position?
Edit: Found first one: Logic.GetSector(_entity)
____________________
AdB
---------------------------------
Now faith is the substance of things hoped for,
the evidence of things not seen.
Heb 11:1
Dieser Beitrag wurde von AdeBont am 04.04.2014 um 22:37 editiert.
mcb
|
#2 04.04.2014 22:40 Beiträge: 1472 |
Use this:
-- mcb function GetNextFreePos(_x, _y) if type(_x)=="table" then _y = _x.Y _x = _x.X end local id = AI.Entity_CreateFormation(8, Entities.PU_Serf, 0, 0, _x, _y, 0, 0, VERYHIGH_EXPERIENCE, 0) local pX, pY = Logic.EntityGetPos(id) Logic.DestroyEntity(id) return {X=pX, Y=pY} end
AdeBont
|
#3 05.04.2014 01:19 Beiträge: 666 |
Hi mcb
This is the thing I needed, I build a comfort for it:
function ReplaceToFreePos(_entity) _pos = GetPosition(_entity) _player = GetPlayer(_entity) _type = Logic.GetEntityType(GetEntityId(_entity)) DestroyEntity(_entity) SetEntityName(AI.Entity_CreateFormation(_player, Entities.PU_Serf, 0, 0, _pos.X, _pos.Y, 0, 0, VERYHIGH_EXPERIENCE, 0), _entity) ReplaceEntity(_entity, _type) end
_entity should be the entity name
____________________
AdB
---------------------------------
Now faith is the substance of things hoped for,
the evidence of things not seen.
Heb 11:1
mcb
|
#4 05.04.2014 11:08 Beiträge: 1472 |
AI.Entity_CreateFormation(player, typ, 0, sol, pos.X, pos.Y, 0, 0, experi, minSol) is a normal function to create an entity on unblocked terrain. In most cases you don't need to create a serf first.
AdeBont
|
#5 05.04.2014 12:17 Beiträge: 666 |
Zitat von mcb:
AI.Entity_CreateFormation(player, typ, 0, sol, pos.X, pos.Y, 0, 0, experi, minSol) is a normal function to create an entity on unblocked terrain. In most cases you don't need to create a serf first.
I think it only works with PU and PB entities. The game crashed when I tried with a CU entity.
____________________
AdB
---------------------------------
Now faith is the substance of things hoped for,
the evidence of things not seen.
Heb 11:1
AdeBont
|
#7 05.04.2014 16:23 Beiträge: 666 |
Zitat von mcb:
CU-Leaders are working, what entity caused the crash?
Miner
____________________
AdB
---------------------------------
Now faith is the substance of things hoped for,
the evidence of things not seen.
Heb 11:1
Seiten: 1