Simple Round-based mod

Please don't post here unless its in response to an existing topic. New discussion is to be shared in the other forums.

Simple Round-based mod

Postby Wildfire » Tue Jun 05, 2007 1:49 pm

I'm looking to make a very simple, very straightforward round-based teamplay mod out of the HL2MP SDK.

Player dies, he is forced to spectate until the end of the round. When all players on one team die, or the timer runs out, the round restarts. Just like CS.

Now, I found this tutorial on the VDC, entitled Resetting Maps and Entities. I followed it all the way through to the end, where I realized it never explained how to make players not respawn, or how to create the round timer, etc.

There were some tutorials on the SourceWiki place that did, but that site is long dead. There is a Last Man Standing tutorial, here, but it seems really messy, has missing info (refers to a roundtimer function that it never explains how to set up), and is supposed to allow for an optional number of lives, etc. which I don't want. Just looking to make a simple round-based mod.

Anyone wanna point me in the right direction?
-Wild
Wildfire
New Blood
 
Posts: 35
Joined: Mon Dec 04, 2006 4:36 pm
Location: NM, USA

Postby whitfield » Wed Jun 06, 2007 8:04 am

Well... to make a round-based teamplay mod, think of the requirements.

Youre going to need a method that makes all living players start back at given spawn points resetting their player variables. Methods are already set up to find spawn locations(if youre basing it on info_player_start's). If you want to use a different entity so you can make team-based spawn points, then go look at whatever method finds spawn locations( it's in the CGameRules class ). Just copy code. You are going to want to make sure not to kill players because that will execute some code changing stats you might not want changed. You will simply be using SetAbsOrigin on every player matching the origin with a spawn point's origin. For the players that are already dead, you should be calling a spawn method on them.

I don't know specifics because it is impossible to memorize code.

If this all sounds too confusing to you, then I suggest you first learn how to learn code. If you need help with that, PM me and I will PM you my contacts.
whitfield
Site Admin
 
Posts: 29
Joined: Tue Dec 12, 2006 1:15 pm

Postby Wildfire » Wed Jun 06, 2007 10:45 am

Sounds simple enough, however the thing that I've been having trouble with is actually getting the game to trigger a round reset.

What I'm thinking is that I can copy the Intermission function that is called when a level is about to change, but instead of freezing players, showing the scoreboard, and changing the level, it can reset the map and respawn the players instead.

I'm assuming its the Think function in the gamerules where I would check to see if the timer has run out or if all players on one team is dead so it can perform this Round Intermission, right?

The problem is that I can't seem to find any sort of function that allows you to check how many players on a team is dead. And I'm not exactly sure where I would even begin to make a timer. Perhaps copy the mp_timelimit code?
-Wild
Wildfire
New Blood
 
Posts: 35
Joined: Mon Dec 04, 2006 4:36 pm
Location: NM, USA

Postby Bob » Wed Jun 06, 2007 11:35 am

You've got it. There are functions for their deaths. You can just use the players death function to trigger a team change and display the appropriate menus.
Bob
Site Admin
 
Posts: 252
Joined: Mon Nov 20, 2006 12:24 am
Location: San Jose California

Postby whitfield » Wed Jun 06, 2007 4:57 pm

There isn't going to be a function for everything. You can write your own method to check for dead players. I forget exactly how you get the player list, but it's probably somewhere in game rules. The one thing I do know is that you can lookup entities by class.

So just get every single player and run a loop testing each one for their dead flag. Put in a counter and you have yourself the number of dead players. :)

Also, as far as copying code, you've got it. That's exactly how 80% of coding is done. Copy and paste with minor edits.

Hizzuh.
whitfield
Site Admin
 
Posts: 29
Joined: Tue Dec 12, 2006 1:15 pm


Return to Unsorted Old Posts

Who is online

Users browsing this forum: No registered users and 1 guest

cron