file Changing the Marble Size In Game :D

  • Jeff
  • Jeff's Avatar Topic Author
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
16 Nov 2011 06:01 #1
Well, this will work for both big marble and small marble, but its not in powerup form. This weekend, I will release a video of me coding it in Powerup format.

Anyways, add this code to marble.cs:

Code:datablock MarbleData(BigMarbleSize : DefaultMarble) {
shapeFile = ~/data/shapes/balls/Big Marble.dts;
};

datablock MarbleData(SmallMarbleSize : DefaultMarble) {
shapeFile = ~/data/shapes/balls/Small Marble.dts;
};

function changeMarbleSize(%marble) {
if(!isObject(LocalClientConnection.player))
return;
localClientConnection.player.setDatablock(%marble);
}

When u want to change the Datablock in game, just call this method:

Code:changeMarbleSize(datablock name you choose);

(name must be in quotes, no acceptions)

This is unreliable since you have to have a big marble dts or a small marble dts, but for now, its all we got, unless if somehow i can get the scale to work.

Enjoy guys!

Jeff

PS. To revert the marble, make the datablock parameter defaultmarble

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • HiGuy
  • HiGuy's Avatar
  • Offline
  • Lead Developer
  • Lead Developer
  • PQ Developer Emeritus
  • Posts: 1334
  • Thank you received: 605
17 Nov 2011 04:06 #2
Very nice. Could be useful for more MBO mega-marble style things.

This signature is real code
Code:
function clientcmd12dothepq() { commandToClient(LocalClientConnection, '34onthedancefloor'); }

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar Topic Author
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
17 Nov 2011 04:10 #3
i will be doing a video this weekend on intigrating it into a powerup .

Just for you Higuy, lol.

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • NaCl586
  • NaCl586's Avatar
  • Offline
  • Professional Marbler
  • Professional Marbler
  • An Ordinary Marble Blaster
  • Posts: 442
  • Thank you received: 70
17 Nov 2011 11:26 #4
Thank you jeff, i may able to code it on powerup form. but im not sure, im bad programmer. BTW what I've said on MSN is correct? MBAdventure always use MBDK code so only less possibility for me to called as a code robber.

EDIT:
That code is cursed and dont work properly.

See this code
Code:datablock AudioProfile(PuMegaMarbleSfx)
{
filename = ~/data/sound/spawn.wav;
description = AudioDefault3d;
preload = true;
};

datablock ItemData(MegaMarble) {
// Mission editor category
category = Powerups;
className = PowerUp;
powerUpId = 6;

activeAudio = PuMegaMarbleSfx; //change to the audio root!
pickupAudio = PuMegaMarbleSfx; //change to the pickup audio root!

// Basic Item properties
shapeFile = ~/data/shapes/balls/BigMarble.dts; //path of the shapefile
mass = 1;
friction = 1;
elasticity = 0.3;
emap = false;

// Dynamic properties defined by the scripts
pickupName = a Mega Marble Powerup!;
useName = ;
maxInventory = 1;
};

function MegaMarble::onUse(%this,%marble) {

changeMarbleSize(BigMarbleSize);

schedule(10000, 0, undoMegaMarble);
}

function undoMegaMarble() {

changeMarbleSize(DefaultMarbleSize);

}

And Code:datablock MarbleData(BigMarbleSize) {
shapeFile = ~/data/shapes/balls/BigMarble.dts;
};

datablock MarbleData(SmallMarbleSize) {
shapeFile = ~/data/shapes/balls/SmallMarble.dts;
};

datablock MarbleData(DefaultMarbleSize) {
shapeFile = ~/data/shapes/balls/ball-superball.dts;
};

function changeMarbleSize(%marble) {
if(!isObject(LocalClientConnection.player))
return;
localClientConnection.player.setDatablock(%marble);
}

I know whats the mistake. Ah i must copy all codes from teh defaultmarble datablock. Aw man, That 100 line of code that mato said is just a COPY PASTE!
I give up.

I'm just an ordinary marble blaster who like to create new and unusual things.

Creator of the Marble Blast GLC series
Check out and download my custom levels here .
Check out my original musics in this thread and in my soundcloud here .

Please Log in or Create an account to join the conversation.

  • HiGuy
  • HiGuy's Avatar
  • Offline
  • Lead Developer
  • Lead Developer
  • PQ Developer Emeritus
  • Posts: 1334
  • Thank you received: 605
18 Nov 2011 00:12 #5
Actually, what you forgot was the : DefaultMarble section in the BigMarbleSize datablock definition. Watered-down version:


Quote:datablock MarbleData(BigMarbleSize : DefaultMarble) {
shapeFile = ~/data/shapes/balls/BigMarble.dts;
};

