July 28, 2021, 04:41:06 am

The Gang Garrison 2 Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

NOTICE: Due to a rise in bot activity, new posters need to be approved before posting.

Join the community Discord server!

Pages: [1] 2 3 ... 5

Author Topic: FreezeTime [UPDATED: No Escape Edition]  (Read 11769 times)

Machidro

  • 2013 Haxxy Award Winner
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 1675
  • Gardicolo time is over.
FreezeTime [UPDATED: No Escape Edition]
« on: September 10, 2012, 10:42:48 am »



Update: The plugin now works with 2.9.2 map voting and includes pandaturd's fixes (thank you!)

This plugin prevents players from leaving the spawn for 10 seconds (editable number) on all modes(except on arena and AD/CP), preventing annoying scenarios where the first team out of their gate will win.

This plugin changes the behavior of some fairly important entities, so if you find any bugs, please post.

Now updated, timers should refill after the countdown is complete.

Updated again, players should no longer be able to go through horizontal team doors, clients shouldn't have issues joining arena maps, and I did some code clean up.

Compatibility: All versions and maps
Version: All

Code: [Select]
//change the 10's in the below hud create events to however many seconds you want your map to have locked doors.

//we have to assign these hud values individually because all of the below override HUD's //create event.
// we still need to announce arena so that we can join servers playing arena without crashing


object_event_add(CTFHUD,ev_create,0, 'global.TimeLeftTillStart=10*global.game_fps ');
object_event_add(GeneratorHUD,ev_create,0, 'global.TimeLeftTillStart=10*global.game_fps ');
object_event_add(KothHUD,ev_create,0, 'global.TimeLeftTillStart=10*global.game_fps ');
object_event_add(DKothHUD,ev_create,0, 'global.TimeLeftTillStart=10*global.game_fps ');
object_event_add(ControlPointHUD,ev_create,0, 'global.TimeLeftTillStart=10*global.game_fps ');

//leave at zero, arena needs no wait. We need to declare this to prevent a crash if you join an arena match as a client.
object_event_add(ArenaHUD,ev_create,0, 'global.TimeLeftTillStart=0');

//If the time left isnt up, decrement the timer and ensure that teamgates are solid.
//Otherwise, unlock the gates.

