z0d
8th December 2012, 13:53
Hello guys,
I edit CoD2 PAM (ePAM actually) and I have 2 problems:
Problem 1.) Well, I don't really know how to describe that problem without giving you an example:
so we have 2 players: player A is in axis team and player B is in allies team.
Round 1. player A has a kar98k and player B has m1, player B kills player A and picks its weapon (kar98k)
Round 2. so now, player B has m1 and kar98k. player A changes its weapon in STRAT TIME (3-4 seconds before round starts for real). So player A who changed its weapon in strat time, kills player B while player B has kar98k as its primary weapon. Player A tries to pickup dropped kar98k and it can't.
So here are some things that I know that works:
A) If player A changed his weapon at the end of 1st round (after player B killed him), he's able to pickup kar98k dropped by player B when its killed - next round (so player A didn't change its weapon in strat time)
B) I made a for loop which does: var = getweaponslotweapon("primary") and sets pers["weapon"] = var. And then it also works, excepts I don't have right weapon next round.
C) When player is killed, in player_killed function pers["weapon1"], pers["weapon2"] and pers["spawnweapon"] sets to undefined. What I did is, changed their values to "none" instead of undefined and it worked. In spawnplayer() function there is if(isdefined(self.pers["weapon1"]) && isdefined(self.pers["weapon2"])) as you may know and it worked (apparently) because it never went in -else- .
I tried several things already:
-copied "weapon_saver" in endround() function
-modifined if(isdefined(self.pers["weapon1"]) && isdefined(self.pers["weapon2"])) to look something like if((isdefined(self.pers["weapon1"]) && isdefined(self.pers["weapon2"])) && (self.pers["weapon1"] != "none" && self.pers["weapon2"]!= "none"))
-added self setspawnweapon in menuweapon() function (put it in if which changes weapon straight away - in strat time)
Problem 2.) Okay, I'll give you another example:
we have 2 players (again). In round 1. player A has a scope and is allies, player B has a mp44 and is axis, player C has a mp44 and is axis as well.
Player A kills player C and switches his scope with mp44. Player B picks up scope dropped by player A.
Next round (no matter who won or was killed), player B who's not a real scoper of axis team now have a scope and it might happen that there are two scopes in team. I want to avoid that and heres what I've did:
real_weapon = self.pers["weapon"];
if (level.weapons[real_weapon].classname == "sniper")
self.sniper_owner = 1;
else
self.sniper_owner = 0;
if(isdefined(self.pers["weapon1"]) && isdefined(self.pers["weapon2"]))
{
weapon1_checker = self.pers["weapon1"];
weapon2_checker = self.pers["weapon2"];
while(!isdefined(level.weapons[weapon1_checker].classname))
wait 0.05;
if (level.weapons[weapon1_checker].classname == "sniper" && level.weapons[weapon2_checker].classname == "sniper")
{
self setWeaponSlotWeapon("primary", self.pers["weapon"]);
self setWeaponSlotAmmo("primary", 999);
self setWeaponSlotClipAmmo("primary", 999);
self setSpawnWeapon(self.pers["weapon"]);
}
else if ((level.weapons[weapon1_checker].classname == "sniper" || level.weapons[weapon2_checker].classname == "sniper") && self.sniper_owner != 1)
{
if (level.weapons[weapon1_checker].classname == "sniper")
self setWeaponSlotWeapon("primary", self.pers["weapon"]);
else
self setWeaponSlotWeapon("primary", self.pers["weapon1"]);
self setWeaponSlotAmmo("primary", 999);
self setWeaponSlotClipAmmo("primary", 999);
if (level.weapons[weapon2_checker].classname == "sniper")
self setWeaponSlotWeapon("primaryb", self.pers["weapon"]);
else
self setWeaponSlotWeapon("primaryb", self.pers["weapon2"]);
self setWeaponSlotAmmo("primaryb", 999);
self setWeaponSlotClipAmmo("primaryb", 999);
self setSpawnWeapon(self.pers["spawnweapon"]);
}
else if ((level.weapons[weapon1_checker].classname == "sniper" || level.weapons[weapon2_checker].classname == "sniper") && self.sniper_owner == 1)
{
if (level.weapons[weapon1_checker].classname == "sniper")
{
if (weapon1_checker == self.pers["weapon"])
{
self setWeaponSlotWeapon("primary", self.pers["weapon1"]);
}
else
{
self setWeaponSlotWeapon("primary", self.pers["weapon"]);
}
}
else
self setWeaponSlotWeapon("primary", self.pers["weapon1"]);
self setWeaponSlotAmmo("primary", 999);
self setWeaponSlotClipAmmo("primary", 999);
if (level.weapons[weapon2_checker].classname == "sniper")
{
if (weapon2_checker == self.pers["weapon"])
{
self setWeaponSlotWeapon("primaryb", self.pers["weapon2"]);
}
else
{
self setWeaponSlotWeapon("primaryb", self.pers["weapon"]);
}
}
else
self setWeaponSlotWeapon("primaryb", self.pers["weapon2"]);
self setWeaponSlotAmmo("primaryb", 999);
self setWeaponSlotClipAmmo("primaryb", 999);
self setSpawnWeapon(self.pers["spawnweapon"]);
}
else
{
self setWeaponSlotWeapon("primary", self.pers["weapon1"]);
self setWeaponSlotAmmo("primary", 999);
self setWeaponSlotClipAmmo("primary", 999);
self setWeaponSlotWeapon("primaryb", self.pers["weapon2"]);
self setWeaponSlotAmmo("primaryb", 999);
self setWeaponSlotClipAmmo("primaryb", 999);
self setSpawnWeapon(self.pers["spawnweapon"]);
}
}
else
{
self setWeaponSlotWeapon("primary", self.pers["weapon"]);
self setWeaponSlotAmmo("primary", 999);
self setWeaponSlotClipAmmo("primary", 999);
self setSpawnWeapon(self.pers["weapon"]);
}
What I get as a error is this:
undefined is not a field object: (file 'maps/pam/sd.gsc', line 760)
else if ((level.weapons[weapon1_checker].classname == "sniper" || level.weapons[weapon2_checker].classname == "sniper") && self.sniper_owner != 1)
*
called from:
(file 'maps/pam/sd.gsc', line 289)
spawnPlayer();
*
called from:
(file 'maps/mp/gametypes/_callbacksetup.gsc', line 38)
[[level.callbackPlayerConnect]]();
*
started from:
(file 'maps/pam/sd.gsc', line 1744)
wait 0; // Required for Callback_PlayerDisconnect to complete before updateTeamStatus can execute
*
************************************
********************
ERROR: script runtime error
(see console for details)
(file 'maps/pam/sd.gsc', line 1744)
********************
level.weapons is an array and here's an example how it looks like
level.weapons = [];
level.weapons["greasegun_mp"] = spawnstruct();
level.weapons["greasegun_mp"].server_allowcvar = "scr_allow_greasegun";
level.weapons["greasegun_mp"].client_allowcvar = "ui_allow_greasegun";
level.weapons["greasegun_mp"].allow_default = 1;
level.weapons["greasegun_mp"].classname = "smg";
level.weapons["greasegun_mp"].team = "allies";
So those are problems I have, I've been trying to find solution for a month now (no success). If there is someone who might know solution, please help me!
Cheers
I edit CoD2 PAM (ePAM actually) and I have 2 problems:
Problem 1.) Well, I don't really know how to describe that problem without giving you an example:
so we have 2 players: player A is in axis team and player B is in allies team.
Round 1. player A has a kar98k and player B has m1, player B kills player A and picks its weapon (kar98k)
Round 2. so now, player B has m1 and kar98k. player A changes its weapon in STRAT TIME (3-4 seconds before round starts for real). So player A who changed its weapon in strat time, kills player B while player B has kar98k as its primary weapon. Player A tries to pickup dropped kar98k and it can't.
So here are some things that I know that works:
A) If player A changed his weapon at the end of 1st round (after player B killed him), he's able to pickup kar98k dropped by player B when its killed - next round (so player A didn't change its weapon in strat time)
B) I made a for loop which does: var = getweaponslotweapon("primary") and sets pers["weapon"] = var. And then it also works, excepts I don't have right weapon next round.
C) When player is killed, in player_killed function pers["weapon1"], pers["weapon2"] and pers["spawnweapon"] sets to undefined. What I did is, changed their values to "none" instead of undefined and it worked. In spawnplayer() function there is if(isdefined(self.pers["weapon1"]) && isdefined(self.pers["weapon2"])) as you may know and it worked (apparently) because it never went in -else- .
I tried several things already:
-copied "weapon_saver" in endround() function
-modifined if(isdefined(self.pers["weapon1"]) && isdefined(self.pers["weapon2"])) to look something like if((isdefined(self.pers["weapon1"]) && isdefined(self.pers["weapon2"])) && (self.pers["weapon1"] != "none" && self.pers["weapon2"]!= "none"))
-added self setspawnweapon in menuweapon() function (put it in if which changes weapon straight away - in strat time)
Problem 2.) Okay, I'll give you another example:
we have 2 players (again). In round 1. player A has a scope and is allies, player B has a mp44 and is axis, player C has a mp44 and is axis as well.
Player A kills player C and switches his scope with mp44. Player B picks up scope dropped by player A.
Next round (no matter who won or was killed), player B who's not a real scoper of axis team now have a scope and it might happen that there are two scopes in team. I want to avoid that and heres what I've did:
real_weapon = self.pers["weapon"];
if (level.weapons[real_weapon].classname == "sniper")
self.sniper_owner = 1;
else
self.sniper_owner = 0;
if(isdefined(self.pers["weapon1"]) && isdefined(self.pers["weapon2"]))
{
weapon1_checker = self.pers["weapon1"];
weapon2_checker = self.pers["weapon2"];
while(!isdefined(level.weapons[weapon1_checker].classname))
wait 0.05;
if (level.weapons[weapon1_checker].classname == "sniper" && level.weapons[weapon2_checker].classname == "sniper")
{
self setWeaponSlotWeapon("primary", self.pers["weapon"]);
self setWeaponSlotAmmo("primary", 999);
self setWeaponSlotClipAmmo("primary", 999);
self setSpawnWeapon(self.pers["weapon"]);
}
else if ((level.weapons[weapon1_checker].classname == "sniper" || level.weapons[weapon2_checker].classname == "sniper") && self.sniper_owner != 1)
{
if (level.weapons[weapon1_checker].classname == "sniper")
self setWeaponSlotWeapon("primary", self.pers["weapon"]);
else
self setWeaponSlotWeapon("primary", self.pers["weapon1"]);
self setWeaponSlotAmmo("primary", 999);
self setWeaponSlotClipAmmo("primary", 999);
if (level.weapons[weapon2_checker].classname == "sniper")
self setWeaponSlotWeapon("primaryb", self.pers["weapon"]);
else
self setWeaponSlotWeapon("primaryb", self.pers["weapon2"]);
self setWeaponSlotAmmo("primaryb", 999);
self setWeaponSlotClipAmmo("primaryb", 999);
self setSpawnWeapon(self.pers["spawnweapon"]);
}
else if ((level.weapons[weapon1_checker].classname == "sniper" || level.weapons[weapon2_checker].classname == "sniper") && self.sniper_owner == 1)
{
if (level.weapons[weapon1_checker].classname == "sniper")
{
if (weapon1_checker == self.pers["weapon"])
{
self setWeaponSlotWeapon("primary", self.pers["weapon1"]);
}
else
{
self setWeaponSlotWeapon("primary", self.pers["weapon"]);
}
}
else
self setWeaponSlotWeapon("primary", self.pers["weapon1"]);
self setWeaponSlotAmmo("primary", 999);
self setWeaponSlotClipAmmo("primary", 999);
if (level.weapons[weapon2_checker].classname == "sniper")
{
if (weapon2_checker == self.pers["weapon"])
{
self setWeaponSlotWeapon("primaryb", self.pers["weapon2"]);
}
else
{
self setWeaponSlotWeapon("primaryb", self.pers["weapon"]);
}
}
else
self setWeaponSlotWeapon("primaryb", self.pers["weapon2"]);
self setWeaponSlotAmmo("primaryb", 999);
self setWeaponSlotClipAmmo("primaryb", 999);
self setSpawnWeapon(self.pers["spawnweapon"]);
}
else
{
self setWeaponSlotWeapon("primary", self.pers["weapon1"]);
self setWeaponSlotAmmo("primary", 999);
self setWeaponSlotClipAmmo("primary", 999);
self setWeaponSlotWeapon("primaryb", self.pers["weapon2"]);
self setWeaponSlotAmmo("primaryb", 999);
self setWeaponSlotClipAmmo("primaryb", 999);
self setSpawnWeapon(self.pers["spawnweapon"]);
}
}
else
{
self setWeaponSlotWeapon("primary", self.pers["weapon"]);
self setWeaponSlotAmmo("primary", 999);
self setWeaponSlotClipAmmo("primary", 999);
self setSpawnWeapon(self.pers["weapon"]);
}
What I get as a error is this:
undefined is not a field object: (file 'maps/pam/sd.gsc', line 760)
else if ((level.weapons[weapon1_checker].classname == "sniper" || level.weapons[weapon2_checker].classname == "sniper") && self.sniper_owner != 1)
*
called from:
(file 'maps/pam/sd.gsc', line 289)
spawnPlayer();
*
called from:
(file 'maps/mp/gametypes/_callbacksetup.gsc', line 38)
[[level.callbackPlayerConnect]]();
*
started from:
(file 'maps/pam/sd.gsc', line 1744)
wait 0; // Required for Callback_PlayerDisconnect to complete before updateTeamStatus can execute
*
************************************
********************
ERROR: script runtime error
(see console for details)
(file 'maps/pam/sd.gsc', line 1744)
********************
level.weapons is an array and here's an example how it looks like
level.weapons = [];
level.weapons["greasegun_mp"] = spawnstruct();
level.weapons["greasegun_mp"].server_allowcvar = "scr_allow_greasegun";
level.weapons["greasegun_mp"].client_allowcvar = "ui_allow_greasegun";
level.weapons["greasegun_mp"].allow_default = 1;
level.weapons["greasegun_mp"].classname = "smg";
level.weapons["greasegun_mp"].team = "allies";
So those are problems I have, I've been trying to find solution for a month now (no success). If there is someone who might know solution, please help me!
Cheers