Help W. an experiment?
Help W. an experiment?
Well, I'm trying to make a PlayerPawn that starts with a unique weapon (Think U4ET) but so far I'm completely lost... I've gotten some help, but so far haven't really got anywhere... So far all I have is the variables that say what weapons CAN be added, but so far they do nothing :/ Can anyone help?
- Feralidragon
- Godlike
- Posts: 5493
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Re: Help W. an experiment?
In unrealsp a guy already told you how:
http://www.unrealsp.org/forums/viewtopic.php?t=1200
But I have something to add here: you can use that same code in the pawn itself or in another mutator (trust me, I used it for XPickups and Nali Weapons II X weapon prizes/default inventory).
In this case, you aplly the code directly in your custom playerpawn (as you want), or even in custom bots if you want so:
Well, I modified it a little bit to fullfill your needs.
http://www.unrealsp.org/forums/viewtopic.php?t=1200
But I have something to add here: you can use that same code in the pawn itself or in another mutator (trust me, I used it for XPickups and Nali Weapons II X weapon prizes/default inventory).
In this case, you aplly the code directly in your custom playerpawn (as you want), or even in custom bots if you want so:
Code: Select all
//To aplly in a custom playerpawn
var() class<Weapon> WeapClass;
function AddWeaponToPlayer()
{
local Weapon newWeapon;
if( (WeapClass!=None) && (FindInventoryType(WeapClass)==None) && !Self.IsA('Spectator'))
{
newWeapon = Spawn(WeapClass,,,Location);
if( newWeapon != None )
{
newWeapon.Instigator = Self;
newWeapon.BecomeItem();
AddInventory(newWeapon);
newWeapon.BringUp();
newWeapon.GiveAmmo(Self);
newWeapon.SetSwitchPriority(Self);
newWeapon.WeaponSet(Self);
}
}
}
Re: Help W. an experiment?
Thx
Ya, Qtit's one couldn't work, as I needed to apply it as a gametype or Mutator instead.
<Edit:> no, still doesn't work
Still starts with just enforcer and Impact Hammer....
Ya, Qtit's one couldn't work, as I needed to apply it as a gametype or Mutator instead.
<Edit:> no, still doesn't work
Still starts with just enforcer and Impact Hammer....
- Feralidragon
- Godlike
- Posts: 5493
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Re: Help W. an experiment?
Be sure you aplly this code to the playerpawn itself and that WeapClass is set to the weapon you want. Double check it because something like classes and other default variables returning to none also happenned to me when compiling my vehicles, so your WeapClass might be None, and so you get no weapon. Check it in the Actor browser (default properties).
If everything is fine in those settings, tell me and I will see what can go wrong on this more closelly.
If everything is fine in those settings, tell me and I will see what can go wrong on this more closelly.
Re: Help W. an experiment?
Yup, all is done... The weapon (As it was just a test-haven't made full one yet) was the Pulsegun
- Feralidragon
- Godlike
- Posts: 5493
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Re: Help W. an experiment?
Try this (this should work, but I didn't try it though):
I just added a function to detect if you are (re)spawning to activate the function (I actually forgot that part when giving the other code to you lol).
Code: Select all
//To aplly in a custom PlayerPawn
var() class<Weapon> WeapClass;
var bool bOldHidden[2];
function Tick(float Delta)
{
bOldHidden[0] = bOldHidden[1];
bOldHidden[1] = bHidden;
if (bOldHidden[0] && !bOldHidden[1])
AddWeaponToPlayer();
Super.Tick(Delta);
}
function AddWeaponToPlayer()
{
local Weapon newWeapon;
if( (WeapClass!=None) && (FindInventoryType(WeapClass)==None) && !Self.IsA('Spectator'))
{
newWeapon = Spawn(WeapClass,,,Location);
if( newWeapon != None )
{
newWeapon.Instigator = Self;
newWeapon.BecomeItem();
AddInventory(newWeapon);
newWeapon.BringUp();
newWeapon.GiveAmmo(Self);
newWeapon.SetSwitchPriority(Self);
newWeapon.WeaponSet(Self);
}
}
}
Re: Help W. an experiment?
Won't compile-Bool Arrays not allowed... I don't think it'll work without that in there.
- Feralidragon
- Godlike
- Posts: 5493
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Re: Help W. an experiment?
Sorry again
Another mistake there, I forgot that I couldn't build arrays with boolean variables (I found that out when I had the same issue when doing something in the weapon lockers in XPickups, and I then to had to use another type of variable since I really needed an array there).
In this case, we don't need the array to fullfill the same effect, so instead of that, try this:
That should work now...
Another mistake there, I forgot that I couldn't build arrays with boolean variables (I found that out when I had the same issue when doing something in the weapon lockers in XPickups, and I then to had to use another type of variable since I really needed an array there).
In this case, we don't need the array to fullfill the same effect, so instead of that, try this:
Code: Select all
//To aplly in a custom PlayerPawn
var() class<Weapon> WeapClass;
var bool bOldHidden1, bOldHidden2;
function Tick(float Delta)
{
bOldHidden1 = bOldHidden2;
bOldHidden2 = bHidden;
if (bOldHidden1 && !bOldHidden2)
AddWeaponToPlayer();
Super.Tick(Delta);
}
function AddWeaponToPlayer()
{
local Weapon newWeapon;
if( (WeapClass!=None) && (FindInventoryType(WeapClass)==None) && !Self.IsA('Spectator'))
{
newWeapon = Spawn(WeapClass,,,Location);
if( newWeapon != None )
{
newWeapon.Instigator = Self;
newWeapon.BecomeItem();
AddInventory(newWeapon);
newWeapon.BringUp();
newWeapon.GiveAmmo(Self);
newWeapon.SetSwitchPriority(Self);
newWeapon.WeaponSet(Self);
}
}
}
- Feralidragon
- Godlike
- Posts: 5493
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Re: Help W. an experiment?
Well, it might not work in the first spawn. So if it compliles, suicide or something in game and respawn to see if it works. I think that's the problem now.
EDIT: I might test code at home to get it to work. So far I didn't test a thing about this code, but I will then.
EDIT: I might test code at home to get it to work. So far I didn't test a thing about this code, but I will then.
Re: Help W. an experiment?
I'm not sure exactly what PlayerPawn you want to give this weapon to, but try this:
*Package must equal the package name the weapon is in e.g. Botpack
*Weapon must equal the weapons class name e.g. PulseGun
This would assign a defined weapon to a defined PlayerPawn Class.
*PlayerPawnClass must equal the correct class you are using.class GiveWeapon expands Mutator;
function ModifyPlayer(Pawn Other)
{
if ( (Other.IsA(PlayerPawnClass)) )
{
DeathMatchPlus(Level.Game).GiveWeapon(Other,"Package.Weapon");
}
if ( NextMutator != None )
NextMutator.ModifyPlayer(Other);
}
*Package must equal the package name the weapon is in e.g. Botpack
*Weapon must equal the weapons class name e.g. PulseGun
This would assign a defined weapon to a defined PlayerPawn Class.
Retired.
Re: Help W. an experiment?
Code won't compile... It's complaining that there's an extra } on line 4, and if I get rid of it, it says it's MISSING a {
Re: Help W. an experiment?
As far as I recall you wanted a special PlayerPawn to have this weapon. If you give the weapon to Class'PlayerPawn' each and every player will get this weapon regardless of the model. You must call the class of this custom PlayerPawn e.g. Class'REAVERPLAYER' to just assign the weapon to that player.
Retired.
Re: Help W. an experiment?
I only want the ReaverPlayer to have it.
And Dane, your code won't compile
And Dane, your code won't compile
Re: Help W. an experiment?
post your code m8, because my code wont compile untill you fill out the correct classes for it I just posted it as example hehe
Retired.