object_event_add(HUD,ev_step,ev_step_begin,'

//run only as host.
if (global.isHost)
{

//decrease time left
if instance_exists(IntelligenceBaseBlue) || instance_exists(IntelligenceBaseRed) || instance_exists(IntelligenceRed) || instance_exists(IntelligenceBlue) {
if global.TimeLeftTillStart>0 {
global.TimeLeftTillStart-=1;
}
}

else if instance_exists(GeneratorBlue) || instance_exists(GeneratorRed) {
if global.TimeLeftTillStart>0 {
global.TimeLeftTillStart-=1;
}
}

else if instance_exists(KothControlPoint) {
if global.TimeLeftTillStart>0 {
global.TimeLeftTillStart-=1;
}
}


else if instance_exists(KothRedControlPoint) && instance_exists(KothBlueControlPoint) {
if global.TimeLeftTillStart>0 {
global.TimeLeftTillStart-=1;
}
}

else if instance_exists(ControlPoint) {
if global.TimeLeftTillStart>0 {
global.TimeLeftTillStart-=1;

//if we are playing AD/CP  (or map voting, shameless compatibility plug), no wait to start. If you want a map to not to have a time limit
//on startup, just add another OR check with your maps name.
if (instance_exists(ControlPointSetupGate) || string_pos("map_voting", string_lower(global.currentMap)) != 0)
{global.TimeLeftTillStart=0;}
}
}

//Now that weve ensured its solid, make announcements every second so players know whats going on.
if global.TimeLeftTillStart>0 and global.TimeLeftTillStart mod global.game_fps = 0
{
ServerMessageString("Spawn doors will open in " + string(round(global.TimeLeftTillStart/global.game_fps)) + " seconds.",global.sendBuffer);
with NoticeO instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = "Spawn doors will open in " + string(round(global.TimeLeftTillStart/global.game_fps)) + " seconds.";
}
//announce opening at one instead of zero so that we dont need another variable to say weve already announced this
else if global.TimeLeftTillStart=1
{
ServerMessageString("Spawn doors are open! Fight!",global.sendBuffer);
with NoticeO instance_destroy();
notice = instance_create(0, 0, NoticeO);
notice.notice = NOTICE_CUSTOM;
notice.message = "Spawn doors are open! Fight!";

//refill game timers based on game mode.
if instance_exists(CTFHUD) {
CTFHUD.timer=CTFHUD.timeLimit;
GameServer.syncTimer=1;
}
if instance_exists(ControlPointHUD) {
ControlPointHUD.timer=ControlPointHUD.timeLimit;
GameServer.syncTimer=1;
}
if instance_exists(DKothHUD) {
DKothHUD.cpUnlock=900;
GameServer.syncTimer=1;
}
if instance_exists(KothHUD) {
KothHUD.cpUnlock=900;
GameServer.syncTimer=1;
}
if instance_exists(GeneratorHUD) {
GeneratorHUD.timer=GeneratorHUD.timeLimit;
GameServer.syncTimer=1;
}

}
}
//if you arent the host, set the timers to zero. This means that the actual hosts numbers wont overlap with yours or desync, and that you wont get
//trapped on doors when walking through them, and that you wont get random messages when entering lobbies as a client.
else
{
if global.TimeLeftTillStart!=0 {global.TimeLeftTillStart=0}
}
');

//Move outside of the walls if in contact.

object_event_add(Character,ev_collision,RedTeamGate,'
if global.TimeLeftTillStart>0
{
x=xprevious;
    hspeed=0;
    moveStatus = 0;
    if(place_meeting(x,y,TeamGate)) {
        if(not place_meeting(x+8,y,TeamGate)) {
            move_contact_solid(0,8);
        } else if(not place_meeting(x-8,y,TeamGate)) {
            move_contact_solid(180,8);
        }
    }
}
');

//blue team walls
object_event_add(Character,ev_collision,BlueTeamGate,'
if global.TimeLeftTillStart>0
{
x=xprevious;
    hspeed=0;
    moveStatus = 0;
    if(place_meeting(x,y,TeamGate)) {
        if(not place_meeting(x+8,y,TeamGate)) {
            move_contact_solid(0,8);
        } else if(not place_meeting(x-8,y,TeamGate)) {
            move_contact_solid(180,8);
        }
    }
}
');

//red floors
object_event_add(Character,ev_collision,RedTeamGate2,'
if global.TimeLeftTillStart>0
{
y=yprevious;
    vspeed=0;
    moveStatus = 0;
    if(place_meeting(x,y,TeamGate)) {
        if(not place_meeting(x,y-8,TeamGate)) {
            move_contact_solid(90,8);
        } else if(not place_meeting(x,y+8,TeamGate)) {
            move_contact_solid(270,8);
        }
    }
}

');

//blue floors
object_event_add(Character,ev_collision,BlueTeamGate2,'
if global.TimeLeftTillStart>0
{
y=yprevious;
    vspeed=0;
    moveStatus = 0;
    if(place_meeting(x,y,TeamGate)) {
        if(not place_meeting(x,y-8,TeamGate)) {
            move_contact_solid(90,8);
        } else if(not place_meeting(x,y+8,TeamGate)) {
            move_contact_solid(270,8);
        }
    }
}
');
« Last Edit: August 13, 2020, 12:01:38 am by Machidro »
Logged
A CHALLENGER HAS ARRIVED.

GG2RBY

  • Guest
Re: FreezeTime
« Reply #1 on: September 10, 2012, 12:50:23 pm »

10/10
Logged

trog

  • member of intel's squad of garbagemen against the yakuza
  • Veteran Member
  • ******
  • Karma: 27
  • Offline Offline
  • Posts: 10080
  • i am uberdeath
Re: FreezeTime
« Reply #2 on: September 10, 2012, 06:11:24 pm »

based tis ty ty
Logged

PM me your apps for my clan

92% of people who see this will not
have the guts to repost it. When Goku
died in the explosion Cell tied to destroy Earth with, he did it for you and me. If you're not ashamed to love Goku, post this as your status and show everyone. Thank you, Goku. I lifted up my arms for the spirit bomb every time you asked for my energy.

Machidro

  • 2013 Haxxy Award Winner
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 1675
  • Gardicolo time is over.
Re: FreezeTime
« Reply #3 on: September 10, 2012, 08:56:07 pm »

Thank you.

However, I didn't do this for my health. Server hosts who only read the unread replies list: please, start using this plugin on your server.

Also, I want to see this used in the next PUG.
Logged
A CHALLENGER HAS ARRIVED.

Dokurider

  • Humble Servant of the Trinity
  • Veteran Beta Tester
  • *****
  • Karma: 14
  • Offline Offline
  • Posts: 1496
  • Your sins have no absolution
Re: FreezeTime
« Reply #4 on: September 11, 2012, 02:32:36 am »

Next time I host a server, this is definitely going to be used.
Logged
Liked Final Fantasy Tactics, but wanted more? Then come visit:

OLag

  • Fool
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 1369
Re: FreezeTime
« Reply #5 on: September 17, 2012, 03:44:00 pm »

Awesome
Logged
<Orpheon|offline> nothing is wierd if someone does it

Silent Boom

  • Lucky Member
  • *******
  • Karma: 17
  • Offline Offline
  • Posts: 1013
Re: FreezeTime
« Reply #6 on: October 03, 2012, 10:20:55 am »

Does this also take 10 seconds away from the main time counter?

Phantom Brave

  • All Hail Classicwell
  • Moderator
  • *****
  • Karma: 70
  • Offline Offline
  • Posts: 12701
  • Another one --
Re: FreezeTime
« Reply #7 on: October 03, 2012, 01:44:12 pm »

apparently so, but I'm not sure
Logged

http://steamcommunity.com/id/wareya/
ladies and gentlemen i would like to announce that the fact of the matter is up that the fact of the matter is a fact and it matters

Machidro

  • 2013 Haxxy Award Winner
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 1675
  • Gardicolo time is over.
Re: FreezeTime
« Reply #8 on: October 03, 2012, 07:12:45 pm »

Updated.

Does this also take 10 seconds away from the main time counter?

Not anymore. :smiley16:
Logged
A CHALLENGER HAS ARRIVED.

bullets (obviously)

  • Seasoned Member
  • *****
  • Karma: 40
  • Offline Offline
  • Posts: 1962
Re: FreezeTime
« Reply #9 on: November 21, 2012, 06:06:11 pm »

Minor glitch that I found awhile ago - if you get to the teamdoors immediately you can get out before the timer starts counting down, don't know why and it doesn't work with most maps
Logged

Machidro

  • 2013 Haxxy Award Winner
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 1675
  • Gardicolo time is over.
Re: FreezeTime
« Reply #10 on: November 22, 2012, 02:14:33 pm »

Pretty sure that's a glitch with Noir, not my plugin. The upper route's staircase has no team doors, which means that the area isn't actually locked. This allows players exit before the timer ends, or, with some rocketjumping, entry into blu's spawn.

« Last Edit: November 22, 2012, 02:15:55 pm by Machidro »
Logged
A CHALLENGER HAS ARRIVED.

Machidro

  • 2013 Haxxy Award Winner
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 1675
  • Gardicolo time is over.
Re: FreezeTime
« Reply #11 on: November 22, 2012, 02:18:42 pm »

On recheck, I see that horizontal team doors respond glitchily during countdown. That makes us both right, nice catch. Will fix.
Logged
A CHALLENGER HAS ARRIVED.

Machidro

  • 2013 Haxxy Award Winner
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 1675
  • Gardicolo time is over.
Re: FreezeTime [UPDATED: No Escape Edition]
« Reply #12 on: December 18, 2012, 11:03:19 pm »

I fixed it, along with a few other bugs. Enjoy.
Logged
A CHALLENGER HAS ARRIVED.

BTW I am Infiltrator

  • Junior Member
  • **
  • Karma: 3
  • Offline Offline
  • Posts: 83
  • Butt of SEY
    • "BTW I am Server" Thread
Re: FreezeTime [UPDATED: No Escape Edition]
« Reply #13 on: January 02, 2013, 12:06:39 pm »

Excellent plugin. I'm sure you've seen me using it, and I haven't gotten complaints after implementing it. I'll apply the Dec 19 update tonight, thanks.
Logged
Come on come on! Slap it now! :x18:
Offical "BTW I am Server" Thread

Derpduck

  • 2011 Haxxy Finalist
  • *
  • Karma: 42
  • Offline Offline
  • Posts: 5770
Re: FreezeTime [UPDATED: No Escape Edition]
« Reply #14 on: January 25, 2013, 10:21:23 am »

Code: [Select]
ERROR in
action number 2
of Other Event: Game End
for object GameServer:

Error in code at line 17:
    RUNNING_TIME = shutdownTime - startupTime;
                                 ^
at position 32: Unknown variable startupTime
I got this when closing the server during freeze time. Not that it really matters since the server was going to close anyway.
Pages: [1] 2 3 ... 5
 

Page created in 0.033 seconds with 37 queries.