Tue Feb 08, 2022 10:07 am
override void Tick()
{
if (!player || !player.mo || player.mo != self)
{
Super.Tick();
return;
}
int timer;
int cooldown;
if(CheckInventory("ArgentRifle_Cooldown",1)) { cooldown = 18; }
else { cooldown = 24; }
if(CountInv("ArgentRifleHeat") > 0 &&
(timer % cooldown) == 0 &&
player.mo.ReadyWeapon != "SGDArgentRifle") // <<< Latest attempt, resulted in error.
{
TakeInventory("ArgentRifleHeat",1);
}
timer++;
}
Tue Feb 08, 2022 10:20 am
Tue Feb 08, 2022 10:46 am
7Soul wrote:I think players[consoleplayer].ReadyWeapon is how you do it. (consoleplayer is a global variable)
Tue Feb 08, 2022 11:27 am
self.Player.ReadyWeapon;
if(CountInv("ArgentRifleHeat") > 0 &&
(timer % cooldown) == 0 &&
player.ReadyWeapon != "SGDArgentRifle")
Tue Feb 08, 2022 11:34 am
Virathas wrote:ReadyWeapon is not a property of PlayerPawn. It is the property of PlayerInfo.
To access it simply use
- Code:
self.Player.ReadyWeapon;
self probably could be omitted, so in your "if" case:
- Code:
if(CountInv("ArgentRifleHeat") > 0 &&
(timer % cooldown) == 0 &&
player.ReadyWeapon != "SGDArgentRifle")
Tue Feb 08, 2022 11:42 am
self.Player.ReadyWeapon.getClassName() != "SGDArgentRifle"
Tue Feb 08, 2022 11:53 am
7Soul wrote:Try
- Code:
self.Player.ReadyWeapon.getClassName() != "SGDArgentRifle"
Tue Feb 08, 2022 1:33 pm
Tue Feb 08, 2022 2:44 pm
7Soul wrote:Try
- Code:
self.Player.ReadyWeapon.getClassName() != "SGDArgentRifle"
Wed Feb 09, 2022 8:44 am
Virathas wrote:I need to ask however, why do you need this interaction inside "playerpawn" instead of the weapon itself?
override void Tick()
{
if (!player || !player.mo || player.mo != self)
{
Super.Tick();
return;
}
super.Tick();
//int timer;
int cooldown;
if(CheckInventory("ArgentRifle_Cooldown",1)) { cooldown = 18; }
else { cooldown = 24; }
if(CountInv("ArgentRifleHeat") > 0 &&
level.maptime % cooldown == 0 &&
self.player.ReadyWeapon.GetClassName() != "SGDArgentRifle")
{
TakeInventory("ArgentRifleHeat",1);
}
}