Only two guys with bazooka each team in my server maps

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
Pollo_Expresss
Sergeant
Posts: 60
Joined: Thu Jan 08, 2004 12:18 am
Location: Spain

Only two guys with bazooka each team in my server maps

Post by Pollo_Expresss »

I tried to find something about that with the search engine but don?t find anything (probably don?t use the correct words, don?t know).

I don?t like when in game are a lot of people with bazookas cause it lags and it isn?t fun play that way, but I know that one or two bazookas in each team isn?t dangerous.

I?m a newbie mapper but in scripting I don?t know nothing. The only experiments I made were to modify the parameters on .tik files of the bazooka and put the realismdmstartammo to 0 . Well I thought that probably I have to modify the precache.scr but not sure.

Can I have only two players allowed to carry the bazooka on my maps?
And if I can, What file have I to modify?
And how?

I hope someone could help me. Thanks.
Callous1
Lance Corporal
Posts: 12
Joined: Mon Jan 12, 2004 11:15 pm

Post by Callous1 »

I'm not sure if you could prevent everyone but 2 from using. To eliminate all together use a no rockets weapon mod.

What I did was open pak6.pk3 and make a copy the models/weapons panzerschreck.tik and bazooka.tik. Edit them with notepad so that the player can only run at 40 percent speed (unless holstered) which makes it a less desirable choice of weapon. The line you'd change is dmmovementspeed then make your own pk3 and drop in MOHAA/main folder.
User avatar
Pollo_Expresss
Sergeant
Posts: 60
Joined: Thu Jan 08, 2004 12:18 am
Location: Spain

Thank you

Post by Pollo_Expresss »

Well I checked it before and I also checked the dmrealism startammo line and write "0" because then anybody that takes the bazooka can?t shoot. He haven?t ammo.

But the thing I interested is to allow only two users to take the bazooka simultaneously but with the complet working bazooka.

I think it?s possible I can?t get what I want but if someone knows something about it I?ll be very grateful
User avatar
Pollo_Expresss
Sergeant
Posts: 60
Joined: Thu Jan 08, 2004 12:18 am
Location: Spain

snif

Post by Pollo_Expresss »

Well I guess it is not possible to get what I want.

Only repeat it because of it?s possible someone who knows how have I to do it don?t readed this yet.

I only want to limitate the number of players that can carry the bazooka on my server and I don?t find nothing on the tiki files or in the precache.scr . Well I hope someone knows something about it or just someone who tell me that this is impossible and then I leave it how it is now.

Thank you again
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

I think its possible to remove a players weapon... and because of this it SHOULD also be possible to remove it and replace it with some default weapon (like an SMG)...

But you will have to scan the $player array continuously to ensure that the weapon balance is correct...
Admin .MAP Forums
Image
Head above heels.
User avatar
Pollo_Expresss
Sergeant
Posts: 60
Joined: Thu Jan 08, 2004 12:18 am
Location: Spain

Post by Pollo_Expresss »

Waaaoow, don?t understand anything hehehe, I?m not very sure of what is an array but guess you are talking about scripting, Have I to modify the script of my maps to get what I want then? And if you can show me a little stuff of how to do it hehe. Sorry but I?m a noob and don?t understand very well the scripting language. Well I though that probably I can make the rocket option not appear in the selecting weapon menu when one guy for team (or two for team) have selected it.

Thank you for your help and I hope you can give me some more advices please. heheh
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

I suggest you learn the scripting language first then. Because this is not an easy project to start off with.

Here is the Script tutorial: /t.php?id=82
Admin .MAP Forums
Image
Head above heels.
User avatar
Pollo_Expresss
Sergeant
Posts: 60
Joined: Thu Jan 08, 2004 12:18 am
Location: Spain

Thank you very much again

Post by Pollo_Expresss »

I will do it and then I will come back again hehehe.
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Thats the spirit :) Good luck!
Admin .MAP Forums
Image
Head above heels.
User avatar
Pollo_Expresss
Sergeant
Posts: 60
Joined: Thu Jan 08, 2004 12:18 am
Location: Spain

experimented scripter job

Post by Pollo_Expresss »

