Posted by: DarkNight
Date posted: Apr 15 2003 User Rating: 5 out of 5.0 | Number of views: 4275 Number of comments: 2 | Description: Setting up Client side and FGD |
This part of the tutorial will show you how to setup the client side and the FGD for the CTF Gamerules.
NOTE: This code will need modifying to suit your team system,ect so don't take this as a complete C&P (which it basically is).
Open up hl_events.cpp and find the following: void EV_TripmineFire( struct event_args_s *args ); and put this after it:
| | | void EV_Flag( struct event_args_s *args );
|
Next, in the same file, find: gEngfuncs.pfnHookEvent( "events/tripfire.sc", EV_TripmineFire ); and after it put this:
| | | gEngfuncs.pfnHookEvent( "events/object.sc", EV_Flag );
|
Next, in ev_hldm.cpp, find: void EV_TripmineFire( struct event_args_s *args ); and at the end of that function put this:
| | | void EV_Flag(struct event_args_s *args );
|
Same file, ev_hldm.cpp, find: void EV_TripmineFire( event_args_t *args ) and at the end of that function put this:
| | | #define FLAG_STOLEN 1 #define FLAG_CAPTURE 2 #define FLAG_DROPPED 3
void EV_Flag( event_args_t *args ) { int idx = args->entindex; int type = args->iparam1;
// Feel free to change the model that is attached to the player int FlagModel = gEngfuncs.pEventAPI->EV_FindModelIndex("models/flag.mdl");
switch( type ) { case FLAG_STOLEN: // Attach model to player gEngfuncs.pEfxAPI->R_AttachTentToPlayer( idx, FlagModel, 52, 9999); // The 52 is the z offset from the player and the 9999 is how long you want it to be attached for // Add more stuff here if you like break; case FLAG_CAPTURE: // Add stuff here if you like case FLAG_DROPPED: // Add more stuff here if you like // This gets rid of the attached model gEngfuncs.pEfxAPI->R_KillAttachedTents(idx); break; } }
|
Now to setup the FGD we do the following at the bottom of the FGD:
| | | @PointClass = object_flag: "The Flag" [] @SolidClass base(Targetx) = capture_team1: "Where Team 1 brings the Flag" [ m_iPoints(integer) : "Points" : 1 ] @SolidClass base(Targetx) = capture_team2: "Where Team 2 brings the Flag" [ m_iPoints(integer) : "Points" : 1 ]
|
And that concludes my 3 Part tutorial on the CTF Gameplay. If you have any complaints, suggestions,problems,ect. Feel free to email me at the_dark_wonderer@hotmail.com |
|
User Comments
Showing comments 1-2
|
Where I can find ctf_objects.h? |
|
How to fix it?
--------------------Configuration: hl - Win32 Profile-------------------- Compiling... teamplay_gamerules.cpp C:\CleanSDK\SDK\SourceCode\dlls\teamplay_gamerules.cpp(372) : error C2065: 'pPlayer' : undeclared identifier C:\CleanSDK\SDK\SourceCode\dlls\teamplay_gamerules.cpp(372) : error C2227: left of '->pev' must point to class/struct/union C:\CleanSDK\SDK\SourceCode\dlls\teamplay_gamerules.cpp(372) : error C2227: left of '->netname' must point to class/struct/union ctf_gameplay.cpp C:\CleanSDK\SDK\SourceCode\dlls\ctf_gameplay.cpp(220) : error C2039: 'm_iTeam' : is not a member of 'CBasePlayer' C:\CleanSDK\SDK\SourceCode\dlls\player.h(71) : see declaration of 'CBasePlayer' C:\CleanSDK\SDK\SourceCode\dlls\ctf_gameplay.cpp(251) : error C2039: 'm_iTeam' : is not a member of 'CBasePlayer' C:\CleanSDK\SDK\SourceCode\dlls\player.h(71) : see declaration of 'CBasePlayer' C:\CleanSDK\SDK\SourceCode\dlls\ctf_gameplay.cpp(334) : error C2039: 'm_iTeam' : is not a member of 'CBasePlayer' C:\CleanSDK\SDK\SourceCode\dlls\player.h(71) : see declaration of 'CBasePlayer' C:\CleanSDK\SDK\SourceCode\dlls\ctf_gameplay.cpp(362) : error C2039: 'm_iTeam' : is not a member of 'CBasePlayer' C:\CleanSDK\SDK\SourceCode\dlls\player.h(71) : see declaration of 'CBasePlayer' Error executing cl.exe.
hl.dll - 7 error(s), 0 warning(s) |
|
You must register to post a comment. If you have already registered, you must login.
|
297 Approved Articless
6 Pending Articles
3940 Registered Members
0 People Online (12 guests)
|
|