Garry's Mod

Garry's Mod

CO-OP Gamemode
 Toto téma bylo přilepeno, takže je nejspíš důležité
perfect_buddy  [vývojář] 3. čvc. 2016 v 1.50
FOR MAPPERS
To have your map added to the Coop Gamemode Maps category, just add a "coop_" prefix to your map and also add this gamemode to the "required item/dlc" on the workshop page.

If you choose to make a map for this gamemode and your map is fully compatible with the gamemode, message me and I'll include your map in the "CO-OP Gamemode Workshop Collection".

Make sure that you're using the garrysmod.fgd from your common/garrysmod/bin folder in your hammer configuration, then just follow these instructions:

WHAT IS LUA_RUN
lua_run is an entity in garrysmod.fgd, it allows us to execute lua commands, this is how you can control this gamemode, all of the following commands need to be filled in, and the lua_run entity has to be triggered

WARNING: NEVER USE " IN HAMMER (especially in lua_run code section), YOU CAN'T OPEN THE MAP AFTER YOU CLOSE IT, USE [[ and ]] instead of " and "

FLASHLIGHTS
FlashlightStatus(true)
FlashlightStatus(false)

SPECTATE AFTER DEATH
ForceRealismEnable(true)
ForceRealismEnable(false)

HIGH DAMAGE ZOMBIES AND HEADCRABS
ForceRealisticZombies(true) ForceRealisticZombies(false)
ForceRealisticHeadcrabs(true) ForceRealisticHeadcrabs(false)

DISABLE !BRING COMMAND
ForceBringDisable(true)
ForceBringDisable(false)

HEADCRABS DON'T EXIST
NoHeadcrabs(true)
NoHeadcrabs(false)

START WITH FISTS OR NOTHING
StartWithNothing(true)
StartWithNothing(false) - start with fists (can be replaced by crowbar)

MISSION FAILED
MissionFailed()
To change the fail music (for death too) use the following code:
failmusic = [[path/to/sound.wav]]
When all players die or the MissionFailed() runs, it triggers a mission_failed_entity. Make one in your map if you want certain things to happen after failure (like disable music). You must name it mission_failed_entity and it should be a relay.

DISABLE AUTOMATIC CHECKPOINTS
CheckpointsDisabled(true)
CheckpointsDisabled(false)

MAKING A CHECKPOINT
ActivateCheckpoint(Vector(x,y,z),bool)
(x,y,z are coordinates of the respawn point). Then just trigger it, whenever you want players to respawn there. Replace "bool" with true or false, depending on if you want there to be a respawn sound.

GAME START FUNCTION
customspawn = true/false - set to true if you're using a custom game start function, otherwise it's 256 units from spawn
GameStart() - starts the game manually (stops respawning of dead people/newly joined)

FREEZING/UNFREEZING
AllFrozen(true)
AllFrozen(false)

PLAYER_SPEEDMOD
By default the coop gamemode deletes all player_speedmod entities (to avoid players being too slow because the map counted on them using the default sandbox speed), however it ignores entities called "coopspeed", "coopspeed1", "coopspeed2" and "coopspeed3". If you want to use player_speedmod in your map, just give it one of these names.

CHANGING A LEVEL WITH WEAPON TRANSFER
MapChange([[mapname]])
noweapontransfer true/false - disable weapon transfer on this map if true

FORCE COOP GAMEMODE
if(engine.ActiveGamemode() != [[coopgamemode]]) then RunConsoleCommand([[changelevel]],[[gm_flatgrass]]) end

This changes the map to gm_flatgrass, if the players are not using the gamemode and you need them to.
Naposledy upravil perfect_buddy; 22. pro. 2021 v 10.18
< >
Zobrazeno 16 z 6 komentářů
I use hammer Editor. I can't use custom entities! And lua_run In Hammer Editor Dosen't exist! And how do i upload stuff?
perfect_buddy  [vývojář] 12. srp. 2017 v 11.41 
You need to have garrysmod.fgd imported, google some tutorials.
I know,its imported,but i still can't!
Now i can have it,i was using Half Life 2's hammer.
Perfect ! No problems with all commands :steamthumbsup:
My map feel so Upgrade :steamthis:
Naposledy upravil Mat MARQS; 8. kvě. 2021 v 6.34
Very powerful! This will help mappers a lot:steamthumbsup:
< >
Zobrazeno 16 z 6 komentářů
Na stránku: 1530 50