Well I readed (and payed a lot of atention on it) all your scripting tutorial and now I understand a little bit more what you mean, but I think that I?m not as experimented on scripting as I need to get what I want.

My only scripting experience is based on copy paste working and even when I mostly understand what I paste I don?t feel prepared to build my self complex scripts. Then if someone have some done script that could help me or want to tell me where can I found some useful stuff I would be very grateful. And thanks again Bjarne your tutorial is very simplyfiing and understendable for a noob like me hehhe.

Keep on learning and don?t stop trying.
omniscient
Major General
Posts: 694
Joined: Tue Sep 16, 2003 12:02 am

Post by omniscient »

i like this question. try adn if statement
if(bazookas < 2){
$player take all
$player give (weapons u want)
end
}
this aint all of it but u might wnna build off it.
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

Code: Select all

player_rocket_scanner:
	while (true)
	{
		level.allies_with_rocket = 0
		level.axis_with_rocket  = 0
		for(local.i = 1; local.i <= $player.size; local.i++)
		{
			if( /* some code to test if rocket using $player[local.i] */ )
				if($player[local.i].dmteam == allies)
				{
					level.allies_with_rocket++
					if(level.allies_with_rocket > 1) {
						// call the code in the post above
					}
				}
				else
				{
					if($player[local.i].dmteam == allies)
					{
						level.axis_with_rocket++
						if(level.axis_with_rocket > 1) {
							// call the code in the post above
						}
					}
				}
			waitframe
		}
		wait 1
	}
end
Admin .MAP Forums
Image
Head above heels.
User avatar
Pollo_Expresss
Sergeant
Posts: 60
Joined: Thu Jan 08, 2004 12:18 am
Location: Spain

Post by Pollo_Expresss »

With this code on my notepad and the scripting tutorial page on the oder window I have several things of this code clear. But If I don?t disturb very much, what is $player.size? and is the local.i the statement that defines the bazookas or.......?

Well I think also that this is the thread and I have to call it from the main script of the level.
User avatar
Pollo_Expresss
Sergeant
Posts: 60
Joined: Thu Jan 08, 2004 12:18 am
Location: Spain

Post by Pollo_Expresss »

And is this what you mean with the line: //* call the code in the post above ?






player_rocket_scanner:
while (true)
{
level.allies_with_rocket = 0
level.axis_with_rocket = 0
for(local.i = 1; local.i <= $player.size; local.i++)
{
if( /* some code to test if rocket using $player[local.i] */ )
if($player[local.i].dmteam == allies)
{
level.allies_with_rocket++
if(level.allies_with_rocket > 1) {
// call the code in the post above
{
$player take all
$player give (weapons u want)
end
}

}
}
else
{
if($player[local.i].dmteam == allies)
{
level.axis_with_rocket++
if(level.axis_with_rocket > 1) {
// call the code in the post above
{
$player take all
$player give (weapons u want)
end
}
}
}
}
waitframe
}
wait 1
}
end
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

No, not really.... that code was terrible :)
I suggest you use indentation with tabs so you can see that you have matching {:s and }:s. And there were also some end command s too mutch. Here:

(just an untested suggestion)

Code: Select all

player_rocket_scanner:
	while (true)
	{
		level.allies_with_rocket = 0
		level.axis_with_rocket = 0
		for(local.i = 1; local.i <= $player.size; local.i++)
		{
			if( /* some code to test if rocket using $player[local.i] */ )
				if($player[local.i].dmteam == allies)
				{
					level.allies_with_rocket++
					if(level.allies_with_rocket > 1)
					{
						thread replace_rocket $player
					}
				}
			}
			else
			{
				if($player[local.i].dmteam == allies)
				{
					level.axis_with_rocket++
				if(level.axis_with_rocket > 1)
				{
					$player take all
					thread replace_rocket $player
				}
			}
			waitframe
		}
		wait 1
	}
end

replace_rocket local.player_with_rocket:
	local.player_with_rocket take all
	// don't know the correct strings below
	local.player_with_rocket giveweapon "KEYWORD_FOR_AN_SMG"
	local.player_with_rocket give "KEYWORD_SMG_AMMO"
	local.player_with_rocket give "KEYWORD_BINOCULARS"
end
Admin .MAP Forums
Image
Head above heels.
Post Reply