Author |
Message |
![[Post New]](/dcforum/templates/default/images/icon_minipost_new.gif) 11/28/2009 22:50:01
|
greg11
Wicked Sick!
Joined: 02/10/2008 20:00:40
Messages: 526
Location: Hood River, OR
Offline
|
I am trying to create an ability for WMs to be able to increase their max deployable mines.
I am having trouble with changing the MaxMine value.
Should I be creating a new minelayer with the new maxmines and giving it to the owner?
Code:
class AbilityMaxMines extends RPGAbility
config(UT2004RPG)
abstract;
var config int RequiredLevel;
var config int MinesPerLevel;
var config int MinimumMines;
static simulated function int Cost(RPGPlayerDataObject Data, int CurrentLevel)
{
local int x;
local bool ok;
for (x = 0; x < Data.Abilities.length && !ok; x++)
if (Data.Abilities[x] == class'ClassWeaponsMaster')
ok = true;
if(!ok)
{
if(CurrentLevel > 0)
log("Warning:"@data.Name@"has"@default.class@"Level"@CurrentLevel@"but does not have an associated Class to allow them to purchase it");
return 0;
}
if(Data.Level < (default.RequiredLevel + CurrentLevel))
return 0;
return Super.Cost(Data, CurrentLevel);
}
static simulated function ModifyWeapon(Weapon W, int AbilityLevel)
{
local int MaxMines;
local RPGWeapon RW;
if( !W.GetFireMode(0).IsA('ONSMineThrowFire') )
return;
RW = RPGWeapon(W);
if (RW == None)
return;
MaxMines = default.MinimumMines + default.MinesPerLevel * AbilityLevel;
// Change W.MaxMines
}
defaultproperties
{
RequiredLevel=50
MinesPerLevel=1
MinimumMines=2
AbilityName="Maximum Mines"
Description="Increases the number of mines that can be deployed by 1 per level. You must be a Weapons Master to purchase this skill.|
Cost (per level): 5. Max Level: 6. You must be level 50 to purchase the first level of this ability."
StartingCost=5
MaxLevel=6
}
|
|
 |
![[Post New]](/dcforum/templates/default/images/icon_minipost_new.gif) 11/29/2009 07:57:01
|
Szlat
Wicked Sick!
Joined: 05/18/2005 18:32:41
Messages: 2124
Location: UK
Offline
|
You need to set the MaxMines of the minelayer weapon.
Personally, I haven't tried using ModifyWeapon at all. It might work. Alternatively,
Put a ModifyPawn function in your ability and in there set the MaxMines for any existing minelayers the player might have.
Also have a OverridePickupQuery function to see if the player picks up a minelayer, and you might be able to set the MaxMines, or kick off a timer to do it later.
However, you need to make sure the modified value for MaxMines gets replicated to the client. It looks at a quick glance as though both ways might work.
However, note that on DC the max number of mines got nerfed from 8 to 2 to stop players spamming mines. This means
Druid may not be keen for it to be increased
There may be another mutator which does the knocking down of mines from 8 to 2. This could cause problems
|
|
 |
![[Post New]](/dcforum/templates/default/images/icon_minipost_new.gif) 11/29/2009 13:50:06
|
greg11
Wicked Sick!
Joined: 02/10/2008 20:00:40
Messages: 526
Location: Hood River, OR
Offline
|
Szlat wrote:
You need to set the MaxMines of the minelayer weapon.
W.MaxMines=somenumber wont work because I get a MaxMines doesn't exist in the weapon class error when compiling.
Personally, I haven't tried using ModifyWeapon at all. It might work.
AbilityFastWeaponSwitch was the only class that uses it.
Put a ModifyPawn function in your ability and in there set the MaxMines for any existing minelayers the player might have.
I will try that.
However, note that on DC the max number of mines got nerfed from 8 to 2 to stop players spamming mines. This means
Druid may not be keen for it to be increased
There may be another mutator which does the knocking down of mines from 8 to 2. This could cause problems
I briefly mentioned the idea to dru a while back in game. He said he might consider it. I am at least trying to see if I can at least make it.
The mutator is called deployable fun.
I think I will subclass it so that the timer is not set if fastfire is disabled.
It probably doesn't make much difference, but it does seem like a waste to do two conditional tests every .1 secs for no reason.
Thank you for the help.
|
|
 |
![[Post New]](/dcforum/templates/default/images/icon_minipost_new.gif) 11/29/2009 15:41:34
|
Szlat
Wicked Sick!
Joined: 05/18/2005 18:32:41
Messages: 2124
Location: UK
Offline
|
greg11 wrote:
Szlat wrote:
You need to set the MaxMines of the minelayer weapon.
W.MaxMines=somenumber wont work because I get a MaxMines doesn't exist in the weapon class error when compiling.
Use something like
ONSMineLayer(W).MaxMines
|
|
 |
![[Post New]](/dcforum/templates/default/images/icon_minipost_new.gif) 11/29/2009 16:20:26
|
greg11
Wicked Sick!
Joined: 02/10/2008 20:00:40
Messages: 526
Location: Hood River, OR
Offline
|
Szlat wrote:
greg11 wrote:
Szlat wrote:
You need to set the MaxMines of the minelayer weapon.
W.MaxMines=somenumber wont work because I get a MaxMines doesn't exist in the weapon class error when compiling.
Use something like
ONSMineLayer(W).MaxMines
I tried that, forgot why it didn't work.
ONSMineLayer(W) returns none.
I can try that again, maybe I overlooked something.
Actually I think when I tried that I had forgot to erase the previous compile...I spent an hour trying to find out why I couldn't get log entries...forgot that ucc doesn't overwrite the file.
|
|
 |
![[Post New]](/dcforum/templates/default/images/icon_minipost_new.gif) 11/29/2009 22:35:52
|
greg11
Wicked Sick!
Joined: 02/10/2008 20:00:40
Messages: 526
Location: Hood River, OR
Offline
|
got it:
Code:
FireMode[0] = W.GetFireMode(0)
...
ONSMineLayer(FireMode[0].owner).MaxMines=MaxMines;
Any idea why this works and ONSMineLayer(W).MaxMines doesn't? Is it because it is a rpgweapon?
I guess I need to test it with the mutator now.
|
|
 |
![[Post New]](/dcforum/templates/default/images/icon_minipost_new.gif) 11/29/2009 23:38:32
|
Szlat
Wicked Sick!
Joined: 05/18/2005 18:32:41
Messages: 2124
Location: UK
Offline
|
greg11 wrote:
Any idea why this works and ONSMineLayer(W).MaxMines doesn't? Is it because it is a rpgweapon?
Agreed. RPGWeapon stores the original weapon in the ModifiedWeapon variable. So, one way would be:
Code:
local Weapon W;
W = Instigator.Weapon; // or wherever you are getting the weapon from
if (RPGWeapon(W) != None)
W = RPGWeapon(W).ModifiedWeapon;
if (ONSMineLayer(W)) != None)
ONSMineLayer(W).MaxMines = x;
|
|
 |
|