Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // exec ("server/game/customStuff.cs");
- datablock StaticShapeData(testBlock)
- {
- shapeFile = "legions/data/shapes/props/jumppad/jumppad1.dts";
- };
- $testscore = 0;
- $zone1count = 0;
- $zone1count2 = 0;
- $zone1control = 0;
- datablock TriggerData(point1trigger){
- tickPeriodMS = 1000;
- };
- %obj = new Trigger(point1trigger) {
- canSaveDynamicFields = "1";
- Enabled = "1";
- Position = "162.342 482.691 225.491";
- rotation = "1 0 0 0";
- scale = "1 1 1";
- doDistanceFade = "0";
- startFadeDistance = "10";
- endFadeDistance = "500";
- teamIndex = "-1";
- dataBlock = "point1trigger";
- polyhedron = "0.0000000 0.0000000 0.0000000 30.0000000 0.0000000 0.0000000 0.0000000 -30.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
- active = "1";
- };
- function addZone1fx() {
- if(isObject($zone1fx))
- {
- }
- else
- {
- $zone1fx = new ParticleEmitterNode() {
- canSaveDynamicFields = "1";
- Enabled = "1";
- Position = "177.899 466.987 225.184";
- rotation = "0 0 1 190.222";
- scale = "1 1 1";
- doDistanceFade = "0";
- startFadeDistance = "10";
- endFadeDistance = "500";
- teamIndex = "-1";
- dataBlock = "defaultParticleEmitterNode";
- emitter = "captureRingEmitter";
- velocity = "1";
- };
- new StaticShape(point1shape) {
- dataBlock = "testBlock";
- position = "177.899 466.987 225.184";
- rotation = "1 0 0 0";
- scale = "1 1 1";
- };
- }
- }
- function deleteZone1fx() {
- $zone1fx.delete();
- }
- function point1trigger::onEnterTrigger( %this, %trigger, %obj )
- {
- %capZone1InRange = true;
- echo("In range.");
- addZone1fx();
- zone1capGuiBar.cancelDecay();
- zone1updateControl();
- Canvas.pushDialog(zone1capGui);
- if (%obj.getClassName() $= "Player" && %player.teamIndex == 1)
- {
- zone1playercount();
- }
- if (%obj.getClassName() $= "Player" && %player.teamIndex == 0)
- {
- zone1playercount2();
- }
- }
- function point1trigger::onLeaveTrigger( %this, %trigger, %obj )
- {
- %capZone1InRange = false;
- echo("Out of range.");
- deleteZone1fx();
- point1shape.delete();
- if (%obj.getClassName() $= "Player" && %player.teamIndex == 1)
- {
- zone1playerreset();
- }
- if (%obj.getClassName() $= "Player" && %player.teamIndex == 0)
- {
- zone1playerreset2();
- }
- if ($zone1count == 0){
- zone1capGuiBar.cancelUpdate();
- }
- zone1capGuiBar.decay();
- Canvas.popDialog(zone1capGui);
- }
- function point1trigger::onTickTrigger(%this,%trigger)
- {
- echo ("Ticked (while inside) defaultTrigger");
- // zone1capGuiBar.update();
- Parent::onTickTrigger(%this,%trigger);
- zone1updateControl();
- }
- function zone1capInit()
- {
- if(!isObject(zone1capGui))
- {
- new GuiControlProfile(zone1capGuiProfile)
- {
- opaque = false;
- // fillColor = "50 0 100 0.2";
- border = "1";
- // borderColor = "0 0 150";
- fillcolorhl = "0 0 100 0.5";
- fillcolorna = "0 0 100 0.5";
- // borderthickness = "5";
- // transparency = "0.2";
- };
- new GuiControl(zone1capGui)
- {
- position = "0 0";
- extent = "640 480";
- noCursor = true;
- modal = "false";
- helpTag = "0";
- setFirstResponder = "False";
- new GuiProgressCtrl(zone1capGuiBar)
- {
- profile = "zone1capProfile";
- horizSizing = "center";
- vertSizing = "top";
- position = "150 350";
- extent = "350 20";
- minExtent = "8 8";
- visible = "1";
- helpTag = "0";
- expression = "10";
- };
- };
- }
- }
- function zone1playercount() {
- $zone1count = $zone1count + 1;
- }
- function zone1playercount2() {
- $zone1count2 = $zone1count2 + 1;
- }
- function zone1playerreset() {
- $zone1count = $zone1count - 1;
- }
- function zone1playerreset2() {
- $zone1count2 = $zone1count2 - 1;
- }
- function zone1updateControl()
- {
- $zone1count = $zone1count;
- $zone1count2 = $zone1count2;
- if (($zone1count) > ($zone1count2))
- {
- $zone1control = "0";
- }
- if (($zone1count2) > ($zone1count))
- {
- $zone1control = "1";
- }
- if (($zone1count) == ($zone1count2))
- {
- $zone1control = "2";
- }
- else
- {
- $zone1control = "2";
- }
- }
- function zone1capGuiBar::cancelUpdate(%this)
- {
- if(isEventPending(zone1capGuiBar.updateThread))
- cancel(zone1capGuiBar.updateThread);
- }
- function zone1capGuiBar::decay(%this)
- {
- $newValue2 = %this.getValue() - 0.2;
- if (%newValue < 1 ) {
- %this.setValue($newValue2);
- %this.updateThread2 = %this.schedule(1000, "decay");
- }
- if(%newValue >= 1)
- {
- %newValue = 1;
- %this.setValue(%newValue);
- }
- }
- function zone1capGuiBar::cancelDecay(%this)
- {
- if(isEventPending(zone1capGuiBar.updateThread2))
- cancel(zone1capGuiBar.updateThread2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement