![]() |
CTP2 Bureau The Modding Knowledgebase |
|
Apolyton CTP2 forums Apolyton CTP2 archives Source Code Project SVN |
![]() |
Search the site: |
SLIC-Reference :
|
Arguments: | unitname | Type: | int |
Return the DB index of the named unit |
The name must be in quotes. E.G. UnitType("UNIT_SETTLER") |
tested
working
SFN_ERROR Slic_UnitType::Call(SlicArgList *args) { if(args->Count() != 1) return SFN_ERROR_NUM_ARGS; if(args->m_argValue[0].m_type != SA_TYPE_HARD_STRING) return SFN_ERROR_TYPE_ARGS; const char *name = args->m_argValue[0].m_symbol->GetName(); StringId sname; if(!g_theStringDB->GetStringID(name, sname)) { return SFN_ERROR_UNKNOWN_UNIT_TYPE; } sint32 i; for(i = 0; i < g_theUnitDB->NumRecords(); i++) { if(g_theUnitDB->Get(i)->m_name == sname) { m_result.m_int = i; return SFN_ERROR_OK; } } return SFN_ERROR_UNKNOWN_UNIT_TYPE; } |
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
![]() |
This site is currently maintained by: BureauBert (Webmaster) Maquiladora (Manager) Legal Notice: Legal Notice Statistics: 102516 unique users since 02.05.2004 (» Site Statistics) Hosted by: WebhostOne |