file Changing the Marble Size In Game :D

  • Jeff
  • Jeff's Avatar Topic Author
  • Offline
  • Developer
  • Developer
  • PlatinumQuest Programmer
More
16 Nov 2011 06:01 #1 by Jeff
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
  • Administrator
  • Administrator
  • Rewrite it in Rust
More
17 Nov 2011 04:06 #2 by HiGuy
Replied by HiGuy on topic Changing the Marble Size In Game :D
Very nice. Could be useful for more MBO mega-marble style things.

PQ in a nutshell
function clientcmd12dothepq() {
    commandToClient(LocalClientConnection, '34onthedancefloor');
}

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

  • Jeff
  • Jeff's Avatar Topic Author
  • Offline
  • Developer
  • Developer
  • PlatinumQuest Programmer
More
17 Nov 2011 04:10 #3 by Jeff
Replied by Jeff on topic Changing the Marble Size In Game :D
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
More
17 Nov 2011 11:26 #4 by NaCl586
Replied by NaCl586 on topic Changing the Marble Size In Game :D
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
  • Administrator
  • Administrator
  • Rewrite it in Rust
More
18 Nov 2011 00:12 #5 by HiGuy
Replied by HiGuy on topic Changing the Marble Size In Game :D
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);
}

PQ in a nutshell
function clientcmd12dothepq() {
    commandToClient(LocalClientConnection, '34onthedancefloor');
}

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

  • Jeff
  • Jeff's Avatar Topic Author
  • Offline
  • Developer
  • Developer
  • PlatinumQuest Programmer
More
18 Nov 2011 00:12 #6 by Jeff
Replied by Jeff on topic Changing the Marble Size In Game :D
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
More
18 Nov 2011 12:51 #7 by NaCl586
Replied by NaCl586 on topic Changing the Marble Size In Game :D
@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
  • Developer
  • Developer
  • PlatinumQuest Programmer
More
18 Nov 2011 23:03 #8 by Jeff
Replied by Jeff on topic Changing the Marble Size In Game :D
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
  • Developer
  • Developer
  • PlatinumQuest Programmer
More
19 Nov 2011 00:34 #9 by Jeff
Replied by Jeff on topic Changing the Marble Size In Game :D
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
More
09 Jun 2012 12:56 #10 by Gary
Replied by Gary on topic Changing the Marble Size In Game :D
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
  • Developer
  • Developer
  • PlatinumQuest Programmer
More
09 Jun 2012 18:00 #11 by Jeff
Replied by Jeff on topic Changing the Marble Size In Game :D
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&action=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
More
10 Jun 2012 02:46 #12 by whirligig
Replied by whirligig on topic Changing the Marble Size In Game :D
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
  • Administrator
  • Administrator
  • Rewrite it in Rust
More
11 Jun 2012 04:45 #13 by HiGuy
Replied by HiGuy on topic Changing the Marble Size In Game :D
*Takes the bait* I will post one shortly

PQ in a nutshell
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
More
15 Jun 2012 12:49 #14 by Gary
Replied by Gary on topic Changing the Marble Size In Game :D
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&action=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: AayrlKalle29Regislian