-
Notifications
You must be signed in to change notification settings - Fork 11
CNC Generals Zero hour Lua scripting examples
for objectindex,object in globals() do if strfind(objectindex, "ObjID") then print(GetObjectName(object)) end end
MyUnit = "test1" ExecuteAction("CREATE_NAMED_ON_TEAM_AT_WAYPOINT", MyUnit, "AmericaVehicleDozer", "teamplayer0", "Player_1_Start") print(GetObjectType(MyUnit)) x,y,z = ObjectGetPosition(object) ObjectSetPosition(object,x,y,z+10)
local x,y,z local ObjectList = {} local ObjectType local DuplicateOffset = 85 for objectIndex,object in globals() do if strfind(objectIndex, "ObjID") then ObjectType = GetObjectType(object) if ObjectType == "SupplyDock" or ObjectType == "SupplyPile" or ObjectType == "SupplyWarehouse" then tinsert(ObjectList, {object,ObjectType}) end end end for i=1,getn(ObjectList),1 do x,y,z = ObjectGetPosition(ObjectList[i][1]) ExecuteAction("UNIT_SPAWN_NAMED_LOCATION_ORIENTATION", GetUnitName(), ObjectList[i][2], NeutralTeam, {x+DuplicateOffset,y+DuplicateOffset,GetGroundHeight(x+DuplicateOffset,y+DuplicateOffset)}, ObjectGetRotation(ObjectList[i][1])) end