Re: Rotating weapon help
Posted: July 10th, 2010, 7:01 pm
My guess is that you have chosen to use "trigger_once" in the mapping?
CoDJumper.com - For all your CoDJumping needs!
https://www.codjumper.com/forums/
Maybe that is the case, dunno.Drofder2004 wrote:In that case, the weapon is deleting itself once picked up, I would assume.
Right, but what's the new weapon that has been dropped called now?Drofder2004 wrote:In that case, the weapon is deleting itself once picked up, I would assume.
Not sure what you mean, the error is because we are referencing "self" which is deleted after the trigger?Rezil wrote:Right, but what's the new weapon that has been dropped called now?Drofder2004 wrote:In that case, the weapon is deleting itself once picked up, I would assume.
Whoever has the code?Rezil wrote:Me? Sam?
Code: Select all
main()
{
WeaponRespawner("redeemer", 10);
}
WeaponRespawner(targetname, defaultrespawndelay)
{
weapons = getentarray("redeemer", "targetname");
if(weapons.size > 0)
{
for(i=0; i < weapons.size; i++)
{
if(!isdefined(weapons[i].script_timescale))
weapons[i].script_timescale = defaultrespawndelay;
weapons[i] thread weapon_think(weapons[i].script_timescale);
}
}
}
weapon_think(delaytime)
{
classname = self.classname;
model = self.model;
count = self.count;
org = self.origin;
angles = self.angles;
targetname = self.targetname;
flags = self.spawnflags;
self waittill("trigger");
wait delaytime;
weapon = spawn(classname, org, flags);
weapon.angles = angles;
weapon.count = count;
weapon setmodel(model);
weapon.script_timescale = delaytime;
weapon.targetname = targetname;
weapon playsound("spawnsound");
weapon thread weapon_think(delaytime);
}
Ingame code, probably hard-coded from cod1 since I didn't find any reference to weapons and picking them up in any .gsc.Is the weapon dropped automatically by ingame code or you handling it by "removing" the weapon form the player and placing it manually on the floor?
Thx alot guys... going to experiment with that for a bit. I have no clue on what it lookslike ingame but I soon will.Rezil wrote:Done, see here.
Code: Select all
******* script compile error *******
bad syntax: (file 'maps/mp/_weapon_pickup.gsc', line 33)
setupWeaponForPickup("panzerschreck_mp", "xmodel/weapon_panzerschreck", 5);
*
Code: Select all
*/
setupWeaponForPickup("panzerschreck_mp", "xmodel/weapon_panzerschreck", 5);
{
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, delay);
}
}
}
WeaponPickup(o, weapon, xmodel, 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("weapon_pickup");
o hide();
self maps\mp\_utility::TriggerOff();
if(isdefined(delay))
{
wait delay;
}
self maps\mp\_utility::TriggerOn();
o playsound("spawnsound");
o show();
}
}
}