(SOLVED) Restricting Spectators
Moderator: Moderators
(SOLVED) Restricting Spectators
I am working on a co-op mod, and I don't have to do much to make it work, but I have problems anyway. Just one, so far, that is really, really important.
The AI target spectators. So a spectator flies around, and the AI take shots at him, even though, being a spectator, he can't be hit.
It's not just that, but the spectators trigger events that only players should trigger. When the player walks through an invisible wall, it triggers something to happen in the level. A spectator can do the same thing: He can just float through that invisible wall and trigger something to happen. So a spectator could fly through the whole level and trigger things he shouldn't be able to.
Is there a way to make it so spectators can only spectate players? Or, make it so the spectators can't move at all?
The AI target spectators. So a spectator flies around, and the AI take shots at him, even though, being a spectator, he can't be hit.
It's not just that, but the spectators trigger events that only players should trigger. When the player walks through an invisible wall, it triggers something to happen in the level. A spectator can do the same thing: He can just float through that invisible wall and trigger something to happen. So a spectator could fly through the whole level and trigger things he shouldn't be able to.
Is there a way to make it so spectators can only spectate players? Or, make it so the spectators can't move at all?
Last edited by Broadus on Thu Dec 18, 2008 12:05 pm, edited 1 time in total.
Code: Select all
$santa threatbias ignoremeTo turn it off:
Code: Select all
$santa threatbias 50000I put "??????" to represent the fact that I don't know what a spectator is called. The player is called $player, an enemy AI might be called $nazi, but what's the spectator called?
Also, knowing how to prevent the spectators from moving is a lot more important than making the AI ignore them. If they can't move, chances are the AI can't even see them. How do I prevent the spectators from moving?
Like, literally, exactly, how? What scripts do I use?
Also, knowing how to prevent the spectators from moving is a lot more important than making the AI ignore them. If they can't move, chances are the AI can't even see them. How do I prevent the spectators from moving?
Like, literally, exactly, how? What scripts do I use?

