(SOLVED) Restricting Spectators

Post your scripting questions / solutions here

Moderator: Moderators

Broadus
Captain
Posts: 235
Joined: Mon Jan 30, 2006 5:35 am

Post by Broadus »

Co-op is defined by gameplay, not how you connect to the game.
http://en.wikipedia.org/wiki/Cooperative_gameplay
Just because a quirky way is required to make the co-op doesn't make it less co-op.

The game DOOM had co-op over a LAN, but thanks to a program called ZDaemon, you can play competitive and co-operative modes with players online. This means servers and everything. That doesn't mean that, because it uses a server, it's no longer co-op. It just means it's the same co-op mode but now it's online and you connect to a server.
Image
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Okay m8 I'm convinced! But your co-op mod won't be so easy to realize. Here are a few of the problems that will occur:

- Stopping the campaign from progressing if the mission failed or the mission isn't even completed because Multiplayer has a timelimit.

- Doing the mission failed sequence? The missionfailed screen only works in singleplayer and the save function doesn't work either.

- Keeping the game competative. MoHAA singleplayer at Hard wasn't even challenging. How easy would it be with 2 or more players?

- I assume players can join the axis to reinforce the axis AI? SP commands the $player, which means all its commands get sent to ALL players (in SP no problem, there is only 1 player). So if a command which in Singleplayer is only meant for the allies ('cause it's the only team there is) it will now be sent to all allies, all axis and all spectators and will generate tons of errors and undesired effects.
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.
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

These aren't really obstacles. Timelimit can be switched off, and who cares about the stats? And I don't think you play co-op if you're looking for competitive gameplay, after all, co-op comes from "cooperation". ;) It's easy enough to keep all players on the allied team (see my survival horror mod), and editing the map scripts to take individual players into account is a piece of cake. Well, usually it is. The guys at 2015 had some extremely poor coding practices and as a result, some level scripts are just awfully confusing to read.
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Yeah their scripts are very poorly made. Full of goto commands :?
But in his case it might be a challenge since it seems he never used a for statement to count the players...
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.
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

Co-op... great idea... im working on similiar mod, but with new maps because AA sp's're to small. All teams enabled.

btw 2015 guys aint so bad - MOHAA works (but dont ask why!).
Broadus
Captain
Posts: 235
Joined: Mon Jan 30, 2006 5:35 am

Post by Broadus »

$oldier Of Ra wrote:- Stopping the campaign from progressing if the mission failed or the mission isn't even completed because Multiplayer has a timelimit.
- Doing the mission failed sequence? The missionfailed screen only works in singleplayer and the save function doesn't work either.
Most levels let you go from start to finish and never make it impossible to backtrack (or in the opposite case, impossible to go forward if you were left behind). When that is a problem, I just have to delete the old Allied spawn points and make some new ones ahead of the obstacle. If someone's stuck behind, they just have to change team to spectator, then change back to Allies to get the new spawn point.
Players respawn, so there is generally no need to fail. Also, when failure occurs because the players let something bad happen, I can just set it so the multiplayer Axis team wins.
The problem is, though I could make the level restart upon player failure by making it round-based (at least I hope all the AI and stuff would reset), that means that if they win, they will have to win several more times. I haven't gotten that far yet in my whole design process.
Also, in most co-op games, there is no need for saving. The levels aren't very long in games like Allied Assault and Half-Life. Plus, most players will not get to play the campaign in order, because if they take a break or something, other players will still be playing and get ahead of them.
Time limits are adjustable. There doesn't have to be a time limit, or there can be a time limit so that one particular level doesn't drag on forever.
$oldier Of Ra wrote:- Keeping the game competative. MoHAA singleplayer at Hard wasn't even challenging. How easy would it be with 2 or more players?
All players have 100 health, just like the enemy AI. Both players and AI are carrying the same guns, so everybody, players and AI, do the same amount of damage to eachother and have the same amount of health.
I can give the AI different guns (copies) so they do less damage than the players, but I haven't had to give the players/AI different guns from eachother yet, though I am sure I will have to in the future.
I think a server might be able to change the "skill" setting. Hopefully that will let them adjust the difficulty. There is a forth skill setting, "skill 3", which is more impossibly hard than the other skills.
Also, if it actually is too easy irrelevant of the skill setting, I can easily add in more AI.
Also, I predict that it'd be possible to have a server allow for around eight players, running constantly so players can leave or join at will. This works out pretty well in DOOM and Half-Life online co-op games.
$oldier Of Ra wrote:- I assume players can join the axis to reinforce the axis AI? SP commands the $player, which means all its commands get sent to ALL players (in SP no problem, there is only 1 player). So if a command which in Singleplayer is only meant for the allies ('cause it's the only team there is) it will now be sent to all allies, all axis and all spectators and will generate tons of errors and undesired effects.
Well, it's co-op, so having players join the Axis would be unnecessary. I have tested lots of maps that target the $player, and often what happens is seemingly nothing. Rather than giving errors or something, it just acts like none of the players are $player. I will have to deal with problems like that as they arise.
I had actually thought about letting players be Axis, and figured it might be a neat option to have, but I don't know how to make it so Axis players don't activate triggers that they shouldn't be activating. I would have to make $player statements NOT apply to Axis. That might actually be possible, by changing the scripts (in some levels this would be easy). But there might be triggers built into the maps that I can't change with scripts. I dunno', it is definitely an option I will look into, because it'd be pretty cool.
As it is right now, I just have the Axis players spawn high above the map and fall to their deaths. I don't want co-op players being both Axis and Allies, because the Axis could shoot the Allies when they shouldn't be, AND they look like Germans and all the players are fighting Germans so it'd be weird.


