Topic: Changing the Marble Size In Game :D (Read 885 times)
Jeff Elite Marbler torqueScript maniac[ss:Default Skin] member is offline
MBP Leaderboard Moderator.
Joined: Nov 2010 Gender: Male Posts: 1,559 Location: Kicking people from LBs...
Changing the Marble Size In Game :D « Thread Started on Nov 16, 2011, 1:01pm »
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.
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
NaCl586 Professional Marbler Searching Stolen Seven Gems[ss:Phil'sEmpire Skin] member is offline
MBElite Level and Skybox Designer
Joined: Jul 2010 Gender: Female Posts: 485 Location: Depends where I am now
Re: Changing the Marble Size In Game :D « Reply #3 on Nov 17, 2011, 6:26pm »
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.
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.
Jeff Elite Marbler torqueScript maniac[ss:Default Skin] member is offline
MBP Leaderboard Moderator.
Joined: Nov 2010 Gender: Male Posts: 1,559 Location: Kicking people from LBs...
Re: Changing the Marble Size In Game :D « Reply #7 on Nov 19, 2011, 6:03am »
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
Jeff Elite Marbler torqueScript maniac[ss:Default Skin] member is offline
MBP Leaderboard Moderator.
Joined: Nov 2010 Gender: Male Posts: 1,559 Location: Kicking people from LBs...
Re: Changing the Marble Size In Game :D « Reply #8 on Nov 19, 2011, 7:34am »
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 :) }
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)
HapyRoll Level Builder and GUI designer. ------------ I love ballance and marble blast~ I love ballance costum levels and marble blast costum levels~ I'm from China and My English is not good. So.So if there is grammatical mistakes, please forgive me (^.^)
Look~a video of the costum level Gem Gallery(without easteregg) --click here--
Jeff Elite Marbler torqueScript maniac[ss:Default Skin] member is offline
MBP Leaderboard Moderator.
Joined: Nov 2010 Gender: Male Posts: 1,559 Location: Kicking people from LBs...
Re: Changing the Marble Size In Game :D « Reply #10 on Jun 10, 2012, 2:00am »
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:
Re: Changing the Marble Size In Game :D « Reply #11 on Jun 10, 2012, 10:46am »
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.
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:
HapyRoll Level Builder and GUI designer. ------------ I love ballance and marble blast~ I love ballance costum levels and marble blast costum levels~ I'm from China and My English is not good. So.So if there is grammatical mistakes, please forgive me (^.^)
Look~a video of the costum level Gem Gallery(without easteregg) --click here--