|
Post by Buzz Carols on Oct 30, 2012 23:55:14 GMT
How do I make a Gyrocopter in a level last longer than 5 seconds? Is there some sort of code I can add?
Thanks.
|
|
|
Post by Beack on Oct 31, 2012 0:13:48 GMT
powerups.cs located in marble/server/scripts/powerups.cs
Under the Helicoter Datablock
hope this helps and don't forget delete the .dso
EDIT:
Ni idea, it crashed the game "runtime error"
|
|
|
Post by Buzz Carols on Oct 31, 2012 0:29:51 GMT
Thanks for the help, but that looks like it makes all gyrocopters in the game last longer/shorter. I want to make a single gyrocopter in a level work differently.
|
|
|
Post by Beack on Oct 31, 2012 0:45:08 GMT
That's a bit different (and too advanced to me ), maybe it's a dynamic such "delay", "powerUpTime" tht you can add manually in the level editor. Ni idea to be honest :/
|
|
|
Post by Jeff on Oct 31, 2012 1:19:52 GMT
First, you need to install higuy's powerup "hack" which is in the mbdk. Then, you need to make a datablock of the powerup like Beack said to do by changing the powerupID value to a higher number. This will only work with the hack. Then, you would have to basically write code that calls the engine powerup through torqueScript and use something called a "schedule" to delay it for how long you want:
schedule(%time,0,doThis);
%time is the time in milliseconds, doThis is a method that is called upon during a delay time. This will take some thinking, but this is the ROUGH idea on how to tackle this.
EDIT:
When will you need the code by? This will be very tricky and I dont know if I would have time to code it, we'll see. Just let me know and hopefully I can get around to it eventually.
If you want to make it effect all gyrocopters temporarilly, just do this:
defaultmarble.poweruptime[5] = "999999999999999999";
|
|
|
Post by Hi Guy on Oct 31, 2012 1:42:45 GMT
Untested, but probably working
datablock ItemData (LongerGyro : HelicopterItem) { longer = true; //Don't modify time = <insert time here>; //Modify };
function Marble::setPowerUp(%this, %item, %reset) { //Original code PlayGui.setPowerUp(%item.shapeFile); %this.powerUpData = %item; %this.setPowerUpId(%item.powerUpId,%reset); //Modifications
//If the datablock tells us it's longer if (%item.getDatablock().longer) { //If we have no value stored, store one if (%this.getDatablock().origPUT[%item.powerUpId] $= "") %this.getDatablock().origPUT[%item.powerUpId] = %this.getDatablock().powerUpTime[%item.powerUpId]; //Modify powerUpTime[] %this.getDatablock().powerUpTime[%item.powerUpId] = %item.time; } else { //Reset it //If we need to reset if (%this.getDatablock().origPUT[%item.powerUpId] !$= "") { //Replace the original value %this.getDatablock().powerUpTime[%item.powerUpId] = %this.getDatablock().origPUT[%item.powerUpId]; //Clear the stored value %this.getDatablock().origPUT[%item.powerUpId] = ""; } } }
May not work in all cases (such as switching marble datablocks)
Maybe?
|
|
|
Post by Buzz Carols on Nov 4, 2012 0:13:34 GMT
We searched around and couldn't find the hack. Can you point us to it? Once we get it, are there instructions on how to install it?
Buzz will need it by the time he gets finished with his level "Freedom". So not very soon at all.
Thanks, Hi Guy! Do I add this code to the .mis file ?
|
|
|
Post by Jeff on Nov 4, 2012 0:25:24 GMT
Buzz Carols ignore my post about the hack, hence HiGuy just made you code a few days ago and the fact that he used a different approach. Yes, try adding it to the .mis file, but put it DIRECTLY at the top hence there is a datablock that needs loaded. If you put that at the end it won't work.
|
|
|
Post by Buzz Carols on Nov 4, 2012 1:00:29 GMT
We added the code block to an .mis file of a different level (Beginner level 9 of MBG) and changed the time to 20000 (20 seconds). Then, Buzz saw the new "LongGyro" powerup in the editor and he tried that, which added the powerup. Still no difference in the time. Is there anything we're doing wrong?
Thanks again for your help.
|
|
|
Post by Jeff on Nov 4, 2012 1:04:50 GMT
By adding the thing to make it 20 seconds do you mean you added my code? Cause if you did that is what is messing it up. Like said, ignore that code i posted, it was a temporary thing.
|
|
|
Post by Buzz Carols on Nov 4, 2012 1:29:27 GMT
No, it wasn't yours. It was Hi Guy's code.
|
|
|
Post by Jeff on Nov 5, 2012 1:02:57 GMT
HiGuy forgot one thing, replace this code:
function Marble::setPowerUp(%this, %item) { //Original code PlayGui.setPowerUp(%item.shapeFile); %this.powerUpData = %item; %this.setPowerUpId(%item.powerUpId,%reset); //Modifications
with this
function Marble::setPowerUp(%this, %item, %reset) { // %reset was forgotten //Original code PlayGui.setPowerUp(%item.shapeFile); %this.powerUpData = %item; %this.setPowerUpId(%item.powerUpId,%reset); //Modifications
Post again and tell me if that makes a difference.
Jeff
|
|
|
Post by Hi Guy on Nov 5, 2012 1:14:49 GMT
Whooooooooooooooooooops... Had an extra ".getDataBlock()" in the code (told you I didn't test it ), also had the problem Jeff noted. Modified and tested it, and now it's working. Extra note: If you want to save the mission under a new name / path, you'll have to re-add the code in at the top of the mission. Updated code: datablock ItemData (LongerGyro : HelicopterItem) { longer = true; //Don't modify time = <insert time here>; //Modify pickUpName = "a Long Helicopter"; //You can even edit this too :) };
function Marble::setPowerUp(%this, %item, %reset) { //Original code PlayGui.setPowerUp(%item.shapeFile); %this.powerUpData = %item; %this.setPowerUpId(%item.powerUpId,%reset); //Modifications
//If the datablock tells us it's longer if (%item.longer) { //If we have no value stored, store one if (%this.getDatablock().origPUT[%item.powerUpId] $= "") %this.getDatablock().origPUT[%item.powerUpId] = %this.getDatablock().powerUpTime[%item.powerUpId]; //Modify powerUpTime[] %this.getDatablock().powerUpTime[%item.powerUpId] = %item.time; } else { //Reset it //If we need to reset if (%this.getDatablock().origPUT[%item.powerUpId] !$= "") { //Replace the original value %this.getDatablock().powerUpTime[%item.powerUpId] = %this.getDatablock().origPUT[%item.powerUpId]; //Clear the stored value %this.getDatablock().origPUT[%item.powerUpId] = ""; } } }
|
|
|
Post by Buzz Carols on Nov 5, 2012 1:54:37 GMT
Thank you so much! It's working now. You guys are great.
|
|
|
Post by Hi Guy on Nov 5, 2012 2:56:41 GMT
No problem, happy to help
|
|
Mahmood
Novice Marbler
[ss:Default Skin]
15%
Posts: 20
|
Post by Mahmood on Nov 7, 2012 18:39:07 GMT
thanks Hi Guy I've Want this too
|
|
|
Post by Buzz Carols on Nov 27, 2012 23:54:57 GMT
Can a similar code be applied for other powerups such as Shock Absorbers and Super Bounces (changing the amount of time the PU effects the marble)? If so, what changes should I make?
|
|
|
Post by Jeff on Nov 28, 2012 0:09:22 GMT
looks like to me you just have to make more of these (example): datablock ItemData (LongerShock : ShockAbsorberItem) { longer = true; //Don't modify time = <insert time here>; //Modify pickUpName = "a Long Shock Absorber"; //You can even edit this too }; however, do not use this for superspeed and superjump, as i believe those should not be touched because iirc you can't control the effect, just the particle time.
|
|
|
Post by Buzz Carols on Nov 28, 2012 1:30:30 GMT
Thanks. Buzzmusic tried your code and this version he changed it to:
datablock ItemData (LongerBounce : SuperBounceItem) { longer = true; //Don't modify time = 2; //Modify pickUpName = "a Super Bounce"; //You can even edit this too };
He used the new powerups and the amount of time they affected the marble didn't change. They still worked for 5 seconds. Any other ideas?
Thanks again.
|
|
|
Post by Jeff on Dec 2, 2012 16:18:28 GMT
I will get back to you on this [sorry, I kind of forgot about this thead :S]. I am not sure what the problem is to be honest. Just hang in there!
|
|
|
Post by Buzz Carols on Dec 2, 2012 17:17:10 GMT
Thanks Jeff, glad you're still trying to fix the code. Buzz and I appreciate it.
|
|
|
Post by Buzz Carols on Dec 25, 2012 1:51:26 GMT
"Hey, Jeff. I don't mean to rush you, but I kind of need this "Shorter Marble Recoil" code soon since I'll be going on a 5 day campout on the 27th and I'd like to get my level done before that if possible. It's been a while since you last replied, and I understand if you're busy or if you forgot about this, but this is just a reminder. Hope you'll have the time. Thanks! Happy Holidays." - Buzzmusic100
|
|
|
Post by Jeff on Dec 25, 2012 2:08:33 GMT
Found your problem, you have it set for 2 milliseconds, change it to 2000 (2 seconds) and it will work fine. Tested it.
(I'm so sorry I forgot about this. Merry Christmas!)
|
|
|
Post by Buzz Carols on Dec 25, 2012 18:25:39 GMT
Buzzmusic100:
Thanks Jeff. But it still didn't work. It lasted for 5 seconds (which is the default time) and I wrote 2000 (2 seconds) both in MBG and MBP. Here's the code I used:
datablock ItemData (LongerBounce : SuperBounceItem) { longer = true; //Don't modify time = 2000; //Modify pickUpName = "a Super Bounce"; //You can even edit this too };
I added the "LongerBounce" powerup in the level editor and in the code so I'm pretty sure I have the right powerup. I also tried giving it a time greater than 5 seconds and that didn't work either. The weird thing is, you said you tested it. Maybe you could send me the .mis file you used for testing and I can see what the difference is?
Thanks again.
|
|
|
Post by Jeff on Dec 25, 2012 18:30:17 GMT
I don't have the .mis anymore, I deleted it. Make sure you are placing all the code in the same file. Don't split up the code, and place it at the top of it. Are you doing that? Reply first, then if all else fails, maybe you could send me your .mis so I can take a look at it.
|
|
|
Post by Buzz Carols on Dec 25, 2012 21:04:21 GMT
"Yes, I put the code at the beginning of the file as you suggested. One of the .mis files I have with the longer SB is attached in this post. Hope you can take a look at it." - Buzzmusic100 Attachments:
|
|
|
Post by Jeff on Dec 25, 2012 21:24:30 GMT
Yup, found your problem. You need to copy HiGuy's code into the .mis file or else it has no effect.
As HiGuy posted:
function Marble::setPowerUp(%this, %item, %reset) { //Original code PlayGui.setPowerUp(%item.shapeFile); %this.powerUpData = %item; %this.setPowerUpId(%item.powerUpId,%reset); //Modifications
//If the datablock tells us it's longer if (%item.longer) { //If we have no value stored, store one if (%this.getDatablock().origPUT[%item.powerUpId] $= "") %this.getDatablock().origPUT[%item.powerUpId] = %this.getDatablock().powerUpTime[%item.powerUpId]; //Modify powerUpTime[] %this.getDatablock().powerUpTime[%item.powerUpId] = %item.time; } else { //Reset it //If we need to reset if (%this.getDatablock().origPUT[%item.powerUpId] !$= "") { //Replace the original value %this.getDatablock().powerUpTime[%item.powerUpId] = %this.getDatablock().origPUT[%item.powerUpId]; //Clear the stored value %this.getDatablock().origPUT[%item.powerUpId] = ""; } } }
|
|
|
Post by Buzz Carols on Dec 26, 2012 0:09:24 GMT
It works! Thanks for all your help, Jeff. Buzz and I really appreciate it.
|
|
|
Post by Jeff on Dec 26, 2012 0:32:06 GMT
You're welcome. Hey it's Christmas time, what do you expect.
|
|