(SOLVED) How to force map to automatically change
Moderator: Moderators
(SOLVED) How to force map to automatically change
In my co-op mod, all of the players are supposed to be on the same team. When the players beat the level, I call in "teamwin allies" and the Allies win.
The problem is, they won't consider it a successful round unless there was (or is?) a player on the Axis team. So instead of going to the next map, it just restarts the current one.
Is there a way I can force the server to change maps? Like, is there a global script I can edit, or a script I can put into the map that would make it change?
The problem is, they won't consider it a successful round unless there was (or is?) a player on the Axis team. So instead of going to the next map, it just restarts the current one.
Is there a way I can force the server to change maps? Like, is there a global script I can edit, or a script I can put into the map that would make it change?
Last edited by Broadus on Sun Dec 28, 2008 6:25 pm, edited 1 time in total.

Code: Select all
bsptransition( String next_map )
Transitions to the next BSP. Keeps player data, and game data.Code: Select all
map( String map_name )
Starts the specified map.Are these scripts I put into the map?
I wrote them like this:
And nothing happened with either of them.
I wrote them like this:
Code: Select all
bsptransition(m1l2a)Code: Select all
map(m1l2a)
Last edited by Broadus on Fri Dec 19, 2008 4:59 am, edited 2 times in total.

Are you sure bsptransition works? Especially in multiplayer. I'm scripting for online multiplayer.
If I could somehow force a console command in the map script, then I could just use the console command "map ??????". I don't want to make the player, or the host, have to do the console commands manually.
If I could somehow force a console command in the map script, then I could just use the console command "map ??????". I don't want to make the player, or the host, have to do the console commands manually.

In mission m1l2a when they want to go to the next mission they use this line
global/missioncomplete.scr
of course you can't use that as is . I don't know the difference between bsptransition and leveltransition they seem the same .
Code: Select all
exec global/missioncomplete.scr m1l2b 1Code: Select all
main local.nextlevel local.bsp:
if ($player.health <= 0)
pause
$player stopwatch 0
if (local.nextlevel != NIL)
{
if (local.bsp != NIL)
{
game.loadout = false
bsptransition local.nextlevel
}
else
{
game.loadout = NIL
leveltransition local.nextlevel
}
}
end
Last edited by bdbodger on Fri Dec 19, 2008 5:17 am, edited 1 time in total.
Unfortunately, trying to use console commands as scripts, as in just typing:
into a thread doesn't work.
Code: Select all
map m1l2b
-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
Read my last post:
/forum/viewtopic.php?t=13355
Cheers
/forum/viewtopic.php?t=13355
Cheers
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)
For all your bot needs!!!!
$oldier Of Ra.
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:
I had this method of forcing map changes and restarts by faking a vote. Off the top of my head:
Now that this code snippet doesn't take 3 things into account:
1) there might be no players in the server (but, on the other hand, how would they win, then?)
2) I'm not sure how connecting (i.e. map loading) players are seen by the game; anyway, you need a player who's got the map loaded and is in game at least as a spectator to call the vote
3) this overrides the admin's setting of g_allowVote cvar; one way to overcome this would be to save off its value just before faking the vote in a game object variable:
and restore it at the next map's start:
However, you'd need to put that code in every map script. I don't think it's very important, though, I've always considered admins who thought disabling votes would decrease abuse are morons. 
Code: Select all
// allow votes
setcvar "g_allowVote" "1"
// cancel any votes that may be in progress
for (local.i = 1; local.i <= $player.size; local.i++)
$player[local.i] vote no
// use any player to call the map switch vote
$player[1] callvote map "yournextmap"
// force vote passing
for (local.i = 1; local.i <= $player.size; local.i++)
$player[local.i] vote yes
// map change should occur halfway through the above loop1) there might be no players in the server (but, on the other hand, how would they win, then?)
2) I'm not sure how connecting (i.e. map loading) players are seen by the game; anyway, you need a player who's got the map loaded and is in game at least as a spectator to call the vote
3) this overrides the admin's setting of g_allowVote cvar; one way to overcome this would be to save off its value just before faking the vote in a game object variable:
Code: Select all
game.allow_vote = getcvar("g_allowVote")Code: Select all
setcvar "g_allowVote" game.allow_vote

