func ChargeStop(proplist params) { SetAction("Idle"); var angle = params.new_angle; SetVelocity(angle, Speed-10, 10); Sound("sawblade_launch", false, 100); AddEffect("CheckEnemies", this, 1,1, this); SetLightRange(30, 70); SetLightColor(RGB(150, 150, 150)); AddEffect("Life", this, 20, LifeTime, this); /*if(GetXDir() > 0) SetRDir(15); else SetRDir(-15);*/ SetClrModulation(RGBa(255,255,255,255)); Sound("sawloop", false, 20, nil, 1); AddEffect("Rotate", this, 1, 1, this); }
private func Initialize() { // Create dynamite below the first lava basin DrawMaterialQuad("Tunnel",1378,1327-5,1860,1327-5,1860,1330,1387,1330,1); //Sound("Environment::BirdsLoop",true,100,nil,+1); Cloud->Place(40); PlaceObjects(Rock,50,"Earth"); PlaceObjects(Loam,25,"Earth"); PlaceObjects(Nugget,25,"Earth"); AddEffect("PlaneReset",CreateObjectAbove(Airplane,3030,315,0),100,10,nil,nil); AddEffect("PlaneReset",CreateObjectAbove(Airplane,3160,315,1),100,10,nil,nil); Doors(); var concierge = CreateObjectAbove(Clonk, 70, 1030, NO_OWNER); concierge->SetDir(DIR_Left); concierge->SetAlternativeSkin("Mime"); concierge->SetObjectLayer(concierge); concierge->SetName("$NameConcierge$"); concierge->SetDialogue("Concierge"); concierge->Sound("Circus", false, nil, nil, +1, 100); Dialogue->FindByTarget(concierge)->AddAttention(); var cannons = FindObjects(Find_ID(Cannon)); for (var cannon in cannons) { cannon->TurnCannon(0); cannon->SetCannonAngle(45000); cannon.Touchable = false; }
func Hit(int oldx, int oldy) { if (IsJumping()) { if (GetContact(-1, CNAT_Right)) { SetXDir(-10); SetYDir(oldy, 100); AddEffect("CheckComDir", this, 1, 1, this); } else if (GetContact(-1, CNAT_Left)) { SetXDir(10); SetYDir(oldy, 100); AddEffect("CheckComDir", this, 1, 1, this); } else if (GetContact(-1, CNAT_Top) && (oldy < 0)) { SetXDir(oldx, 100); SetYDir(+5); } } return inherited(oldx, oldy, ...); }
func InitializePlayer(int plr) { // Create buildings the_elevator = CreateConstruction(ELEV,165,110,0,80,1); valley_cata = CreateObject(CATA,240,387,0); hill_cata = CreateObject(CATA,540,247,0); valley_wood = CreateObject(WOOD,280,390,NO_OWNER); CreateObject(METL,285,390,NO_OWNER); // Remember clonks constructor_clnk = GetCrew(plr,0); valley_clnk = GetCrew(plr,1); catapult_clnk = GetCrew(plr,2); // Move valley and catapult clonk Exit(valley_clnk,230,390); Exit(catapult_clnk,520,250); // Prevent constructor and catapult clonks from falling down var hr = AddEffect("StayNearElev", constructor_clnk, 1, 30, 0, 0, 0, 0, 0, 0); AddEffect("StayNearCata", catapult_clnk, 1, 30); // Message and control positioning SetPlrShowControlPos(plr, SHOWCTRLPOS_Top); SetTutorialMessagePos(MSG_Bottom | MSG_Left | MSG_XRel | MSG_WidthRel, 10, -10, 35); // Start script ScriptGo(1); return true; }
func Init(to, max, cur, timeout, offset, visibility, proplist data) { maximum = max; current = cur; timeout_time = timeout; width = data.width ?? 40; height = data.height ?? 5; if(timeout_time) { var e = AddEffect("TimeOut", this, 1, BoundBy(timeout_time/2, 5, 35), this); e.t = timeout_time; } this.Visibility = visibility; SetGraphics(nil, GetID(), 1, GFXOV_MODE_Base, nil, GFX_BLIT_Custom); SetBarColor(data.color, data.back_color); SetAction("Attach", to); SetVertexXY(0, -offset.x, -offset.y); AddEffect("LifeCheck", to, 1, 0, this); Update(); }
func Attack_5() { if (this.planes[0]->GetX() > 880) return ScheduleSame(5); MessageBoxAll("$Attack3$", npc_lara, true); // oh god! for (var i=0; i<3; ++i) { this.planes[i]->StartInstantFlight(270, 15); this.planes[i]->SetXDir(-15); this.planes[i]->SetYDir(0); } SetViewTarget(g_flagpole); // NPCs go nuts RemoveEffect("NewtonHammering", npc_newton); RemoveEffect("LaraWalking", npc_lara); RemoveEffect("WoodyWalking", npc_woody); AddEffect("Attack_Panic", npc_newton, 1, 30, this); AddEffect("Attack_Panic", npc_lara, 1, 35, this); AddEffect("Attack_Panic", npc_woody, 1, 40, this); AddEffect("Attack_Panic", npc_lisa, 1, 45, this); // Update dialogues; remove attention markers for (var npc in [npc_newton, npc_lara, npc_woody, npc_lisa, npc_rocky]) { var dlg = Dialogue->FindByTarget(npc); if (dlg) { dlg->RemoveAttention(); dlg->SetDialogueProgress(100); } } // Start dropping bombs immediately return CallNext(); }
func Initialize() { AddEffect("DefMana", nil, 1, 4, nil); InitTeamExclusiveChamps(2); InitScoreboard(); team_score = CreateArray(2); var fx = AddEffect("CheckWipf", this, 1, 5, this); fx.counter = resetTime; var pos = GameCall("LeftGoalPos"); leftgoal = CreateObject(Dummy, pos[0], pos[1], -1); leftgoal.Visibility = VIS_All; var fxl = AddEffect("GoalCheck", leftgoal, 1, 1, this, nil, 1, 2); fxl.teamid = 1; fxl.enemy = 2; leftshield_params = GameCall("LeftShieldParams"); leftshield = CreateObject(PortalWall,leftshield_params[0], leftshield_params[1],-1); pos = GameCall("RightGoalPos"); rightgoal = CreateObject(Dummy, pos[0], pos[1], -1); rightgoal.Visibility = VIS_All; var fxr = AddEffect("GoalCheck", rightgoal, 1, 1, this, nil, 2, 1); fxr.teamid = 2; fxr.enemy = 1; rightshield_params = GameCall("RightShieldParams"); rightshield = CreateObject(PortalWall,rightshield_params[0],rightshield_params[1],-1); SpawnBall(); ScheduleCall(this, "Set", 80); }
protected func Initialize() { // Goal. CreateObject(Goal_LastManStanding); CreateObject(Rule_KillLogs); CreateObject(Rule_Gravestones); GetRelaunchRule() ->SetRespawnDelay(3) ->SetLastWeaponUse(false); // Enviroment. CreateObject(Rule_ObjectFade)->DoFadeTime(10 * 36); SetSkyAdjust(RGB(255, 128, 0)); SetSkyParallax(1, 20, 20, 0, 0, nil, nil); CreateObjectAbove(Column, 160, 304)->SetClrModulation(RGB(255, 100, 80)); CreateObjectAbove(Column, 448, 272)->SetClrModulation(RGB(255, 100, 80)); SetMatAdjust(RGB(255, 150, 128)); AddEffect("RandomMeteor", nil, 100, 20); AddEffect("DangerousLava", nil, 100, 1); PlaceEdges(); PlaceGras(); return; }
func CheckForEnemies(Size) { for(var o in FindObjects(Find_Distance(Size), Find_Func("CanBeHit", this))) { if(o->GetOwner() == GetOwner() || GetEffect("BallHitCD", o)) continue; AddEffect("BallHit", o, 20, 1, nil, BallsMan); o->Fling(0, -2); AddEffect("BallHitCD", o, 1, 15); var trailparticles = { Prototype = Particles_ElectroSpark2(), Size = PV_Linear(PV_Random(5,15),0), BlitMode = GFX_BLIT_Additive, Rotation = PV_Random(0,360), R = pR, G = pG, B = pB, }; CreateParticle("Lightning", o->GetX() - GetX(), o->GetY() - GetY(), 0, 0, 10, trailparticles, 5); WeaponDamage(o, SpellDamage); Sound("Ball::ball_hit", false, 50); } }
global func FadeIn(object pObject, int level, bool fFast, int iAmount) { if (!pObject) { pObject = this; } if (GetEffect("*FadeIn*", pObject)) { return; } if (fFast) { return AddEffect("FadeIn", pObject, 101, 1,0,0,level, iAmount); } return AddEffect("FadeIn", pObject, 101, 2,0,0,level, iAmount); }
global func CreateWaterfall(int x, int y, int strength, string mat) { var fall = CreateObjectAbove(Waterfall, x, y, NO_OWNER); if (!mat) mat = "Water"; AddEffect("IntWaterfall", fall, 100, 1, fall, nil, x, y, strength, mat); return fall; }
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); } }
protected func Initialize() { var rand=1; if(Random(2) == 1)rand=-1; SetObjDrawTransform(1000*rand,0,0,0,1000); AddEffect("IntSparks", this, 1, 60, this); }
public func Dlg_VillageHead_Init(object clonk) { var lantern = clonk->CreateContents(Lantern); lantern->TurnOn(); AddEffect("IntVillageHead", clonk, 100, 5, this); return true; }
func ChargeStop(proplist params) { var eff = AddEffect("FireDash", params.clonk, 20, 1 ,nil, GetID()); eff.angle = params.angle; eff.dist = Distance(0,0, params.x, params.y); eff.SpellDamage1 = SpellDamage1; eff.SpellDamage2 = SpellDamage2; eff.Size1 = Size1; eff.Size2 = Size2; eff.startx = params.clonk->GetX(); eff.starty = params.clonk->GetY(); eff.tx = params.x; eff.ty = params.y; eff.marker = params.marker; eff.clonk = params.clonk; eff.angle_prec = angle_prec; if(this) { params.clonk->SetAction("Float"); params.clonk->SetObjectLayer(params.clonk); } Sound("Fire::Fireball", false, 100); RemoveObject(); }
global func AddCyclopsAI(object clonk) // somewhat hacky, but it works { var effect_name = "IntCyclopsAI"; var fx = GetEffect(effect_name, clonk); if (!fx) fx = AddEffect(effect_name, clonk, 1, 2); if (!fx || !clonk) return nil; clonk.ai = fx; // bin inventory var cnt = clonk->ContentsCount(); fx.bound_weapons = CreateArray(cnt); for (var i=0; i<cnt; ++i) fx.bound_weapons[i] = clonk->Contents(i); // set home fx.home_x = clonk->GetX(); fx.home_y = clonk->GetY(); fx.home_dir = DIR_Left; // set guard range fx.guard_range = { x = fx.home_x-AI_DefGuardRangeX, y = fx.home_y-AI_DefGuardRangeY, wdt = AI_DefGuardRangeX*2, hgt = AI_DefGuardRangeY*2}; fx.spray_old = {time = 0, v0 = 0, v1 = 0, reach = 0}; fx.spray_cur = {time = 0, v0 = 0, v1 = 0, reach = 0}; AI->SetMaxAggroDistance(clonk, AI_DefMaxAggroDistance); return fx; }
func Idle() { ClearEffects(); ox=GetX(); oy=GetY(); AddEffect("Idle", this, 1, 1, this); }
C4SoundEffect *C4SoundSystem::GetEffect(const char *szSndName) { C4SoundEffect *pSfx; char szName[C4MaxSoundName + 4 + 1]; int32_t iNumber; // Evaluate sound name SCopy(szSndName, szName, C4MaxSoundName); // Default extension DefaultExtension(szName, "wav"); // Convert old style '*' wildcard to correct '?' wildcard // For sound effects, '*' is supposed to match single digits only SReplaceChar(szName, '*', '?'); // Sound with a wildcard: determine number of available matches if (SCharCount('?', szName)) { // Search global sound file if (!(iNumber = SoundFile.EntryCount(szName))) // Search scenario local files if (!(iNumber = Game.ScenarioFile.EntryCount(szName))) // Search bank loaded sounds if (!(iNumber = EffectInBank(szName))) // None found: failure return NULL; // Insert index to name iNumber = BoundBy(1 + SafeRandom(iNumber), 1, 9); SReplaceChar(szName, '?', '0' + iNumber); } // Find requested sound effect in bank for (pSfx = FirstSound; pSfx; pSfx = pSfx->Next) if (SEqualNoCase(szName, pSfx->Name)) break; // Sound not in bank, try add if (!pSfx) if (!(pSfx = AddEffect(szName))) return NULL; return pSfx; }
global func Attach2(object pObj, object pTarget) { // Kein Objekt vorhanden oder schon irgendwo attached? if (!pObj || !pTarget && !(pTarget = this) || GetEffect("Attach", pTarget)) return; return AddEffect("Attach", pTarget, 1, 1, 0, 0, pObj); }
func FxLifeStop() { if(!GetEffect("Pull", this)) { AddEffect("Comeback", this, 1, 1, this); } }
func Initialize() { AddEffect("Sparkle", this, 1, 30 + RandomX(-3, 3), this); graphics_index = Random(4); if (graphics_index) SetGraphics(Format("%d", graphics_index+1)); return true; }
func InitEffect() { Sound("Objects::Weapons::WeaponSwing1", false, 100); SetLightRange(30, 70); SetLightColor(RGB(150, 150, 150)); trailparticles = { Size = 5, R = pR, G = pG, B = pB, Attach=ATTACH_Front }; var angle = Angle(0, 0, GetXDir(), GetYDir()); hookprt = { Size = 8, R = pR, G = pG, B = pB, Attach=ATTACH_Front|ATTACH_MoveRelative, Rotation = angle }; AddEffect("Life", this, 1, LifeTime, this); hit = false; }
protected func Construction() { _inherited(...); SetSkin(0); AddEffect("IntTurn", this, 1, 1, this); AddEffect("IntEyes", this, 1, 35+Random(4), this); AttachBackpack(); iHandMesh = [0,0]; SetAction("Walk"); SetDir(Random(2)); // Broadcast for rules GameCallEx("OnClonkCreation", this); }
func Initialize() { AddEffect("CheckAutoMoveTo", this, 1, 30, this); AddEffect("ElevatorUpperLimitCheck", this, 1, 1, this); AddEffect("FetchVehicles", this, 1, 10, this); case_speed = ElevatorCase_move_speed; case_speed_automatic = 2 * case_speed; partner_was_synced = false; front = CreateObject(Elevator_Case_Front, 0,13, GetOwner()); back = CreateObject(Elevator_Case_Back, 0,13, GetOwner()); front->SetAction("Attach", this); back->SetAction("Attach", this); }
func Initialize() { inherited(...); SetR(90); SetGraphics(nil, Javelin); PlayAnimation("Base", 5, Anim_Const(0), Anim_Const(1000)); AddEffect("HitCheck", this, 1,2, nil,nil); }
func FxProducePowerStart(target, effect, temp) { if(temp) return; MakePowerProducer(Compensator_power_usage); // todo: effects AddEffect("Sparkle", this, 1, 1, this); }
global func IntroStart() { if(!g_intro_initialized && !GetEffect("IntIntro")) { AddEffect("IntIntro", nil, 1, 2, nil, nil); g_intro_initialized = true; } }
protected func Departure(object container) { if (GetID() != Bow) return; if (container->GetOCF() & OCF_CrewMember) AddEffect("Fade", this, 100, 1, this); return _inherited(container, ...); }
public func ControlUse(object pClonk, int ix, int iy) { AddEffect("Frostbolt", nil, 100, 1, nil, GetID(), pClonk->GetOwner(), Angle(0,0,ix,iy),pClonk->GetX(), pClonk->GetY()); Sound("Fireball"); Sound("Fireball"); RemoveObject(); return 1; }
func Initialize() { SetGraphics("Back", Symbol_InfoYourTeamHasBomb, 0, GFXOV_MODE_Base, nil, GFX_BLIT_ClrSfc_OwnClr); SetGraphics(nil, GetID(), 1, GFXOV_MODE_Base, nil, GFX_BLIT_ClrSfc_OwnClr); AddEffect("FadeAway", this, 1, 1, this); this.Parallaxity = [0, 0]; this.Visibility = VIS_Owner; }