Ejemplo n.º 1
0
protected func Activate(pCaller)
{
  if(FindObject2(Find_Container(pCaller),Find_ID(STBW),Find_Not(Find_Func("HasCell"))))
  {
   ShiftContents(Contained(),0,STBW);
   Enter(FindObject2(Find_Container(pCaller),Find_ID(STBW),Find_Not(Find_Func("HasCell"))));
  }
  return 1;
}
Ejemplo n.º 2
0
func FxCheckEnemiesTimer(object target, proplist effect, int time)
{
	for(var o in FindObjects(Find_Distance(Size), Find_Not(Find_ID(Hook)), Find_Or(Find_Func("IsReflectable"), Find_Func("CanBeHit", this))))
	{
		if(GetEffect("SawBladeCD", o) || (o->GetOwner() == GetOwner() && time < 15))
		{
			continue;
		}
		
		var angle = Angle(GetX(), GetY(), o->GetX(), o->GetY());
		AddEffect("SawBladeCD", o, 1, 25);
		
		
		if(!o->GetAlive())
		{
			if(o->~IsWallElement())
				continue;
			
			var speed = Distance(0, 0, o->GetXDir(), o->GetYDir());
			o->SetVelocity(angle, speed);
			o->~Blocked(this);
			WeaponDamage(o, SpellDamage);
			
			Sound("Hits::GeneralHit*", false, 50);
			continue;
		}
		
		Sound("Objects::Weapons::WeaponHit*", false, 50);
		o->Fling(Sin(angle, 8), -Cos(angle, 8));
		WeaponDamage(o, SpellDamage);
	}
}
Ejemplo n.º 3
0
func Outro_Start(object plane)
{
	// Player closest to plane becomes outro protagonist
	this.plane = plane;
	this.hero = plane->FindObject(Find_ID(Clonk), Find_Not(Find_Owner(NO_OWNER)), plane->Sort_Distance());
	SetPlayerZoomByViewRange(NO_OWNER, 200,100, PLRZOOM_Set | PLRZOOM_LimitMax);
	SetViewTarget(this.hero);
	npc_pyrit.has_sequence = true; // Pyrit stops hammering
	return ScheduleNext(5);
}
Ejemplo n.º 4
0
func Outro_Start(object goal, object plane)
{
	this.goal = goal;
	this.plane = plane;
	this.hero = plane->FindObject(Find_Not(Find_Owner(NO_OWNER)), Find_ID(Clonk), plane->Sort_Distance());
	
	SetViewTarget(this.plane);
	
	MessageBoxAll("$Outro1$", this.hero, true);
	
	return ScheduleNext(150);
}
Ejemplo n.º 5
0
func Initialize(...)
{
	// (first) plane built? Story advances.
	// only after attack, so enemy planes don't count
	if (g_attack_done && !g_plane_built)
	{
		g_plane_built = true;
		var closest_clonk = FindObject(Find_ID(Clonk), Find_Not(Find_Owner(NO_OWNER)), Sort_Distance());
		SetColor(0xa04000); // Make sure it has the same color in all missions
		Dialogue->MessageBoxAll("$PlaneBuilt$", closest_clonk, true);
	}
	return _inherited(...);
}
Ejemplo n.º 6
0
global func CyclopsFindTarget(fx)
{
	// Consider hostile clonks, or all clonks if the AI does not have an owner.
	var hostile_criteria = Find_Hostile(fx.cyclops->GetOwner());
	if (fx.cyclops->GetOwner() == NO_OWNER)
		hostile_criteria = Find_Not(Find_Owner(fx.cyclops->GetOwner()));

	for (var target in FindObjects(Find_InRect(fx.guard_range.x,fx.guard_range.y,fx.guard_range.wdt,fx.guard_range.hgt), Find_OCF(OCF_CrewMember), hostile_criteria, Find_NoContainer(), Sort_Random()))
		if (PathFree(fx.cyclops->GetX(),fx.cyclops->GetY(),target->GetX(),target->GetY()))
			return target;

	// Nothing found.
	return;
}
Ejemplo n.º 7
0
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));
}
Ejemplo n.º 8
0
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);
}
Ejemplo n.º 9
0
/**
Extract liquid from this
@param sznMaterial: Material to extract
@param inMaxAmount: Max Amount of Material being extracted 
@param pnPump: Object which extracts the liquid
@param pnPipe: Pipe which extracts the liquid (connected to pnPump)
@param bnWildcard: Usefull to extract random liquids; use '*' for sznMaterial for all Materials
@return [irMaterial,irAmount]
	-irMaterial: Material being extracted
	-irAmount: Amount being extracted
*/
public func LiquidOutput(string sznMaterial, int inMaxAmount, object pnPump, object pnPipe, bool bnWildcard)
{
	//Search liquid to pump
	if (bnWildcard)
	{
		var ptBarrel = FindObject(Find_Container(this), Find_Func("IsBarrel"), Find_Func("IsBarrelForMaterial", sznMaterial), Find_Not(Find_Func("BarrelIsEmpty")));
		var sztMaterial="";
		if (ptBarrel)
			sztMaterial = ptBarrel->GetBarrelMaterial();
		//Nothing to pump
		if (sztMaterial == "")
			return ["", 0];
		sznMaterial = sztMaterial;
	}
	var itFound = 0;
	for (var ptBarrel in FindObjects(Find_Container(this), Find_Func("IsBarrel"), Find_Func("IsBarrelForMaterial", sznMaterial), Find_Not(Find_Func("BarrelIsEmpty")))) 
	{
		var atFound = ptBarrel->GetLiquid(sznMaterial, inMaxAmount - itFound, this);
		//Crazy stuff happend?
		itFound += BoundBy(atFound[1], 0, inMaxAmount - itFound);
		if (itFound == inMaxAmount)
			break;
	}
	return [sznMaterial, itFound];
}
Ejemplo n.º 10
0
func Outro_5()
{
	if (npc_pyrit->Contained() != this.plane) return ScheduleSame(5);
	// After Pyrit is inside, rest enters freely
	this.plane->SetEntrance(true);
	for (var clonk in this.plane->FindObjects(this.plane->Find_AtRect(-60,-30,120,60), Find_ID(Clonk), Find_Not(Find_Owner(NO_OWNER))))
		clonk->SetCommand("Enter", this.plane);
	return ScheduleNext(100);
}
Ejemplo n.º 11
0
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);
}
Ejemplo n.º 12
0
// Open for all players
func Find_Allied(plr) { return Find_Not(Find_Owner(NO_OWNER)); }