Rotating weapon help

Have questions about CoD2 mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Rotating weapon help

Post by Rezil » July 12th, 2010, 12:35 pm

You don't change anything in _weapon_pickup.gsc. Just follow the tutorial, you add a line of code to your main function(in this case setupWeaponForPickup("panzerschreck_mp", "xmodel/weapon_panzerschreck", 5);) and include this .gsc by using #include maps\mp\_weapon_pickup; at the very top of your maps main .gsc.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: Rotating weapon help

Post by <LT>YosemiteSam[NL] » July 12th, 2010, 1:03 pm

Thx guys it worked.... but ;
- First time you pick up the weapon you have no ammo
- Second time you get the max amount of ammo... I want it to give only 1 projectile (panzerschreck remember :wink: ).

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Rotating weapon help

Post by Rezil » July 12th, 2010, 1:07 pm

No problem, modify _weapon_pickup.gsc. Add this line under user giveweapon(weapon); :

Code: Select all

user givestartammo(weapon);
I'm not sure whether the panzerschreck has start ammo defined but this is the basic script.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: Rotating weapon help

Post by <LT>YosemiteSam[NL] » July 12th, 2010, 1:26 pm

Panzerschreck doesn't have startammo.
But I changed the panzer file into 1 missile and the max ammo aswell, now it works like a charm.
Again thx :)

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Rotating weapon help

Post by Rezil » July 12th, 2010, 1:33 pm

No prob.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: Rotating weapon help

Post by <LT>YosemiteSam[NL] » July 12th, 2010, 1:35 pm

Can I use this script for 3 different weapons, I mean I want the pick up sounds to be different ?
for the redeemer/damageamp/normal pick up I mean.

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Rotating weapon help

Post by Rezil » July 12th, 2010, 1:45 pm

I can modify the script so you have to input different sounds for picking up the weapon. Do you want the same sound for maxammo and respawning?

Code: Select all

setupWeaponForPickup(weapon_name, weapon_xmodel, soundalias, delay)
{
	precachemodel(weapon_xmodel);
	trig = getentarray("weapon_pickup_" +weapon_name,"targetname");
	org = getentarray("weapon_origin_" +weapon_name,"targetname");
	if(org.size == trig.size) //same ammount of origins and triggers, otherwise you get errors
	{
		for(i=0;i<org.size;i++)
		{
			trig[i] thread WeaponPickup(org[i], weapon_name, weapon_xmodel, soundalias, delay);
			
		}
	}
}

WeaponPickup(o, weapon, xmodel, sound, delay)
{
	while(1)
	{
		o setmodel(xmodel);
		o notsolid(); //already true, just not sure about all script_models
		self waittill("trigger", user);
		c_weap = user getcurrentweapon();
		if(user hasweapon(weapon)) 
		{ //user already has that weapon, so keep the model showing and only max out the ammo
			user givemaxammo(weapon); 
			wait 10; //to prevent unlimited ammo while staying inside the trigger
			o playsound("weapon_maxammo"); 
		}
		else 
		{
			user takeweapon(c_weap);
			user giveweapon(weapon);
			user switchtoweapon(weapon);
			o playsound(sound);
			
			o hide();
			self maps\mp\_utility::TriggerOff();
			
			if(isdefined(delay))
			{
				wait delay;
			}
			
			self maps\mp\_utility::TriggerOn();
			o playsound("weapon_respawned");
			o show();
		}
	}
}
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: Rotating weapon help

Post by <LT>YosemiteSam[NL] » July 12th, 2010, 2:09 pm

Maxammo and spawn are all the same.
But I'm at a loss :?
how does this work, putting the sound here plays the same sound for all weapons .. right ?

Code: Select all

user takeweapon(c_weap);
         user giveweapon(weapon);
         user switchtoweapon(weapon);
         o playsound(sound);

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Rotating weapon help

Post by Rezil » July 12th, 2010, 2:15 pm

No, you add multiple setupWeaponForPickup in your main script for multiple weapons. You have to add multiple triggers and origins for multiple weapons as well. For example if you wanted a luger and an m1garand respawning, you would create a trigger and script_model for the luger and a different trigger and script_model for the garand. Then you just add multiple setupWeaponForPickup in your main script. You don't modify _weapon_pickup.gsc. I did that for your convenience. :P
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: Rotating weapon help

Post by <LT>YosemiteSam[NL] » July 12th, 2010, 2:20 pm

:) Ok I 'll give it a go.....doing so many things at the same time at the moment :?

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: Rotating weapon help

Post by <LT>YosemiteSam[NL] » July 12th, 2010, 3:09 pm

Got it all working, still 10 weapons or so to go :?
But when I pick up the ammo the sound doesn't play (the normal pickup ammo sound I mean)
Any ideas ?

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Rotating weapon help

Post by Rezil » July 12th, 2010, 3:22 pm

That's because everything is scripted. You have to make sounds for picking up, picking up ammo and respawning the weapon(or at least make the soundaliases).
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: Rotating weapon help

Post by <LT>YosemiteSam[NL] » July 12th, 2010, 4:15 pm

Aha ok. I'll try that.

I made 3 weapons respawn and picked up by a trigger multiple but 1 of em (panzeschreck) doesn't work, I get this error;

Oh yeah, is it also possible to let players carry more then 2 weapons ( 15 for instance) ?
You do not have the required permissions to view the files attached to this post.

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Rotating weapon help

Post by Rezil » July 12th, 2010, 4:22 pm

Precache the weapon first, then try again.
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

User avatar
<LT>YosemiteSam[NL]
Core Staff
Core Staff
Posts: 2155
Joined: December 7th, 2004, 2:07 am
Location: Netherlands
Contact:

Re: Rotating weapon help

Post by <LT>YosemiteSam[NL] » July 12th, 2010, 7:17 pm

My main code is like this now ;

Code: Select all

#include maps\mp\_weapon_pickup;
main()
{

maps\mp\_load::main();
ambientPlay("ambient_mp_deck16");
maps\mp\bounce_jump::main();
maps\mp\teleport::main();
maps\mp\poison::main();
maps\mp\elevators::main();
//maps\mp\redeemer_rotate::main();

game["allies"] = "british";
game["axis"] = "german";
game["british_soldiertype"] = "airborne";
game["british_soldiervariation"] = "normal";
game["german_soldiertype"] = "fallschirmjagergrey";
game["german_soldiervariation"] = "normal";
game["attackers"] = "allies";
game["defenders"] = "axis";

setcvar ("g_gravity", 800);
setcvar ("g_speed" , 300);
setcvar ("jump_height" ,55);
setcvar ("bg_fallDamageMinHeight", 100000); 
setcvar ("bg_fallDamageMaxHeight", 200000);
setcvar ("scr_dm_timelimit" , "6");
level thread precache();
setupWeaponForPickup("bren_mp", "xmodel/weapon_bren","weap_pickup", 30);
setupWeaponForPickup("panzerschreck_mp", "xmodel/weapon_panzerschreck","weap_pickup", 10);
setupWeaponForPickup("m1garand_mp", "xmodel/weapon_m1garand","weap_pickup", 10);
}
precache()
{
precachemodel("xmodel/weapon_panzerschreck");
}
but still I get the error, did I precache right ?

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests