October 04, 2023, 06:53:16 pm

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]

Author Topic: [Server mod] BBall  (Read 2265 times)

Chu

  • Dino man
  • 2011 Haxxy Award Winner
  • *
  • Karma: 26
  • Offline Offline
  • Posts: 2732
  • hm
    • Steam Account
[Server mod] BBall
« on: August 21, 2012, 10:43:17 pm »

NOTE: I took most of the code for neutral intels from Lorgan's special delivery mod, I hope he doesn't mind

This is rocketjump basketball, best played with teams of 1-3.
  • grab the "red" intel in the middle and dunk it into the opponent's basket
  • killing the intel carrier will automatically give you the intel



^ use this map for hosting

if for some reason you want to make a custom map, here's how it works:
  • red intel is exposed
  • blu intel is in the ground somewhere, preferrably near the red intel and in plain view
  • place capture zones where you want the baskets to be
  • use team-colored intel walls to prevent players from dunking into the wrong basket
  • optional: use player walls and move boxes to prevent players from capping from the sides and bottom of the basket
Versions: should work for any version as long as intel grab syncing doesn't change dramatically

Conflicts: Special Delivery, since the plugin recognizes a bball map by the same criteria (intel and capture zones). If there's a way to avoid this, please let me know

Code: [Select]
//ghetto modded to work for bball by chu, built off of
// Lorgan's special delivery game mode server plugin!
// Vanilla compatible!



global.bball = true;