$oldier Of Ra wrote:Yeah their scripts are very poorly made. Full of goto commands :?
But in his case it might be a challenge since it seems he never used a for statement to count the players...
What would I need to use a "for" statement for? I dunno' what that does.
I worked extensively on a single player mod two years ago but I only learned scripting that I actually knew I needed at the time.
Image
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Well you needed the for statement today didn't you :P

Code: Select all

All players have 100 health, just like the enemy AI. Both players and AI are carrying the same guns, so everybody, players and AI, do the same amount of damage to eachother and have the same amount of health.
I can give the AI different guns (copies) so they do less damage than the players, but I haven't had to give the players/AI different guns from eachother yet, though I am sure I will have to in the future.
I think a server might be able to change the "skill" setting. Hopefully that will let them adjust the difficulty. There is a forth skill setting, "skill 3", which is more impossibly hard than the other skills.
Also, if it actually is too easy irrelevant of the skill setting, I can easily add in more AI.
Also, I predict that it'd be possible to have a server allow for around eight players, running constantly so players can leave or join at will. This works out pretty well in DOOM and Half-Life online co-op games. 
Use the weaponcommand command, works for players and bots. But wouldn't lowering AI damage be making it easier?
You cannot set skill settings in MP.

Code: Select all

Well, it's co-op, so having players join the Axis would be unnecessary. I have tested lots of maps that target the $player, and often what happens is seemingly nothing. Rather than giving errors or something, it just acts like none of the players are $player. I will have to deal with problems like that as they arise.
I had actually thought about letting players be Axis, and figured it might be a neat option to have, but I don't know how to make it so Axis players don't activate triggers that they shouldn't be activating. I would have to make $player statements NOT apply to Axis. That might actually be possible, by changing the scripts (in some levels this would be easy). But there might be triggers built into the maps that I can't change with scripts. I dunno', it is definitely an option I will look into, because it'd be pretty cool.
As it is right now, I just have the Axis players spawn high above the map and fall to their deaths. I don't want co-op players being both Axis and Allies, because the Axis could shoot the Allies when they shouldn't be, AND they look like Germans and all the players are fighting Germans so it'd be weird.
That would be a paradox, how can something act like there are no players (all players are in the $player array) when there's a player to witness it? Besides dedicated servers have a fake player when a map starts without any real clients. So that might cause problems if the scripts run when there are no clients around. (The fake player will be in the $player array) Looks like you need a for statement again to make things not target axis players.
All triggers made in the bsp have setthreads in the script, so that should work out well.

And I would like to see the results in action :D

The for statement:
SYNTAX:
for (expression1; evaluation; expression2)

Basically, the expression 1 (expression means local.something = local.anotherthing) gets executed once before the statement begins. The evaluation (like an if statement) gets done before another loop in the for statement starts. Expression2 gets done when the commands between the curly brackets are completed (in other words when 1 loop is done).

The for statement will keep "looping" those commands and applying expression2 until the evaluation turns out false.

