Call of Duty 4 & World at War - Online Gaming HQ SeF clan  
[SeF] Clan - Call of Duty 4 & World at War -  | Submit a Story | Call of Duty Links | Calendar | Search on Website | Webstats  - Multiplayer CoD CoDUO CoD2 CoD4 CoD WaW
Welcome to News, Mod & Custom Map Download Center Sunday, July 20 2008 @ 08:34 PM CEST
- Traduire - Traducir -

translate - traduire - traducir översätta - oversætte übersetzen - kääntää - tradurre - traduzir


Topics - All Articles
Home - Startseite - Actualités
Call of Duty 4 News
Call of Duty WaW News
Call of Duty 4 & WaW Deutsch
Call of Duty 4 & WaW Français
Call of Duty 4 Modern Warfare
Call of Duty 4 Mod + Mapping
Call of Duty 4 Screenshots
Call of Duty 4 Multiplayer Maps
Call of Duty 4 Xbox & PS3 News
Call of Duty 4 Gametrailers
Call of Duty 4 Video's YouTube
Call of Duty 4 Developer Tools
Game Development
Call of Duty United Offensive
Call of Duty 2 Multiplayer
German Front Mod CoD
CoD4 Custom Map Download
[SeF] Clan News
[SeF] Clan Members
[SeF] CoD Public Servers
Red Faction: Guerrilla
Gamerzine
Multiplayer Gaming News
Mature Free Online Games
Robbski Game Reviews

Europe Game Engine

Free game engine

The Free Game Engine


.


Call of Duty WaW News

Who's Online
Guest Users: 85

User Functions
Username:

Password:

Don't have an account yet? Sign up as a New User

London Games Festival
London Games Festival

Online Gaming HQ EU

Call of Duty 5



[TUTORIAL] Beginners guide to modifying gametypes CoD4    
Sunday, March 30 2008 @ 04:34 AM CEST

Call of Duty 4 Developer Tools

For those who are searching for a tutorial on how to modify gametypes in CoD4....

ShabbaStoney wrote one and when you click on READ MORE you can find out how coding in CoD4 is done.




Ok so now we're gonna start some coding.


First thing is to go to rawmapsmpgametypes and copy sab.gsc into your mod folder.



Now you can open sab.gsc in notepad / wordpad / visual studio / programmers notepad etc...

So now we have the gsc opened up we can start changing the game type.

Go to the function called onSpawnPlayer(), just above this function create a new function called updateGameType() and within this function put a while loop into it ( see pic ).



This function will be where all your game logic happens.

The next step is to thread this function from onSpawnPlayer(), using self thread updateGameType();



Now we have a function that will be called when the player spawns, lets start some coding!

In this example I am going to make it so that the player drops their weapon when they jump and shoot, it doesnt work perfectly but don't worry about that.

Add this within the while loop:



// Get the players weapon
weapon = self GetCurrentWeapon();

if( self IsOnGround() == false )
{
if( self AttackButtonPressed() )
{
if( RandomInt( 100 ) == 50 )
{
self sayall( "My weapon back fired. How about that!" );
self suicide();
}
else
{
self DropItem( weapon );
}
}
}



Now all thats left is to fast file this baby and go to test it!

If you want to, you can download my sab.gsc file for reference:

http://rapidshare.com/files/103145509/sab.gsc

I was doing some messing around and found out you can add variables to self. So in the above sab.gsc I have self.pickedUpBomb = 0; at the start of onSpawnPlayer(), then when the player picks up the bomb, in onPickuP() I do self.pickedUpBomb = 1;. Within the updateGameType() function you can use this variable to test if the player has picked up the bomb. Not quite sure if this is the way you're supposed to do it, but it seems to work.

I hope someone finds this useful.


~ShabbaStoney



Note:

- When entering the while loop, I always test if the player is alive, if they are dead you should break from the while loop

Example:


while(1)
{
// If the player is dead we don't want to update do we?
if( !isAlive( self ) )
{
onDrop( self );
break;
}
}





What's Related


Created this page in 0.07 seconds                          

 Copyright © 2008 News, Mod & Custom Map Download Center
 All trademarks and copyrights on this page are owned by their respective owners.