December 08, 2021, 12:16:46 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 ... 3 4 [5]

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

Derpduck

  • 2011 Haxxy Finalist
  • *
  • Karma: 42
  • Offline Offline
  • Posts: 5770
Re: FreezeTime [UPDATED: No Escape Edition]
« Reply #60 on: October 16, 2014, 02:11:06 am »

You can get stuck in the floor on maps with horizontal gates on stairs like that if you run into them during freezetime.

pandaturds

  • Full Member
  • ***
  • Karma: 2
  • Offline Offline
  • Posts: 225
  • gg2oomer
Re: FreezeTime [UPDATED: No Escape Edition]
« Reply #61 on: May 01, 2020, 07:29:23 am »

When I tried using this plugin it went twice as fast as it did not account for the server's FPS (60 in my case).

Attached fix will make this work on both 30 or 60 fps by checking global.game_fps.
Logged
r.i.p [AT] / [THA]
bird goes tweet

Machidro

  • 2013 Haxxy Award Winner
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 1675
  • Gardicolo time is over.
Re: FreezeTime [UPDATED: No Escape Edition]
« Reply #62 on: August 13, 2020, 12:03:01 am »

When I tried using this plugin it went twice as fast as it did not account for the server's FPS (60 in my case).

Attached fix will make this work on both 30 or 60 fps by checking global.game_fps.

Thanks pandaturds! I've updated the OP to include your changes as part of recent fixes to support 2.9.2 map voting
Logged
A CHALLENGER HAS ARRIVED.

Derpduck

  • 2011 Haxxy Finalist
  • *
  • Karma: 42
  • Offline Offline
  • Posts: 5770
Re: FreezeTime [UPDATED: No Escape Edition]
« Reply #63 on: December 11, 2020, 03:18:22 pm »

I had a quick go at updating this plugin just to make some minor improvements while it's still in use:
Fixed some indenting issues/improved code readability
Improved method for blocking players from team doors, using the updated collision code methods
Removed various redundancies
Improved gamemode checking and added compatibility for invasion mode

It is now much harder to accidently get stuck on maps like ctf_noir, I had to really intentionally try to get stuck for it to happen.

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(CTFHUD) or instance_exists(InvasionHUD) or instance_exists(KothHUD) or instance_exists(GeneratorHUD) or instance_exists(DKothHUD){
if global.TimeLeftTillStart>0 {
global.TimeLeftTillStart-=1;
}
} else if instance_exists(ControlPointHUD) {
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 (ControlPointHUD.mode==0 or 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;
}
if instance_exists(InvasionHUD) {
InvasionHUD.timer=InvasionHUD.timeLimit;
}
if instance_exists(ControlPointHUD) {
ControlPointHUD.timer=ControlPointHUD.timeLimit;
}
if instance_exists(DKothHUD) {
DKothHUD.cpUnlock=900;
}
if instance_exists(KothHUD) {
KothHUD.cpUnlock=900;
}
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;
}
}
');

//Make gates solid during setup time
object_event_add(Character,ev_collision,TeamGate,'
if global.TimeLeftTillStart>0 {
TeamGate.solid=true
}
');
« Last Edit: December 11, 2020, 03:23:26 pm by Derpduck »
Logged
Pages: 1 ... 3 4 [5]
 

Page created in 0.028 seconds with 36 queries.