Serf in area
» Siedler Map Source Forum » Siedler DEdK Script Forum » Serf in area
Seiten: 1
SH
|
#1 16.09.2018 20:55 Beiträge: 127 |
Serf in area
Hi!
How to do that one of the serfs in the area change a player (or do something other)?
____________________
Sorry for my German
mcb
|
#2 16.09.2018 21:40 Beiträge: 1472 |
Something like this:
function changeSerfInArea(pl, pos, rang, newpl) local _, id = Logic.GetPlayerEntitiesInArea(pl, Entities.PU_Serf, pos.X, pos.Y, rang, 1) if IsAlive(id) then ChangePlayer(id, newpl) end end
SH
|
#3 17.09.2018 16:47 Beiträge: 127 |
OK, but when I attached the function Logic.SetTaskList
function changeSerfInArea(pl, pos, rang, newpl) local _, id = Logic.GetPlayerEntitiesInArea(pl, Entities.PU_Serf, pos.X, pos.Y, rang, 1) if IsAlive(id) then ChangePlayer(id, newpl) Logic.SetTaskList(id,TaskLists.TL_SERF_BUILD) end end
the TaskList no works.
____________________
Sorry for my German
mcb
|
#4 17.09.2018 16:58 Beiträge: 1472 |
This is expected, because ChangePlayer destroys the entity and creates a new one, with new id. But ChangePlayer should return the new id, so
function changeSerfInArea(pl, pos, rang, newpl) local _, id = Logic.GetPlayerEntitiesInArea(pl, Entities.PU_Serf, pos.X, pos.Y, rang, 1) if IsAlive(id) then id = ChangePlayer(id, newpl) Logic.SetTaskList(id, TaskLists.TL_SERF_BUILD) end end
sould work (but i never tested this).
SH
|
#5 17.09.2018 17:35 Beiträge: 127 |
I understand, it works. Thank you!
____________________
Sorry for my German
Seiten: 1