datablock MarbleData(SmallMarbleSize : DefaultMarble) {
shapeFile = ~/data/shapes/balls/SmallMarble.dts;
};

datablock MarbleData(DefaultMarbleSize : DefaultMarble) {
shapeFile = ~/data/shapes/balls/ball-superball.dts;
};

function changeMarbleSize(%marble) {
if(!isObject(LocalClientConnection.player))
return;
localClientConnection.player.setDatablock(%marble);
}

This signature is real code
Code:
function clientcmd12dothepq() { commandToClient(LocalClientConnection, '34onthedancefloor'); }

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar Topic Author
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
18 Nov 2011 00:12 #6
Nov 16, 2011, 8:10pm, jeff wrote:i will be doing a video this weekend on intigrating it into a powerup .

Just for you Higuy, lol.

How many more free post counds will i get?

argh, ninga'd by Higuy -.-

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • NaCl586
  • NaCl586's Avatar
  • Offline
  • Professional Marbler
  • Professional Marbler
  • An Ordinary Marble Blaster
  • Posts: 442
  • Thank you received: 70
18 Nov 2011 12:51 #7
@jeff, im trying to beat you before you do that code.
@higuy and jeff: so the code will be changeMarbleSize(BigMarbleSize : DefaultMarble); ?

I'm just an ordinary marble blaster who like to create new and unusual things.

Creator of the Marble Blast GLC series
Check out and download my custom levels here .
Check out my original musics in this thread and in my soundcloud here .

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar Topic Author
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
18 Nov 2011 23:03 #8
no, thats only used as a child datablock, think of defaultmarble as a parent, and its children are bigmarble and small marble, u would just call big, small, or default marble, u dont use that syntax

Also, because you did that, I had to go fix mbelite cause it kept crashing, so thanks

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar Topic Author
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
19 Nov 2011 00:34 #9
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 :D
//

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 :P
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 :P
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 :)
}

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • Gary
  • Gary's Avatar
  • Offline
  • Intermediate Marbler
  • Intermediate Marbler
  • Hi all
  • Posts: 80
  • Thank you received: 8
09 Jun 2012 12:56 #10
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 :D
//

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 :P
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 :P
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)

HappyRoll Mod Leader
C++ Beginner

Please Log in or Create an account to join the conversation.

  • Jeff
  • Jeff's Avatar Topic Author
  • Offline
  • Elite Marbler
  • Elite Marbler
  • PlatinumQuest Programmer
  • Posts: 1680
  • Thank you received: 205
09 Jun 2012 18:00 #11
You need to install HiGuy's custom powerup tutorial thing, so that these new powerups will take effect. The problem is without this hack, the engine thinks that you are trying to use an origional powerup, and not a normal one, so it just does nothing. Install this first, then come back for help if it still does not work:

marbleblast.com/index.cgi?board=mbdkcode...display&thread=11902

I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.

Please Log in or Create an account to join the conversation.

  • whirligig
  • whirligig's Avatar
  • Offline
  • Professional Marbler
  • Professional Marbler
  • Posts: 444
  • Thank you received: 261
10 Jun 2012 02:46 #12
Note: you may want to apply an impulse to the marble when increasing its size (otherwise it can get stuck in the floor). This is a more complicated process than it might seem (as the normal applyImpulse is glitched; you have to mess around with server objects). I'm not sure if an applyImpulse fix has been posted on this forum.

Please Log in or Create an account to join the conversation.

  • HiGuy
  • HiGuy's Avatar
  • Offline
  • Lead Developer
  • Lead Developer
  • PQ Developer Emeritus
  • Posts: 1334
  • Thank you received: 605
11 Jun 2012 04:45 #13
*Takes the bait* I will post one shortly

This signature is real code
Code:
function clientcmd12dothepq() { commandToClient(LocalClientConnection, '34onthedancefloor'); }

Please Log in or Create an account to join the conversation.

  • Gary
  • Gary's Avatar
  • Offline
  • Intermediate Marbler
  • Intermediate Marbler
  • Hi all
  • Posts: 80
  • Thank you received: 8
15 Jun 2012 12:49 #14
Jun 9, 2012, 11:00am, jeff wrote:You need to install HiGuy's custom powerup tutorial thing, so that these new powerups will take effect. The problem is without this hack, the engine thinks that you are trying to use an origional powerup, and not a normal one, so it just does nothing. Install this first, then come back for help if it still does not work:

marbleblast.com/index.cgi?board=mbdkcode...display&thread=11902

ok..i will try..thanks~

HappyRoll Mod Leader
C++ Beginner

Please Log in or Create an account to join the conversation.

Moderators: Doomblah
Time to create page: 1.623 seconds
We use cookies

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.