Page 1 of 1
(SOLVED) How to force map to automatically change
Posted: Fri Dec 19, 2008 1:27 am
by Broadus
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?
Posted: Fri Dec 19, 2008 3:11 am
by bdbodger
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.
Posted: Fri Dec 19, 2008 4:52 am
by Broadus
Are these scripts I put into the map?
I wrote them like this:
And nothing happened with either of them.
Posted: Fri Dec 19, 2008 4:56 am
by bdbodger
What else did you try did you try
bsptransition(maps/m1l2a)
What thread did you put that in ?
Posted: Fri Dec 19, 2008 5:01 am
by Broadus
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.
Posted: Fri Dec 19, 2008 5:10 am
by bdbodger
In mission m1l2a when they want to go to the next mission they use this line
Code: Select all
exec global/missioncomplete.scr m1l2b 1
global/missioncomplete.scr
Code: 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
of course you can't use that as is . I don't know the difference between bsptransition and leveltransition they seem the same .
Posted: Fri Dec 19, 2008 5:13 am
by Broadus
That line doesn't work in multiplayer.
Posted: Fri Dec 19, 2008 5:19 am
by bdbodger
if you can enter map ??? in the console you should be able to use it in script the same way . Are you useing the Allieswin still ? I would say don't if you are .
Posted: Fri Dec 19, 2008 5:34 am
by Broadus
Unfortunately, trying to use console commands as scripts, as in just typing:
into a thread doesn't work.
Posted: Fri Dec 19, 2008 5:38 am
by bdbodger
I see OK
Posted: Fri Dec 19, 2008 5:45 am
by Broadus
So does anyone have any idea how to solve my problem in the first post?
Posted: Wed Dec 24, 2008 10:51 am
by $oldier Of Ra
Read my last post:
/forum/viewtopic.php?t=13355
Cheers

Posted: Sat Dec 27, 2008 1:51 pm
by Rookie One.pl
I had this method of forcing map changes and restarts by faking a vote. Off the top of my head:
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 loop
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:
Code: Select all
game.allow_vote = getcvar("g_allowVote")
and restore it at the next map's start:
Code: Select all
setcvar "g_allowVote" game.allow_vote
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.

Posted: Sun Dec 28, 2008 6:24 pm
by Broadus
Well, now this problem has been solved in a different topic.
But, a voting system might be good to have in case of emergencies, like all the players get stuck or something... Hopefully I won't have any such emergencies, but I guess they're inevitable.