diff options
Diffstat (limited to 'TemplePushing.c4s/CliffPushing.c4d/Rules.c4d/Spawnpoints.c4d/Spawnpoint.c4d/Script.c')
| -rw-r--r-- | TemplePushing.c4s/CliffPushing.c4d/Rules.c4d/Spawnpoints.c4d/Spawnpoint.c4d/Script.c | 177 |
1 files changed, 177 insertions, 0 deletions
diff --git a/TemplePushing.c4s/CliffPushing.c4d/Rules.c4d/Spawnpoints.c4d/Spawnpoint.c4d/Script.c b/TemplePushing.c4s/CliffPushing.c4d/Rules.c4d/Spawnpoints.c4d/Spawnpoint.c4d/Script.c new file mode 100644 index 0000000..6172d25 --- /dev/null +++ b/TemplePushing.c4s/CliffPushing.c4d/Rules.c4d/Spawnpoints.c4d/Spawnpoint.c4d/Script.c @@ -0,0 +1,177 @@ +/*-- Spawnpoint --*/ + +#strict + +local initialized, angle, player, spawntimer,WpID; + +func IsWaypoint() { return(1); } + +global func PlaceSpawnpoint(id idObj, int iX, int iY, int timer) +{ + var spwn = CreateObject(SPNP, iX, iY, -1); + spwn->CreateContents(idObj); + if(timer) + spwn->LocalN("spawntimer") = timer; + return(spwn); +} + +protected func Initialize() +{ + if(Random(4)) WpID = [FLNT,SCRL,SFLN,ROCK]; + else WpID = [EFLN,STFN,FBMP]; + // Standardtimer = 750 Frames + spawntimer = 750; + SetClrModulation(RGBa(0,0,0,255)); +} + +protected func Timer() +{ + if(!player) player = CreateArray(); + // Noch nicht initialisiert? + if(!initialized) + // Ein Inhaltsobjekt? + if(Contents()) + // Initialisieren + return(Initialized()); + // Kein Inhalt? + if(!Contents()) + { + return(CreateContents(WpID[Random(GetLength(WpID))])); + } + // Tolle Effekt starten + angle += 10; + if(angle >= 360) angle = 0; + SetObjDrawTransform(1000, 0,0,0, 1000, Sin(angle, 8)*1000 - 2000,0, 1); + if(Random(2)) CreateParticle("NoGravSpark", RandomX(-5,5), RandomX(5,10), 0, -5, 25, RGBa(210, 210, 255, 100)); + // Alle Timer runterzählen + DecreaseTimer(); +} + +private func Initialized() +{ + // Unsichtbar werden + SetAction("Invis"); + // Objekt als Layer auflegen + SetGraphics(0, 0, GetID(Contents()), 1, 1); + // Transformation + SetObjDrawTransform(1000, 0,0,0, 1000, -5000,0, 1); + // Sammeleffekt starten +// AddEffect("Collect", this(), 1, 3, this()); + // Objekt(e) erzeugen + // Waffen-Bleiben-Regel +//player = CreateArray(); + // Initialisiert + initialized = true; +} + +/* Timer runterzählen */ + +private func DecreaseTimer() +{ + // Waffen-Bleiben-Regel + if(FindObject(WPST)) + { + for(var i=0 ; i < GetPlayerCount() ; i++) + // Spielertimer runterzählen + { + if(player[GetPlayerByIndex(i)]) + player[GetPlayerByIndex(i)] -= 5; + if(player[GetPlayerByIndex(i)] <= 0 && !(Local() & 2**GetPlayerByIndex(i))) + { + // Spieler kann das Objekt wieder einsammeln + player[GetPlayerByIndex(i)] = 0; + Local() += 2**GetPlayerByIndex(i); + } + } + } + else + { + // Timer runterzählen + player[0] -= 5; + if(player[0] <= 0) + { + // Objekt ist wieder da + player[0] = 0; + Local() = true; + SetVisibility(VIS_All()); + } + } +} + +/* Einsammel-Effekte */ +/* +public func FxCollectTimer() +{ + // Ist ein Clonk hier? -> Einsammeln lassen + var pObj; + for(var pClonk in FindObjects(Find_AtPoint(), Find_OCF(OCF_CrewMember()), Find_OCF(OCF_CrewMember()), Find_NoContainer())) + if(CheckCollect(GetOwner(pClonk))) + { + pObj = FindContents(); + // Kann der Clonk einsammeln? + Collect(pObj, pClonk); + if(Contained(pObj) == this()) RemoveObject(pObj); + else + { + Sound("Grab", 0, pClonk, 0, GetOwner(pClonk)+1); + Collected(GetOwner(pClonk)); + } + } +}*/ + +public func RejectEntrance(object pClonk) +{ + // Objekt ist ein Clonk? + if(!(GetOCF(pClonk) & OCF_CrewMember) && !(pClonk->~CanCollectFromSpawnpoints())) return(1); + // Ich hab Contents? + if(!Contents()) return(1); + // Darf einsammeln + if(CheckCollect(GetOwner(pClonk))) + { + var pObj = Contents(); + // Kann der Clonk einsammeln? + if(ObjectCount(0, 0, 0, 0, 0, 0, 0, 0, pClonk) >= 1) + return(1); + + Collect(pObj, pClonk); + CreateContents(WpID[Random(GetLength(WpID))]); + Initialized(); + if(Contained(pObj) == this()) RemoveObject(pObj); + else + { + Sound("Grab", 0, pClonk, 0, GetOwner(pClonk)+1); + Collected(GetOwner(pClonk)); + } + } + return(1); +} + +private func CheckCollect(int iPlr) // Überprüft, ob ein Spieler das Objekt einsammeln darf +{ + // Waffen-Bleiben-Regel + if(FindObject(WPST)) + return(Local() & 2**iPlr); + else + return(Local()); +} + +private func Collected(int iPlr) // Regelt, dass ein Spieler das Objekt einsammelt +{ + // Waffen-Bleiben-Regel + if(FindObject(WPST)) + { + // Spielertimer hochsetzen + player[iPlr] = spawntimer; + // Nicht mehr sichtbar für den Spieler + Local() -= 2**iPlr; + } + else + { + // Timer hochsetzen + player[0] = spawntimer; + // Nicht mehr einsammelbar + Local() = false; + // Nicht mehr sichtbar + SetVisibility(VIS_God()); + } +} |
