Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "hg_inc"
- #include "afx_sfunc"
- void DeleteTriggerInt(string sTrigger) {
- object oTrigger = GetLocalObject(OBJECT_SELF, sTrigger);
- DeleteLocalInt(oTrigger, "Armed");
- }
- void DeactivateTriggers() {
- DeleteTriggerInt("OrbTrigger12");
- DeleteTriggerInt("OrbTrigger14");
- DeleteTriggerInt("OrbTrigger16");
- DeleteTriggerInt("OrbTrigger23");
- DeleteTriggerInt("OrbTrigger25");
- DeleteTriggerInt("OrbTrigger34");
- DeleteTriggerInt("OrbTrigger36");
- DeleteTriggerInt("OrbTrigger38");
- DeleteTriggerInt("OrbTrigger45");
- DeleteTriggerInt("OrbTrigger47");
- DeleteTriggerInt("OrbTrigger56");
- DeleteTriggerInt("OrbTrigger58");
- DeleteTriggerInt("OrbTrigger67");
- DeleteTriggerInt("OrbTrigger78");
- }
- void DoHeartbeat() {
- object oWay = GetLocalObject(OBJECT_SELF, "Waypoint");
- object oPC = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, oWay);
- if (!GetIsObjectValid(oPC))
- return;
- DelayCommand(RoundsToSeconds(1), DoHeartbeat());
- object oLever = GetLocalObject(OBJECT_SELF, "MatLever");
- if (!GetLocalInt(oLever, "LasersOff")){
- float fDelay = 5.0;
- string sSuffix;
- object oOrb, oTarget, oTrigger;
- effect eBeam, eDam, eFX = EffectVisualEffect(VFX_COM_HIT_NEGATIVE);
- int nTarget, nX, nLimit;
- for(nX = 1; nX < 9; nX++) {
- oOrb = GetLocalObject(OBJECT_SELF, "OrbSource"+IntToString(nX));
- eBeam = EffectBeam(VFX_BEAM_MIND, oOrb, BODY_NODE_CHEST);
- nTarget = GetLocalInt(oOrb, "Target");
- if ((nX == 6 || nX == 7) && nTarget) {
- DeleteLocalInt(oOrb, "Target");
- continue;
- }
- nLimit = 8;
- if (nX < 3)
- nLimit = 6;
- if (!nTarget || nTarget > nLimit)
- nTarget = nX+1;
- SetLocalInt(oOrb, "Target", nTarget+2);
- oTarget = GetLocalObject(OBJECT_SELF, "OrbSource" + IntToString(nTarget));
- sSuffix = IntToString(nX) + IntToString(nTarget);
- oTrigger = GetLocalObject(OBJECT_SELF, "OrbTrigger" + sSuffix);
- AssignCommand(oOrb, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eBeam, oTarget, fDelay));
- SetLocalInt(oTrigger, "Armed", 1);
- oPC = GetFirstObjectInArea();
- while (GetIsObjectValid(oPC)) {
- if (GetIsInSubArea(oPC, oTrigger)) {
- eDam = EffectDamage(200 + d20(10));
- AssignCommand(oOrb, ApplyEffectToObject(0, eDam, oPC));
- AssignCommand(oOrb, ApplyEffectToObject(0, eFX, oPC));
- }
- oPC = GetNextObjectInArea();
- }
- }
- DelayCommand(fDelay, DeactivateTriggers());
- }
- }
- void GetSetLocal(string sTag, object oWay) {
- object oSet = GetNearestObjectByTag(sTag, oWay);
- SetLocalObject(OBJECT_SELF, sTag, oSet);
- }
- void SetupLasers() {
- if (GetLocalInt(OBJECT_SELF, "SetupLasers"))
- return;
- SetLocalInt(OBJECT_SELF, "SetupLasers", 1);
- object oWay = GetWaypointByTag("funkywaypoint159");
- int nX;
- for (nX = 1;nX < 9; nX++)
- GetSetLocal("OrbSource"+IntToString(nX), oWay);
- GetSetLocal("OrbTrigger12", oWay);
- GetSetLocal("OrbTrigger14", oWay);
- GetSetLocal("OrbTrigger16", oWay);
- GetSetLocal("OrbTrigger23", oWay);
- GetSetLocal("OrbTrigger25", oWay);
- GetSetLocal("OrbTrigger34", oWay);
- GetSetLocal("OrbTrigger36", oWay);
- GetSetLocal("OrbTrigger38", oWay);
- GetSetLocal("OrbTrigger45", oWay);
- GetSetLocal("OrbTrigger47", oWay);
- GetSetLocal("OrbTrigger56", oWay);
- GetSetLocal("OrbTrigger58", oWay);
- GetSetLocal("OrbTrigger67", oWay);
- GetSetLocal("OrbTrigger78", oWay);
- GetSetLocal("MatLever", oWay);
- SetLocalObject(OBJECT_SELF, "Waypoint", oWay);
- }
- void main() {
- object oPC = GetEnteringObject();
- if (!GetIsPC(oPC) || GetIsDM(oPC))
- return;
- SetupLasers();
- /* Fire up lasers if no one else has entered and done so */
- object oCheck = GetNearestCreature(CREATURE_TYPE_PLAYER_CHAR, PLAYER_CHAR_IS_PC, oPC);
- if (!GetIsObjectValid(oCheck))
- DoHeartbeat();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement