PDA

View Full Version : the class<foo> syntax


tarquin
26th Aug 2001, 05:27 AM
is there a difference between these two variable declarations, or are they fundamentally the same thing?

local projectile p;
local class<projectile> Proj;

|^TSF^|2COOL4-U
26th Aug 2001, 07:25 AM
Yep there is

local projectile p;
For projectiles only

local class<projectile> Proj;
For projectiles and all its children and its children's children etc. etc.

2COOL4-U
26th Aug 2001, 07:30 AM
lol there must be something wrong here I was logged in using my old account :)

Bytekeeper
26th Aug 2001, 09:29 AM
It`s actually a bit different:

projectile p
declares a variable p which you can assign any projectile and sublass of projectile.

class<projectile> proj
Is a class variable, this means you can't assign a object to it, you can assign a class however: proj= class'SomeChildOfProjectileOrProjectileClassItSelf'

The trick is that you can now ie. spawn a custom actor with that:
p= spawn( proj );

It is for example used to assign a specific class to an player who logs in. The definition within the < > brackets just tells the compiler which subclass of the class may later be assigned to the var. So you can't assign proj= class'enforcer' since enforcer is not sublass of projectile etc...

tarquin
26th Aug 2001, 01:14 PM
ah... I get it. thanks!
it's the old peppercorn / peppermill thing :)