func InitializePlayer (plr,x,y,bas,team) { // Gebäude in den Besitz for (var obj in FindObjects(Find_Category(C4D_Structure), Find_Owner(NO_OWNER), Find_Distance(300, x,y))) SetOwner(plr, obj); // Hörx ist ein König! if (team == 2) { var obj = GetHiRank (plr); obj->CLNK::Redefine2 (_HRX); SetPortrait ("random", obj, _HRX); SetName ("$Herx$", obj); } // Alle ins Haus! var home; if (team == 2) home = FindObject2(Find_ID(CST3)); else home = FindObject2(Find_ID(HUT3)); for (var mat in FindObjects(Find_Category(C4D_Object | C4D_Vehicle | C4D_Living), Find_Not(Find_ID(CSTE)), Find_Owner(plr))) Enter(home, mat); // Den besten Clonks auswählen und vor die Tür SetCursor(plr, GetHiRank(plr)); SetCommand(GetCursor(plr), "Exit"); // Und auf den Gegner schauen SetDir(2-team, GetCursor(plr)); }
func InitializePlayer(player) { var x = 20 + Random(LandscapeWidth() - 40); while(FindObject2(Find_InRect(x-30, 0, 60, LandscapeHeight()), Find_Category (C4D_Structure))) { x = Random(LandscapeWidth()); } // Find a goot spot var miny = (4*LandscapeHeight())/10; var spawnpoint = findSpawnPoint(miny); // Place player and hut there var hut = CreateConstruction(HUT2, spawnpoint[0], spawnpoint[1],player,100,1); SetPosition(spawnpoint[0] - 5, spawnpoint[1]-8, GetCrew(player,0)); // Amboss drüberklatschen hut->CreateObject(ANVL, 17, 23); hut->CreateContents(FLAG); }
func findSpawnPoint(miny) { var x,y; while (true) { x = 20 + Random(LandscapeWidth() - 40); y = miny; while (GBackSolid(x, y) && y < LandscapeHeight()) { y++; } y = GetYSolid(x, y); if (LandscapeHeight() - y < 10) continue; if (FindObject2(Find_InRect(x-30, y - 80, 60, 160), Find_Category (C4D_Structure))) continue; if (GBackLiquid(x, y-3)) continue; return [x,y]; } return []; }
func Initialize() { // singleton g_storm = this; SetPosition(); // defaults storm_particles = { Size = 1, Stretch = PV_Speed(PV_Linear(4000, 0), 0), Alpha = PV_KeyFrames(0, 0, 0, 100, 255, 1000, 255), Rotation = PV_Direction(), CollisionVertex = 1000, OnCollision = PC_Die() }; StormStream = { max_segment_stretch = 100, // maximum number of pixels per segment that can be deviated from dir in either direction max_segment_stretch_want = 5, // maximum movement back into original position that is preferred (i.e.: speed at which gaps behind sky islands close) search_steps = 10, // steps in pixels in which to search for holes to blow through search_steps_mult = 200, // multiplyer, in percent, by which search steps get larger with each iteration }; find_mask = Find_And(Find_Category(C4D_Vehicle | C4D_Living | C4D_Object), Find_Not(Find_Func("IsEnvironment"))); SetStorm(20,0, 2000); }
global func DoInitialize() { if(fInitialized) return(); fInitialized = 1; fUseHungerThirst = 1; if(!FindObject(NOPC)) CreateObject(NOPC); if(fUseHungerThirst) if (!ObjectCount(NDWA)) CreateObject(NDWA, 50,50, -1); // Durst if(fUseHungerThirst) if (!ObjectCount(NDFO)) CreateObject(NDFO, 50,50, -1); // Hunger if(FindObject(_ETG)) RemoveObject(FindObject(_ETG)); if(FindObject(REPR)) RemoveObject(FindObject(REPR)); CreateObject(REPR, 50,50, -1); // Nachwuchs if(FindObject(TREP)) RemoveObject(FindObject(TREP)); CreateObject(TREP, 50,50, -1); // Baumnachwuchs // NPC's sollen Position halten var i, pObj; while(pObj = FindObjectOwner(0,-1,0,0,0,0,OCF_CrewMember,0,0,pObj)) AddEffect("StayThere",pObj,1,35,pObj); // if (!GetPlayerCount()) return(); // Banditen erstellen pObj = CreateObject(BNDT, 3917, 570, -1); pObj->SetAI("BanditNoMove", 3); pObj->SetColorDw(RGB(150)); pObj = CreateObject(BNDT, 4120, 560, -1); pObj->SetAI("BanditNoMove", 3); pObj->SetColorDw(RGB(150)); pObj = CreateObject(BNDT, 4175, 520, -1); pObj->SetAI("BanditNoMove", 3); pObj->SetColorDw(RGB(150)); pObj = CreateObject(BNDT, 4044, 477, -1); pObj->SetAI("BanditNoMove", 3); pObj->SetColorDw(RGB(150)); pObj = CreateObject(BNDT, 4309, 471, -1); pObj->SetAI("BanditBoss", 3); pObj->SetColorDw(RGB(150)); pObj->MakeBoss(); pObj->Enter(FindObject(MTNT, 4309, 471, -1, -1)); // Startmaterial erstellen pWagon = CreateObject(COAC, 28, 270, -1); pHorse = CreateObject(HORS, 77, 270, -1); pHorse->ConnectWagon(pWagon); SetDir(1, pWagon); SetDir(1, pHorse); // Startmaterial CreateContents(MEAC,pWagon,6); CreateContents(WHKY,pWagon,3); for(i=0; i<2; i++) { pObj = CreateContents(WSKI, pWagon); LocalN("iWater", pObj) = 90; pObj->~UpdateGraphics(); } CreateContents(MLLT,pWagon); CreateContents(KNFE,pWagon); CreateContents(IGNB,pWagon); CreateContents(DYNB,pWagon,2); CreateContents(METL,pWagon,7); CreateContents(WOOD,pWagon,21); CreateContents(CNKT,pWagon,4); CreateContents(LNKT,pWagon); // Höhle muss immer vom Indianer zu betreten sein! FreeRect(1970,589,40,9); // Brauchbare Gebäude mit unzerstörbarkeit belegen for(pObj in FindObjects(Find_Category(C4D_StaticBack|C4D_Structure|C4D_Vehicle),Find_Not(Find_Category(32768)),Find_InRect(1130,190,300,140))) AddEffect("NoDmg",pObj,200); for(pObj in FindObjects(Find_Category(C4D_StaticBack|C4D_Structure|C4D_Vehicle),Find_Func("IsIndianHandcraft"), Find_Or(Find_InRect(1830,230,560,340),Find_InRect(3190,160,670,360)))) AddEffect("NoDmg",pObj,200); // Weil die Kanone hier bearbeitet worden ist if(pObj = FindObject(CCAN)) pObj->~Initialize(); if(fTestSection==1) return(ChangeSection("AshCity")); if(fTestSection==2) return(ChangeSection("Caves")); // ... und los! if(!fTesting) ScriptGo(1); return(1); }