//patching the inteligence stuff to work for special delivery
object_event_add(IntelligenceRed,ev_create,0,"
    delivered = true;
    first = false;
");
object_event_add(IntelligenceRed,ev_alarm,0,"delivered = true;");

object_event_add(IntelligenceBlue,ev_alarm,0,"
    if global.isHost && global.bball {
        doEventReturnIntel(TEAM_RED);
        sendEventReturnIntel(TEAM_RED);
        with(Intelligence) delivered = true;
    }
");

//changing the collision code because that has to work completely different
object_event_clear(Character,ev_collision,IntelligenceRed);
object_event_add(Character,ev_collision,IntelligenceRed,"
    // Intelligence grabbing is synced now, so it's only tested on the server
    if(global.isHost and !global.mapchanging) {
        if !global.bball {
            if(team == TEAM_BLUE and !place_meeting(x,y,TeamGate) and canGrabIntel == 1 and ubered == 0 and !cloak) {
                sendEventGrabIntel(player);
                doEventGrabIntel(player);
            }
        } else if (other.delivered and canGrabIntel == 1 and ubered == 0 and !cloak) {
            if player.team == TEAM_BLUE {
                sendEventGrabIntel(player);
                doEventGrabIntel(player);
            } else if other.alarm[0] < 0 {
                other.delivered = false;
                sendEventGrabIntel(player);
                doEventGrabIntel(player);  
            }
        }
    }
");

object_event_clear(Character,ev_collision,IntelligenceBaseRed);
object_event_add(Character,ev_collision,IntelligenceBaseRed,"
    if(global.isHost) {
        if(team == TEAM_RED and intel == true) && !global.bball {
            sendEventScoreIntel(player);
            doEventScoreIntel(player);
            GameServer.syncTimer = 1;
        }
    }
");

object_event_clear(Character,ev_collision,IntelligenceBlue);
object_event_add(Character,ev_collision,IntelligenceBlue,"
    // Intelligence grabbing is synced now, so it's only tested on the server
    if(global.isHost and !global.mapchanging) {
        if other.alarm[0] < 0 && global.bball exit;
        if(team == TEAM_RED and !place_meeting(x,y,TeamGate) and canGrabIntel == 1 and ubered == 0 and !cloak) {
            sendEventGrabIntel(player);
            doEventGrabIntel(player);
        }
    }
");

object_event_clear(Character,ev_collision,IntelligenceBaseBlue);
object_event_add(Character,ev_collision,IntelligenceBaseBlue,"
    if(global.isHost) {
        if(team == TEAM_BLUE and intel == true) && !global.bball {
            sendEventScoreIntel(player);
            doEventScoreIntel(player);
            GameServer.syncTimer = 1;
        }
    }
");

//shorten the drop time because else it would be too hard to defend the ball


object_event_clear(Character,ev_other,ev_user5);
object_event_add(Character,ev_other,ev_user5,"
    if intel == true {
        sound_play(IntelDropSnd);
        intel=false;
        canGrabIntel=false;
        alarm[1]=150;
        animationOffset=CHARACTER_ANIMATION_NORMAL;
        var isMe;
        isMe = (global.myself == player);
        recordEventInLog(5, player.team, player.name, isMe);
            
        if(team == TEAM_RED) {
            newIntel = instance_create(x,y,IntelligenceBlue);
        } else if (team == TEAM_BLUE){
            newIntel = instance_create(x,y,IntelligenceRed);
        }
        newIntel.alarm[0] = 90;
    }
");

object_event_add(Character,ev_destroy,0,"
    if intel && global.isHost && global.bball {
        with(Intelligence) {
            if alarm[0] >= 90 alarm[0] = 90;
        }
var resetTeam;
if team == TEAM_RED resetTeam = TEAM_BLUE;
        else resetTeam = TEAM_RED;
        doEventReturnIntel(resetTeam);
        sendEventReturnIntel(resetTeam);
with(Intelligence) delivered = true;
if(instance_exists(lastDamageDealer)) {
if(lastDamageDealer.object != -1) {
sendEventGrabIntel(lastDamageDealer);
doEventGrabIntel(lastDamageDealer);
with(Intelligence) delivered = false;
}
}
    }
");

//the scorepanel does basically everything for the game mode to work
object_event_add(ScorePanel,ev_create,0,"
    if instance_exists(CaptureZone) && global.isHost {
        global.caplimit = 10;
        global.bball = true;
        global.sd_first = true;
        with(IntelligenceRed) {
            alarm[0] = 10;
            delivered = false;
            first = true;    
        }
        GameServer.syncTimer = 1;
    } else {
        global.bball = false;
        global.caplimit = global.caplimitBkup;
    }
    
    silentTimer = 0;
");

object_event_add(ScorePanel,ev_step,ev_step_begin,"
    if global.bball && global.winners == -1 {
        if instance_exists(IntelligenceRed) {
            if IntelligenceRed.first {
                if IntelligenceRed.delivered {
                    IntelligenceRed.first = false;
                    ServerMessageString('Go!',global.eventBuffer);
                    with NoticeO instance_destroy();
                    notice = instance_create(0, 0, NoticeO);
                    notice.notice = NOTICE_CUSTOM;
                    notice.message = 'Go!';
                }
            }
        }
        var redOnPoint, blueOnPoint, capper;
        redOnPoint = false;
        blueOnPoint = false;
        capper = noone;
        with(Character) {
            if cappingPoint != noone {
                //is someone capping?
                if intel capper = player.team;
                if capper == TEAM_RED {
                    global.redCaps += 1;
GameServer.syncTimer = 1;
//event_user(5);
hp = 0;
                } else if capper == TEAM_BLUE {
                    global.blueCaps += 1;
GameServer.syncTimer = 1;
//event_user(5);
hp = 0;
                }
            }
        }
    }
");

//for capturing the "platform"
object_event_clear(CaptureZone,ev_create,0);
object_event_add(CaptureZone,ev_create,0,"
    if(instance_exists(ArenaControlPoint)) {
        cp = ArenaControlPoint.id;
    } else if instance_exists(ControlPoint) {
        cp = instance_nearest(x,y,ControlPoint);
    } else cp = 9999;
");
« Last Edit: January 27, 2013, 05:08:15 pm by Chu »
Logged
Click links.

Dusty

  • 2012 Haxxy Award Winner
  • *
  • Karma: -78
  • Offline Offline
  • Posts: 11006
  • Dust in a box under a table
Re: [Server mod] BBall
« Reply #1 on: August 21, 2012, 11:02:21 pm »

Place an entity that SD can't use, such as a generator perhaps.

Machidro

  • 2013 Haxxy Award Winner
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 1674
  • Gardicolo time is over.
Re: [Server mod] BBall
« Reply #2 on: August 21, 2012, 11:32:14 pm »

Use setup gates. They're kind of square-y.
Logged
A CHALLENGER HAS ARRIVED.

Machidro

  • 2013 Haxxy Award Winner
  • *
  • Karma: 5
  • Offline Offline
  • Posts: 1674
  • Gardicolo time is over.
Re: [Server mod] BBall
« Reply #3 on: August 21, 2012, 11:33:11 pm »

Good job. I'm liking the influx of plugins.
Logged
A CHALLENGER HAS ARRIVED.

Lorgan

  • Retired Randomizer Mod Developer
  • Resident Miku
  • *****
  • Karma: 28
  • Offline Offline
  • Posts: 3657
    • My own website
Re: [Server mod] BBall
« Reply #4 on: August 22, 2012, 03:02:36 am »

Nah I don't mind. And I don't think that SD will be compatible with this unless we combine them into 1 superplugin because you probably cleared parts of the intel code too.
Logged
Unfortunately, turning a section into a communist oppressive regime is not against the forum rules, so there is really nothing we can do.
Quote from: steam
21:08 - Hullusorsa: lorgan, when will you buy us the keys?
21:09 - Lorgan: i'm waiting for greece to collapse so the value of the euro drops
21:09 - Lorgan: not even joking

bullets (obviously)

  • Seasoned Member
  • *****
  • Karma: 40
  • Offline Offline
  • Posts: 1962
Re: [Server mod] BBall
« Reply #5 on: August 22, 2012, 09:27:35 am »

It was insanely desync laggy when you hosted yesterday, I don't know if it was your server (never lagged before), my comp, or the plugin. I don't get lag on SD though, even though I don't have the plugin.
Definitely a fun mod, though it'll probably be spammy with more than 2v2 :c1:
Logged

Chu

  • Dino man
  • 2011 Haxxy Award Winner
  • *
  • Karma: 26
  • Offline Offline
  • Posts: 2732
  • hm
    • Steam Account
Re: [Server mod] BBall
« Reply #6 on: August 22, 2012, 01:51:27 pm »

there should be any problem with desync, but i'll do more testing tonight
Logged
Click links.
Pages: [1]
 

Page created in 0.042 seconds with 50 queries.