The Place to Start


Team Specific Doors 
Gavin
Easy


Team Specific Doors
Editor: RED is new, YELLOW is old. Here is a quick simple way to get it so doors only open for one team if the mapper wants them to. You need some basic knowledge of WorldCraft if you want to test this out yourself. First, open up doors.cpp and go down to the line: BYTE m_bUnlockedSentence; Under that put int TeamOnly; TeamOnly is the variable we will use to see which team can go through. Next go under the lines in the KeyValue function else if (FStrEq(pkvd->szKeyName, "WaveHeight")) { pev->scale = atof(pkvd->szValue) * (1.0/8.0); pkvd->fHandled = TRUE; } Insert else if( FStrEq( pkvd->szKeyName, "TeamDoors" ) ) { TeamOnly = atoi( pkvd->szValue ); pkvd->fHandled = TRUE; } that will take the value which the mapper set and put it in the TeamOnly integer. Go to the function DoorActivate and under the lines: if (!UTIL_IsMasterTriggered(m_sMaster, m_hActivator)) return 0; Put the heart of the whole team only door thing, the checking of the teams :) if(TeamOnly != 0) { if(TeamOnly == 1) { if(FStrEq(GetClassPtr((CBasePlayer *)m_hActivator->pev)->m_szTeamName, "Red")) { ClientPrint(m_hActivator->pev, HUD_PRINTCENTER, "Blue Door\n"); return; } else if(TeamOnly == 2) { if (FStrEq(GetClassPtr((CBasePlayer *)m_hActivator->pev)->m_szTeamName, "Blue")) { ClientPrint(m_hActivator->pev, HUD_PRINTCENTER, "Red Door\n"); return; } } Thats the heart of everything, it checks everything. If the TeamOnly variable is not 0 then it will execute the code, else it just skips over checking what team you are on. I set the TeamOnly to an integer and not a string because I wanted to restrict what teams the mappers could say would go through there, it would be horrible if a mapper misspelled the team name! If TeamOnly is one, one would be set by the mapper for whatever team you asaigned it (making of the fgd will be later). I set it there that is TeamOnly is 1 it will not let the Red team through. If it is 2 then it will not let the Blue team through, just replace Red and Blue with what teams you are having. If all is well then it goes on to execute the rest of the code. Now onto the fgd. Make a new file called yourmod.fgd (I would just rename the halflife.fgd file to have all the entities available) and put the lines (I would replace where it says the info for the door entity with the following) @BaseClass base(Appearflags, Targetname, RenderFields, Global) = Door [ killtarget(target_destination) : "KillTarget" speed(integer) : "Speed" : 100 master(string) : "Master" movesnd(choices) : "Move Sound" : 0 = [ 0: "No Sound" 1: "Servo (Sliding)" 2: "Pneumatic (Sliding)" 3: "Pneumatic (Rolling)" 4: "Vacuum" 5: "Power Hydraulic" 6: "Large Rollers" 7: "Track Door" 8: "Snappy Metal Door" 9: "Squeaky 1" 10: "Squeaky 2" ] stopsnd(choices) : "Stop Sound" : 0 = [ 0: "No Sound" 1: "Clang with brake" 2: "Clang reverb" 3: "Ratchet Stop" 4: "Chunk" 5: "Light airbrake" 6: "Metal Slide Stop" 7: "Metal Lock Stop" 8: "Snappy Metal Stop" ] wait(choices) : "Delay before close" : 4 = [ -1 : "Stays open" ] lip(integer) : "Lip" dmg(integer) : "Damage inflicted when blocked" : 0 message(string) : "Message if triggered" target(target_destination) : "Target" delay(integer) : "Delay before fire" netname(string) : "Fire on Close" health(integer) : "Health (shoot open)" : 0 spawnflags(flags) = [ 1 : "Starts Open" : 0 4 : "Don't link" : 0 8: "Passable" : 0 32: "Toggle" : 0 256:"Use Only" : 0 512: "Monsters Can't" : 0 ] locked_sound(choices) : "Locked Sound" : 0 = [ 0: "None" 2: "Access Denied" 8: "Small zap" 10: "Buzz" 11: "Buzz Off" 12: "Latch Locked" ] unlocked_sound(choices) : "Unlocked Sound" : 0 = [ 0: "None" 1: "Big zap & Warmup" 3: "Access Granted" 4: "Quick Combolock" 5: "Power Deadbolt 1" 6: "Power Deadbolt 2" 7: "Plunger" 8: "Small zap" 9: "Keycard Sound" 10: "Buzz" 13: "Latch Unlocked" ] locked_sentence(choices) : "Locked Sentence" : 0 = [ 1: "Gen. Access Denied" 2: "Security Lockout" 3: "Blast Door" 4: "Fire Door" 5: "Chemical Door" 6: "Radiation Door" 7: "Gen. Containment" 8: "Maintenance Door" 9: "Broken Shut Door" ] unlocked_sentence(choices) : "Unlocked Sentence" : 0 = [ 1: "Gen. Access Granted" 2: "Security Disengaged" 3: "Blast Door" 4: "Fire Door" 5: "Chemical Door" 6: "Radiation Door" 7: "Gen. Containment" 8: "Maintenance area" ] TeamDoors(choices) : "Team Specific Door" : 0 = [ 0: "Any team" 1: "Blue Team Only" 2: "Red Team Only" ] _minlight(string) : "Minimum light level" ] That is the normal door part in the fgd with the Team Specific part added. That lets the mapper choose what team can go through it, Blue Team Only will only let the Blue team through, and Red Team Only will only let the Red team through. Just start up WorldCraft make a box or two with a door and set which team can go through, and only that team can go through. Now you can spawn in peace and not get killed right away, definatly a plus. Stay tuned for my next tutorial.

Any questions or suggestions should be sent to me: british@epix.net