Code: Select all
for (local.p=1;local.p<=$player.size;local.p++)
{
local.player = $player[local.p]
if (local.player.dmteam == "spectator")
{
local.player thread lock
}
}
end
lock:
while (self.dmteam == "spectator")
{
waitframe
self.origin = ( 0 0 0 )
waitframe
}-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
There is a perfectly working and fun co-op mod(s) out there by jcb:
http://www.discoverthat.co.uk/games/mohaamods.htm
And threatbias works for AI and Players
'cause it is a command of the Sentient class.
Use <player_alias> threatbias ignoreme
AI will see a spectator if it comes into their screen (even though you're invisible) and if you got any dogs and the spectator was an enemy of those dogs (eg: if dogs are german and player was allied/american or vice versa) then they will sniff out the spectator
Spectators weren't meant to be in SP.
http://www.discoverthat.co.uk/games/mohaamods.htm
And threatbias works for AI and Players
Use <player_alias> threatbias ignoreme
AI will see a spectator if it comes into their screen (even though you're invisible) and if you got any dogs and the spectator was an enemy of those dogs (eg: if dogs are german and player was allied/american or vice versa) then they will sniff out the spectator
Spectators weren't meant to be in SP.
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.
Uh, that's all fine and good, but those are co-op maps, not a co-op mod. I am making co-op for the original campaign and it won't require any custom files to be downloaded, so people can join a server without downloading anything.$oldier Of Ra wrote:There is a perfectly working and fun co-op mod(s) out there by jcb:
http://www.discoverthat.co.uk/games/mohaamods.htm
I already talked about this to aprop, I already know how threatbias works. I don't know how to do it for spectators because spectators aren't called "<player_alias>" or anything conveniently named like that.$oldier Of Ra wrote:And threatbias works for AI and Players'cause it is a command of the Sentient class.
Use <player_alias> threatbias ignoreme
Yeah, that's why I'm trying to fix the spectator problems with this thread.$oldier Of Ra wrote:AI will see a spectator if it comes into their screen (even though you're invisible) and if you got any dogs and the spectator was an enemy of those dogs (eg: if dogs are german and player was allied/american or vice versa) then they will sniff out the spectator
Spectators weren't meant to be in SP.

-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
No... that would be a SP-to-MP map with the SP stuff still in it. Nothing Co-Op about it.Uh, that's all fine and good, but those are co-op maps, not a co-op mod. I am making co-op for the original campaign and it won't require any custom files to be downloaded, so people can join a server without downloading anything.
HuhI don't know how to do it for spectators because spectators aren't called "<player_alias>" or anything conveniently named like that.
Code: Select all
fix_spec:
while(1)
{
for (local.i = 1; local.i <= $player.size; local.i++)
{
if ($player[local.i].dmteam == "spectator")
{
$player[local.i] threatbias ignoreme
}
else
{
$player[local.i] threatbias 5000 //or something like that
}
}
wait 0.5
}
endI hope it helps.
Last edited by $oldier Of Ra on Thu Dec 18, 2008 11:15 am, edited 3 times in total.
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.
Thanks! That looks pretty good, but I can't quite get it to work.Aprop wrote:This should work, waitframe protect script from infinite loop and cpu usageCode: Select all
for (local.p=1;local.p<=$player.size;local.p++) { local.player = $player[local.p] if (local.player.dmteam == "spectator") { local.player thread lock } } end lock: while (self.dmteam == "spectator") { waitframe self.origin = ( 0 0 0 ) waitframe }
I also tried some foolproof variations on it to make sure. Any player that isn't an Axis has a threatbias of ignoreme.
Code: Select all
speclocker:
for (local.p=1;local.p<=$player.size;local.p++)
{
local.player = $player[local.p]
if (local.player.dmteam != "axis")
{
local.player thread lock
}
}
end
lock:
while (self.dmteam != "axis")
{
waitframe
self threatbias ignoreme
waitframe
}
end
-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
That's because your "thread speclocker" probably isn't activated after level waittill spawn in the main thread of the mapscript. Or another problem in any case: The for statement only runs 1 time, so if it has run and you didn't join allies/spectator by the time it does, you didn't get threaded to the lock thread.
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.
What??? Dude, that is the very definition of co-op: A bunch of players on the same team going through the campaign together, fighting AI and completing objectives. That's co-op. That's why when you go to co-op for games like Halo 3, it's the original campaign with more players in it.$oldier Of Ra wrote:No... that would be a SP-to-MP map with the SP stuff still in it. Nothing Co-Op about it.Uh, that's all fine and good, but those are co-op maps, not a co-op mod. I am making co-op for the original campaign and it won't require any custom files to be downloaded, so people can join a server without downloading anything.
Actually, I had no idea how to find players. But thanks to your code, I do! Thanks a lot!$oldier Of Ra wrote:HuhI don't know how to do it for spectators because spectators aren't called "<player_alias>" or anything conveniently named like that.?? Yes they are just as convenient to find as that:
...
I assumed you know how to find players how else could you make a co-op mod?
I hope it helps.
Thanks to both of you, I now have the spectators frozen in place, AND they are completely ignored by AI! It worked out perfectly. Problem solved!
Now that I can locate players through script it will probably be really useful in the future.
Last edited by Broadus on Thu Dec 18, 2008 11:35 am, edited 1 time in total.

-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
Co-Op is playing singleplayer (= clientside) with more than 1 person.
Anyways, glad we could help and give us the IP when it's done; I want to check it out
Anyways, glad we could help and give us the IP when it's done; I want to check it out
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.
No it's not. Those co-op levels you linked are just multiplayer with AI, like my mod. Sven Co-op, a mod for Half-Life 1, is multiplayer in the original campaign. They just take the deathmatch mode and make it so players can't hurt eachother. Synergy, a mod for Half-Life 2, does the same thing with the Half-Life 2 single player campaign. It's just Half-Life 2 Deathmatch set in the campaign. That's how co-op always works. Because you can already load the monsters into the deathmatch, it makes it possible.$oldier Of Ra wrote:Co-Op is playing singleplayer (= clientside) with more than 1 person.
Anyways, glad we could help and give us the IP when it's done; I want to check it out
In a game like Call of Duty, they make it impossible by separating the multiplayer and the single player. You would have to own the source code of the Call of Duty games to put co-op into them. That's why playing co-op on Call of Duty 5 requires you to go to the single player part of the game, instead of the multiplayer part. The single player part loads all the single player stuff and the multiplayer part doesn't.
In Allied Assault, Half-Life 1 and Half-Life 2, the modes are practically put together. You can put stuff from the single player, like AI, into the multiplayer modes of those games, which is what makes co-op mods possible. If they were like Call of Duty, it'd be impossible.
Last edited by Broadus on Thu Dec 18, 2008 11:49 am, edited 1 time in total.

-
$oldier Of Ra
- Lieutenant Colonel
- Posts: 404
- Joined: Sun Oct 16, 2005 7:16 pm
- Location: Belgium
- Contact:
Ah, but those are mods, not put in the game.
In a handful of games (moh is one of them) you can connect to clientside games. Valve does not allow this because Valve&steam wants everyone to play online so these mods can only be done serverside. In any game with stock co-op support, the co-op is always "clientside". (It's basically the same as LAN)
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.