Triggering a Level change through touching a trigger.
4 replies, posted
Hey,
I'm currently building a gamemode based around playing scary maps, and wondered how I would activate a map change when 3 different players touch the "Trigger_changelevel" entity, Heres my current code.
[CODE]
ENT.Type = "point"
ENT.Base = "base_point"
function ENT:KeyValue(key, value)
if ( key == "map" ) then
GAMEMODE.NextMap = value
print("=[Ghost Hunters]==[1.0]==[Made by Wigleg]========")
print("Level Change detected! Starting automatic change!")
print("Next map set to "..GAMEMODE.NextMap.." by default")
print("=================================================")
end
end
[/CODE]
I'm currently trying to store the Map Value in a Variable to use else where, All I need to do is make it so when the user touches a "Trigger_changelevel" entity, it waits for 3 more users to touch it before it triggers a console
command telling the server to change to the next map.
I hope you can help me! :C
Use a trigger entity in hammer, make its output fire a lua_run entity which calls GAMEMODE:ChangeMap()
[PHP]count = 0;
function GM:ChangeMap()
count++;
if(count==4) then
// change map / print code here
end
end[/PHP]
[QUOTE=AngryChairR;41148244]Use a trigger entity in hammer, make its output fire a lua_run entity which calls GAMEMODE:ChangeMap()
[PHP]count = 0;
function GM:ChangeMap()
count++;
if(count==4) then
// change map / print code here
end
end[/PHP][/QUOTE]
Thanks, But how would I do this for "Normal" unedited maps, Like Nightmarehouse1, which has a changelevel trigger but it does not work in garrysmod, is there anyway to grab the value of the map then change it once 5 users hit the trigger?
[QUOTE=Wigleg;41150279]Thanks, But how would I do this for "Normal" unedited maps, Like Nightmarehouse1, which has a changelevel trigger but it does not work in garrysmod, is there anyway to grab the value of the map then change it once 5 users hit the trigger?[/QUOTE]
For maps you can't edit you could maybe use ents.FindInSphere.
Would require a Think hook though...
You can override default entity by naming yours same as the one you wish to override.
Sorry, you need to Log In to post a reply to this thread.