![]() |
![]() |
|
#41
|
|||
|
|||
|
Right now i've probably tested this, it's not going how I wanted it to go...For some reason it still will give players health even when the level is above 4 (5 and above).
Code:
class RegenMut extends Mutator;
function PostBeginPlay()
{
SetTimer(1, true);
}
function Timer()
{
local KFHumanPawn Player;
local KFPlayerReplicationInfo KFPRI;
if (KFPRI.ClientVeteranSkillLevel <=4)
foreach DynamicActors(class 'KFHumanPawn', Player)
{
if (Player.Health + 2 <= Player.HealthMax)
(Player).Health += 2;
else
Player.Health = Player.HealthMax;
}
else return;
}
defaultproperties
{
GroupName="KFRegenMutator"
FriendlyName="KF Health Regeneration"
Description="Mutator that regenerates health depending on perk level."
}
|
|
#42
|
|||
|
|||
|
Quote:
Code:
KFPRI = KFPlayerReplicationInfo(Player.PlayerReplicationInfo);
__________________
|
|
#43
|
|||
|
|||
|
Sorry as you can tell im rather new to this all.
Code:
class RegenMut extends Mutator;
function PostBeginPlay()
{
SetTimer(1, true);
}
function Timer()
{
local KFHumanPawn Player;
local KFPlayerReplicationInfo KFPRI;
foreach DynamicActors(class 'KFHumanPawn', Player)
{
KFPRI = KFPlayerReplicationInfo(Player.PlayerReplicationInfo);
if (Player.Health + 2 <= Player.HealthMax && KFPRI.ClientVeteranSkillLevel <=4)
Player.Health += 2;
else
Player.Health = Player.HealthMax;
}
}
defaultproperties
{
GroupName="KFRegenMutator"
FriendlyName="KF Health Regeneration"
Description="Mutator that regenerates health depending on perk level."
}
|
|
#44
|
|||
|
|||
|
You need a seperate IF statement which first determines the level of the player, like this:
Code:
class RegenMut extends Mutator;
function PostBeginPlay()
{
SetTimer(1, true);
}
function Timer()
{
local KFHumanPawn Player;
local KFPlayerReplicationInfo KFPRI;
foreach DynamicActors(class 'KFHumanPawn', Player)
{
KFPRI = KFPlayerReplicationInfo(Player.PlayerReplicationInfo);
if (KFPRI.ClientVeteranSkillLevel <= 4)
{
if (Player.Health + 2 <= Player.HealthMax)
Player.Health += 2;
else
Player.Health = Player.HealthMax;
}
}
}
defaultproperties
{
GroupName="KFRegenMutator"
FriendlyName="KF Health Regeneration"
Description="Mutator that regenerates health depending on perk level."
}
__________________
|
|
#45
|
|||
|
|||
|
Thanks a lot, works perfectly. Would be better if I spaced my code out more.
|
|
#46
|
|||
|
|||
|
Quote:
__________________
|
|
#47
|
|||
|
|||
|
Right im trying to make a ammo mutator that gives you an ammo box every 5 minutes BUT i've come to a halt due to an error.
Code:
class AmmoMut extends Mutator;
function PostBeginPlay()
{
SetTimer(300, true);
}
function Timer()
{
local Pawn P;
{
P.GiveWeapon("KFMod.KFAmmoPickup");
Pawn.ClientMessage ("You have been given an ammo box!");
Log("Ammo Given!");
return;
}
}
defaultproperties
{
GroupName="KFAmmoMutator"
FriendlyName="KF Timed Ammo Giver Mutator"
Description="Mutator after every 5 minutes, gives you an ammo box."
}
Code:
{13} : Error, '{': Bad command or expression
|
|
#48
|
|||
|
|||
|
Quote:
Last edited by Trololololololololololo; 05-24-2011 at 02:09 PM. |
|
#49
|
||||
|
||||
|
What are you doing in that timer?
PHP Code:
Also giving ammo boxes is kind of band. Rather get a weapons MagCapacity and increase its ammo by that. Edit: And I just now actually read the code and noticed that this will not work at all. I hope you know what's missing though :>
__________________
Quote:
Last edited by Excalibolg; 05-24-2011 at 03:10 PM. |
|
#50
|
|||
|
|||
|
Change it to:
Code:
class AmmoMut extends Mutator;
function PostBeginPlay()
{
SetTimer(300, true);
}
function Timer()
{
local Pawn P;
P.GiveWeapon("KFMod.KFAmmoPickup");
P.ClientMessage ("You have been given an ammo box!");
Log("Ammo Given!");
return;
}
defaultproperties
{
GroupName="KFAmmoMutator"
FriendlyName="KF Timed Ammo Giver Mutator"
Description="Mutator after every 5 minutes, gives you an ammo box."
}
Last edited by FluX; 05-25-2011 at 05:01 AM. |
|
#51
|
|||
|
|||
|
He,y right im trying to get this working again but im looking at some of the weapon mutators as a base.
Here's my code: Code:
class AmmoMut extends Mutator;
function PostBeginPlay()
{
SetTimer(300, true);
}
function Timer()
{
Want to call my ModifyPlayer function here
Player.ClientMessage ("You have been given an ammo box!");
Log("Ammo Given!");
}
function ModifyPlayer(Pawn Player)
{
Super.ModifyPlayer(Player);
Player.GiveWeapon("KFMod.KFAmmoPickup");
}
defaultproperties
{
GroupName="KFAmmoMutator"
FriendlyName="KF Timed Ammo Giver Mutator"
Description="Mutator after every 5 minutes, gives you an ammo box."
}
Error, 'Player': Bad command or expression Why is this? Probably a newb question but to learn I rather do then read etc. It actually makes me remember better. |
|
#52
|
||||
|
||||
|
Player isn't some magic variable that references each player on the map. You actually need to loop through all player actors and call ModifyPlayer on them. Refer to the code examples above in this thread, where this is done. Somehow this was lost in the progress :S
__________________
Quote:
|
|
#53
|
|||
|
|||
|
EDIT(Again):
Just disregard anything I said here. lol. Last edited by TroyIrving; 06-14-2011 at 08:02 AM. |
|
#54
|
|||
|
|||
|
Quote:
Code:
local KFHumanPawn Player;
local KFPlayerReplicationInfo KFPRI;
foreach DynamicActors(class 'KFHumanPawn', Player)
{
KFPRI = KFPlayerReplicationInfo(Player.PlayerReplicationInfo);
|
|
#55
|
|||
|
|||
|
Right I have now got it to be able to compile by having this:
Code:
class AmmoMut extends Mutator;
function PostBeginPlay()
{
SetTimer(300, true);
}
function Timer()
{
local KFHumanPawn Player;
foreach DynamicActors(class 'KFHumanPawn', Player)
{
Player.GiveWeapon("KFMod.KFAmmoPickup");
Player.ClientMessage ("You have been given an ammo box!");
Log("Ammo Given!");
}
}
defaultproperties
{
GroupName="KFAmmoMutator"
FriendlyName="KF Timed Ammo Giver Mutator"
Description="Mutator after every 5 minutes, gives you an ammo box."
}
I have noticed I get this message spamming my log: Code:
Warning: KFGameType KF-FluXiDefence.KFGameType (Function KFmod.KFGameType.MatchInProgress.SetupPickups:023F) Accessed None 'AmmoPickups' Error: KFGameType KF-FluXiDefence.KFGameType (Function KFmod.KFGameType.MatchInProgress.SetupPickups:023F) Accessed array 'AmmoPickups' out of bounds (0/0) Code:
ScriptLog: Ammo Given! ScriptLog: Ammo Given! ScriptLog: Ammo Given! ScriptLog: Ammo Given! |
|
#56
|
||||
|
||||
|
Does that message only appear with your mut on? Try disabling it and then check your log. Some maps get that if they don't have ammo spawns I think. Then we can safely say if it's an error with your mut or the map
also I'd suggest not giving the players the ammo boxes and instead just running the KFAmmoPickup.uc code in your mut
__________________
Quote:
Last edited by Excalibolg; 06-18-2011 at 04:10 PM. |
|
#57
|
|||
|
|||
|
Quote:
AmmoMut.uc(50) : Error, Bad or missing expression in 'If' Code:
function Timer()
{
local KFHumanPawn Player;
foreach DynamicActors(class 'KFHumanPawn', Player)
{
if (WaveNum >= 6) && (NumPlayers >= 8)
{
GiveAmmo(Player);
Player.ClientMessage ("You have been given an ammo box!");
Player.PlaySound( Sound'KF_InventorySnd.Ammo_GenericPickup',,1.0,,600.f);
}
else return;
}
}
|
|
#58
|
|||
|
|||
|
*Bump*
Can someone help me with this please? This isn't my full code but this is the section that is playing up. |
|
#59
|
||||
|
||||
|
Code:
class AmmoMut extends Mutator;
var KFGameReplicationInfo KFGRI;
function PostBeginPlay()
{
SetTimer(300, true);
}
function Timer()
{
local KFHumanPawn Player;
foreach DynamicActors(class 'KFHumanPawn', Player)
{
if (KFGRI.WaveNum >= 6) && (Level.game.NumPlayers >= 8)
{
GiveAmmo(Player);
Player.ClientMessage ("You have been given an ammo box!");
Player.PlaySound( Sound'KF_InventorySnd.Ammo_GenericPickup',,1.0,,600.f);
}
else return;
}
}
however without testing I am not sure whether the KFGRI should be local or var? try both hope it helps Last edited by braindead; 06-27-2011 at 08:03 AM. |
|
#60
|
|||
|
|||
|
Quote:
Code:
Unrecognized member 'WaveNum' in class 'KFGameReplicationInfo' |
![]() |
| Thread Tools | |
| Display Modes | |
|
|