Nov 18, 2011, 4:34pm, jeff wrote:Excuse the double post:
here is the guts of the powerup edition to the codes, if you want the full thing, you have to watch the 3 part video series on my youtube, which will be here within a few hours (its 3GB worth of footage ).
heres the guts:
Code://
// Marble Changing Items by Jeff Hutchinson
//
datablock MarbleData(BigMarble : DefaultMarble) {
shapeFile = ~/data/shapes/balls/Big Marble.dts; //to be changed if needed
};
datablock MarbleData(SmallMarble : DefaultMarble) {
shapeFile = ~/data/shapes/balls/Small Marble.dts; //to be changed if needed
};
function switchMarble(%powerup) {
if(!isObject(LocalClientConnection.player))
    return warn(Warning, there is no local client!);
    //which powerup will we be choosing, hmmmm
%returnval = defaultMarble;
switch$ (%powerup) {
case BigMarble:
    localClientConnection.player.SetDatablock(BigMarble);
schedule(5000, 0, SwitchMarble, %returnval);Â Â Â Â Â Â Â Â
case SmallMarble :
    localClientConnection.player.SetDatablock(SmallMarble);   Â
schedule(5000, 0, SwitchMarble, %returnval);Â Â Â Â //5000 is time in miliseconds... till reloop
       Â
    case DefaultMarble :
    localClientConnection.player.SetDatablock(DefaultMarble);       Â
    default :
        return warn(Warning, the shape does not exist!); //echo to the console displaying the error message...
}
}
//
// Powerup stuff now
//
datablock ItemData(BigMarbleItem) {
category = Powerups;
className = PowerUp;
shapeFile = ~/data/shapes/balls/Big Marble.dts; //to be changed if needed
emap = false; //we dont want reflection here..., unless u want it
pickupName = a Big Marble Powerup!;
powerupId = 6;
};
datablock ItemData(SmallMarbleItem) {
category = Powerups;
className = PowerUp;
shapeFile = ~/data/shapes/balls/Small Marble.dts; //to be changed if needed
emap = false; //we dont want reflection here..., unless u want it
pickupName = a Small Marble Powerup!;
powerupId = 7;
};
function BigMarbleItem::ondeploy(%this, %obj) {
switchMarble(BigMarble); //see that method above, now it comes in handy
}
function SmallMarbleItem::ondeploy(%this, %obj) {
switchMarble(SmallMarble); //see that method above, not it really comes in handy
}
Sorry.I don't know which file should i edit...the“marble.cs”or “powerup.cs”?
i tried to copy this code to both marble.cs and powerup.cs,i can see the powerups,but it doesn't work.
(my marble.cs and powerup.cs are in the Attachment)