![]() |
CTP2 Bureau The Modding Knowledgebase |
|
Apolyton CTP2 forums Apolyton CTP2 archives Source Code Project SVN |
![]() |
Search the site: |
SLIC-Reference :
|
Arguments: | owner, type, nearlocation, distance[, saveunit] | Type: | void |
Create a unit of the given type belonging to owner approximately distance tiles from nearlocation |
If a unit variable is passed in as saveunit, it will contain the newly created unit after this function returns. Example:
//I want to put (cheat) a defender in my city as soon as I build it HandleEvent(CreateCity) post { CreateUnit(player[0], UnitDB(UNIT_HOPLITE), city[0].location, 0); } |
tested
working
SFN_ERROR Slic_CreateUnit::Call(SlicArgList *args) { if (args->Count() < 4 || args->Count() > 5) { return SFN_ERROR_NUM_ARGS; } sint32 owner; if(!args->GetPlayer(0, owner)) { return SFN_ERROR_TYPE_ARGS; } sint32 type; if(!args->GetInt(1, type)) { return SFN_ERROR_TYPE_ARGS; } MapPoint pos; BOOL res = args->GetPos(2, pos); if(!res) return SFN_ERROR_TYPE_ARGS; sint32 distance; if(!args->GetInt(3, distance)) { return SFN_ERROR_TYPE_ARGS; } const UnitRecord *rec = g_theUnitDB->Get(type, g_player[owner]->GetGovernmentType()); // Check if the function was called with a valid unit type. if(!rec) return SFN_ERROR_UNKNOWN_UNIT_TYPE; sint32 x, y; BOOL found = FALSE; DynamicArray |
Using this form you may add your own observations concerning the above item, e.g. additional hints for usage, limitations, oddities etc. Please note this is not the place for asking questions or carrying out discussions about modding - please refer to the Apolyton CTP2 Modification Forum on that purpose.
*) Required fields
No user comments yet. |
![]() |
This site is currently maintained by: BureauBert (Webmaster) Maquiladora (Manager) Legal Notice: Legal Notice Statistics: 96112 unique users since 02.05.2004 (» Site Statistics) Hosted by: WebhostOne |