So this basically counts the number of players in the $player array (In a nutshell: Array is a collection of variables and you can access each variable by defining it's position eg: $player[2] is the player in the 2nd "box" of the $player array.)

So in english:
for (local.i = 1; local.i <= $player.size; local.i++)
{
$player[local.i] thead something
}

Imagine there are 3 players. You can always access the size of variables in the array. When there are 3 players (= 3 variables) then the size of $player is obviously 3.

The $player array always starts at 1. So the for loop starts and defines local.i as 1. Checks if 1 is smaller or equal than the number of players (which are 3). Evaluation is true so it executes the commands for $player[local.i], local.i being 1. When the command in the brackets are done, it does the 2nd expression which adds + 1 to local.i making it 2. 2 is smaller than the number of players so the commands get executed again. +1 again, evaluation true again so the commands get executed for the 3rd player. Again +1, evaluation is FALSE (4 isn't <= 3) so the loop ends and all commands have been executed on all players.

Hope you understand :) If you want I'll give you a script I made to practise arrays and for statements.
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.
Broadus
Captain
Posts: 235
Joined: Mon Jan 30, 2006 5:35 am

Post by Broadus »

Well you needed the for statement today didn't you
Well, yeah, but you said that you didn't see me using it or something.
Use the weaponcommand command, works for players and bots. But wouldn't lowering AI damage be making it easier?
Use weaponcommand for what? For replacing their guns? I already know how to do that, if that's what you mean.
Also I have no idea how to lower AI damage. Every weapon has its own damage and I assume that's what the AI use.
You cannot set skill settings in MP.
Yeah you can, I just did. I typed "skill 3" and it said it would change when I restarted the level, so I did and typed in "skill" and it said "skill = 3", though I noticed no difference between skill 0 and skill 3 anyway so it's pretty irrelevant.
That would be a paradox, how can something act like there are no players (all players are in the $player array) when there's a player to witness it?
If there's more than one player, I had a history of targeting problems, but that was months ago when I was playing around with the idea of co-op and I don't really remember what happened. I haven't had any $player problems yet, though.
Image
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

Broadus wrote: Yeah you can, I just did. I typed "skill 3" and it said it would change when I restarted the level, so I did and typed in "skill" and it said "skill = 3", though I noticed no difference between skill 0 and skill 3 anyway so it's pretty irrelevant.
You can use it to set variables in game, for eg:

Code: Select all

	local.skill = getcvar (skill)
	println "z:       local.skill = getcvar (skill) = " local.skill   

	if (local.skill == "2")
		self.health = level.playerTankHealth_Hard
	if (local.skill == "1")
		self.health = level.playerTankHealth_Medium 
	if ( (local.skill != "1") && (local.skill != "2") )
		self.health = level.playerTankHealth_Easy
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Use weaponcommand to raise/lower the damage AI do with their weapons. Making new weapon tiks is just a waste of time. (with this command you can even do it individually, make one bot's weapon do massive damage etc)

It changes the cvar but since you aren't playing singleplayer where the bots react to the cvar setting, nothing happens... which is what I meant.
though I noticed no difference between skill 0 and skill 3 anyway so it's pretty irrelevant.
Like you said right here, there's no difference, so it doesn't work.[/quote]
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.
Broadus
Captain
Posts: 235
Joined: Mon Jan 30, 2006 5:35 am

Post by Broadus »

But my point was I could set the skill.

Also, how does weaponcommand work? You just type $german weaponcommand 2 or what? I'm looking at the use of weaponcommand in stock files and it's like "weaponcommand mainhand" and it's meant for animations.
Image
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Well of course, cvars are global, you can set them anywhere, at any time. But that doesn't mean they'll work when you do.
weaponcommand ( String hand, [String arg1], [String arg2], [String arg3], [String arg4], [String arg5], [String arg6], [String arg7] )

Pass the args to the active weapon in the specified hand
In your case, you are looking for something like this:

Code: Select all

<actor_alias> weaponcommand dual dmbulletdamage 30

It changes the bullet damage of the weapon(s) (in this case in both hands) for the remainder of the Actor's or Player's current life.
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.
User avatar
Gold
First Lieutenant
Posts: 176
Joined: Sun Sep 28, 2003 8:10 pm

Post by Gold »

wasn't Team Assault a aa coop mod?
Broadus
Captain
Posts: 235
Joined: Mon Jan 30, 2006 5:35 am

Post by Broadus »

Gold wrote:wasn't Team Assault a aa coop mod?
Was it the entire original campaign?
Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

As far as I can remember Team Assault was the working title for Spearhead, and then there was a co-op mod for Spearhead that was named like that. Of all the AA campaign maps I only recall a co-op version of m3l1a (Omaha landing).
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Post Reply