View Full Version : Vanishing equipment

15th Nov 2001, 12:38 AM
The problem is that my mutator only gives the characters their default starting equipment on every other spawn, so if you get fragged you have to wait till you get fragged again to spawn with equipment

Is the problem in this mutator code, or should I be looking elsewhere?

class Equipment expands Mutator;

var PUTlsight LS;
var PUTgrapple GR;

function ModifyPlayer(Pawn Other)

if ( Other.IsA('Spectator') || Other.FindInventoryType(class'PUTLSight') != none ) return;
if ( Other.IsA('Bot') || Other.FindInventoryType(class'PUTLSight') != none ) return;
if ( Other.IsA('Spectator') || Other.FindInventoryType(class'PUTgrapple') != none ) return;
if ( Other.IsA('Bot') || Other.FindInventoryType(class'PUTgrapple') != none ) return;

LS = Spawn(class'PUTLSight',,, Location);
LS.bHeldItem = true;

GR = Spawn(class'PUTgrapple',,, Location);
GR.bHeldItem = true;


function Mutate(string MutateString, PlayerPawn Sender)
if ( MutateString ~= "SwLSight" )
if ( Level.NetMode == NM_Standalone )
LS = PUTlsight(Sender.FindInventoryType(class'PUTLSight'));
else Super.Mutate(MutateString, Sender);

15th Nov 2001, 12:58 AM
Hmm doesn't seem like anything's wrong..except that...I think you're supposed to Call Super.ModifyPlayer(Other); at the end of the function..I think

15th Nov 2001, 01:01 AM
oh btw..what does ~= in (MutateString ~= ....) means?

15th Nov 2001, 03:35 AM

I donít know how your equipment classes are set up, but when I look at your ModifyPlayer function I think what is happening is that there still is equipment for the player that spawns but it stopped working somehow (canít tell how exactly because I donít know your equipment class code) and because the player still has that in itís inventory. Try logging in your ModifyPlayer function when the function returns because there still is such an inventory item, and log when it indeed does spawn the inventory items. That way you can find out if your equipment is not working or that itís not spawned.

Also, the ~= operator in a string means approximately equality, in normal words if the string is the same as the string after the operator case Insensitive.

Hope this helps you,


15th Nov 2001, 10:41 AM
i assumed the ~= was a regular expression matching operator like in Perl and was happy to think that UnrealScript is set up for regex's ... So is it or isn't it, i wonder ...

Captain Kewl
15th Nov 2001, 11:19 AM
It is a pattern matching operator, not approximately equal... but it's also extremely limited, as far as I know. That's why it's only ever used for conditional testing of strings.

15th Nov 2001, 04:31 PM
When used with floats it means approximate equality (within 0.0001)

When used with strings it means case-insensitive equality