Pages: [1] 2 3 ... 64
  Print  
Author Topic: Game Maker Help Thread!  (Read 180976 times)
Kegluneq
Big Bossy
Mossy
*
Posts: 2259



View Profile Email
« on: January 01, 2010, 11:00:46 PM »

Let us mod developers use this thread as a place for us all to ask for and receive help, and for non-pro-owners to ask pro-owners to compile their code for them!

Also, this prevents there from being a whole new thread for just one question.

Please, let's try and keep this thread on-topic and keep away from any de-railing.
While uber noob questions (you know what I mean) are generally frowned upon, beginner questions regarding the Game Maker Language or using Game Maker itself are accepted.

Tutorials are also recommended and greatly appreciated.

To keep the easily answered questions to a minimum and the intellectual ones to a maximum, please consult Game Maker's help file first, as many questions can be answered there.

Disclaimer: I, the thread creator, Mossmouth, Derek Yu, Olmec, Kali or any affiliations with the previous are not responsible for any unanswered queries. However, you are responsible for appropriate, non-flammatory behavior, and will be "for shamed" should you neglect your responsibilities.

Making a timer
Adding items to crates and more crate madness!
Spawning items from jars (testing/debug purposes)
Stop an item from being on sale when spawned, and more test/debug code
How the idol works
Editing rooms
Add stuff to the HUD
Where the item pickup code is
Turning an object into a light source
Quick variable check (test/debug purposes)
Add a new action button
Where the input code is
Where item action code is
Add new stuff to shops
« Last Edit: February 17, 2010, 11:13:22 PM by Kegluneq » Logged

A wild SHINY MOSSY appeared!
marsgreekgod
Big Bossy
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #1 on: January 01, 2010, 11:28:44 PM »

Oh good! I was going to ask a question, but this thread got made first!

having problems making a fireball for big bads to shoot. I am not sure where to put the code for spelunker to get hurt, I can make him get hurt just fine, but to react (as if a bullet had hit him) is out of my grasp. I tried stealing the bullet code, but it was for not.
Logged

Show your power, Gun Del Hell! Show them their fate! Yes! Yes! Yes! Yes! Yes! Here we go! Let's go, go, go, go, Django! Light and Dark! It comes down to this! Be afraid, Sun!
Kegluneq
Big Bossy
Mossy
*
Posts: 2259



View Profile Email
« Reply #2 on: January 01, 2010, 11:33:56 PM »

Seems to be in [Objects : oPlayer1 : Step : The 1st code action under Hurt]
Logged

A wild SHINY MOSSY appeared!
marsgreekgod
Big Bossy
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #3 on: January 01, 2010, 11:46:13 PM »

Quote
{
    obj = instance_nearest(x, y, oFireAttack);
    if (obj)
    {
        if (global.plife > 0)
        {
            global.plife -= 1;
            if (global.plife <= 0 and isRealLevel()) global.enemyDeaths[16] += 1;
        }
        if (obj.x < x) xVel = 3;
        else xVel = -3;
        yVel = -5;
       
        scrCreateBlood(x, y, 3);
        playSound(global.sndHurt);
        stunned = true;
        stunTimer = 20;
    }
}
Clearly spelunker is so manly fire just flys threw him.
Logged

Show your power, Gun Del Hell! Show them their fate! Yes! Yes! Yes! Yes! Yes! Here we go! Let's go, go, go, go, Django! Light and Dark! It comes down to this! Be afraid, Sun!
Kegluneq
Big Bossy
Mossy
*
Posts: 2259



View Profile Email
« Reply #4 on: January 01, 2010, 11:52:38 PM »

This is the code for the arrow, let's try and break it down

//identify the arrow? Not sure. Maybe this is where the trouble comes from.
obj = instance_nearest(x, y, oArrow);
//Arrows are only dangerous when going faster than 3, and I think your fireballs are never going to be safe, so this line is not needed
    if (obj and abs(obj.xVel) > 3 and not obj.safe)
    {
//If your still alive...
        if (global.plife > 0)
        {
//...then take life away!
            global.plife -= 2;
//If your dead, then rack up a kill for the arrow! (In the detailed stats)
            if (global.plife <= 0 and isRealLevel()) global.miscDeaths[6] += 1;
        }
//Conservation of momentum. Getting hit by the arrow makes you fly as fast the arrow. (actually that's not entirely conservation of momentum but whatever)
        xVel = obj.xVel;
        yVel = -4;
//make blood
        scrCreateBlood(x, y, 3);
//remove the arrow
        with obj
        {
            instance_destroy();
        }
//PAIN!!
        playSound(global.sndHurt);
        stunned = true;
        stunTimer = 20;
    }


Doesn't your code move Mr. Spelunker around? Is that intentional?
« Last Edit: January 02, 2010, 12:15:36 AM by Kegluneq » Logged

A wild SHINY MOSSY appeared!
Delver
Bean
*
Posts: 161



View Profile Email
« Reply #5 on: January 03, 2010, 08:23:36 AM »

Can't figure out a way to make my Poison potion work slowly over multipliable lvl  Huh?

I think of something like:

if global.poison = true
{global.poisontime = global.time}

if (global.time = global.poisontime + 30)
{global.plife -= 1}

if (global.time = global.poisontime + 60)
{global.plife -= 1}

But a can't get it to work, anyone knows where the Time: XX.XX comes from in the pause screen?
 

 
Logged
marsgreekgod
Big Bossy
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #6 on: January 03, 2010, 01:05:08 PM »

Thanks I figured it out! my fireball went slower then 3 and I didn't see that. now it should Does work just fine!

Delver
Have a global variable be added to slowly via timer?
« Last Edit: January 03, 2010, 01:58:43 PM by marsgreekgod » Logged

Show your power, Gun Del Hell! Show them their fate! Yes! Yes! Yes! Yes! Yes! Here we go! Let's go, go, go, go, Django! Light and Dark! It comes down to this! Be afraid, Sun!
Kegluneq
Big Bossy
Mossy
*
Posts: 2259



View Profile Email
« Reply #7 on: January 03, 2010, 04:27:32 PM »

Oh I see what's wrong with the poison code. Maybe.

Either your missing parentheses around the first if global.poison = true,

OR

I'm assuming that the whole thing is in the step event?
If so, then it's doing this:

Oh, I'm poisoned. Well let's see, I got poisoned now, so the time I got poisoned is now.
Since the time I got poisoned is now, I guess it's not time for me to get hurt yet.

Next frame:
Oh, I'm poisoned. Well let's see, I got poisoned now, so the time I got poisoned is now.
Since the time I got poisoned is (always and forever will be) now, I guess it's not time for me to get hurt yet.

And this happens EVERY frame.

Instead, use:
if (global.poison and global.time%30000=0)
{global.plife -= 1}

That's every 30 seconds, but not every 30 seconds from the point you get poisoned, it's every 30 seconds from 0 seconds.
So instead:

if (global.poison and not global.checkPoison)
{global.poisontime = global.time; global.checkPoison = true;}

if (global.poison and (global.time-global.poisontime)%30000=0)
{global.plife -= 1}


Make sure to set global.checkPoison to false wherever it is your creating it (and that wherever is definitely NOT in any step events).
Logged

A wild SHINY MOSSY appeared!
Darkness3313
Mosskid
*
Posts: 710


That reminds me of a puzzle...


View Profile
« Reply #8 on: January 03, 2010, 05:50:14 PM »

Suddenly Keg knows everything about anything ever.

Anyway, I've tried adding the Basketball item to a mod I'm working on, and I can't test it. So my question is, in the ScrGenerateitem
Will this code work?
   else if (rand(1,60) == 1) obj = instance_create(argument0, argument1, oBasketball);
Logged
marsgreekgod
Big Bossy
Mossy
*
Posts: 9806


The will of the Galaxy.


View Profile WWW Email
« Reply #9 on: January 03, 2010, 05:51:07 PM »

Suddenly Keg knows everything about anything ever.

Anyway, I've tried adding the Basketball item to a mod I'm working on, and I can't test it. So my question is, in the ScrGenerateitem
Will this code work?
   else if (rand(1,60) == 1) obj = instance_create(argument0, argument1, oBasketball);
It should? What happens?
Logged

Show your power, Gun Del Hell! Show them their fate! Yes! Yes! Yes! Yes! Yes! Here we go! Let's go, go, go, go, Django! Light and Dark! It comes down to this! Be afraid, Sun!
Darkness3313
Mosskid
*
Posts: 710


That reminds me of a puzzle...


View Profile
« Reply #10 on: January 03, 2010, 05:53:43 PM »

A Level may Generate a Basketball, I'm not sure but it will be in a Crate. That's so its easier to test in the Level create as you can make a ton of crates until a Basketball appears. but like I said. I can't test it.
Logged
Sudonimus
Mossy
*
Posts: 2743


Stop staring.


View Profile
« Reply #11 on: January 03, 2010, 05:55:15 PM »

What does the basketball do?
Logged

How is there no such thing as non-existence?!
Darkness3313
Mosskid
*
Posts: 710


That reminds me of a puzzle...


View Profile
« Reply #12 on: January 03, 2010, 05:56:26 PM »

I actually don't know, but Derek had it made in the Source, I just added it to the game. I do know it can Dribble though.
Logged
Sudonimus
Mossy
*
Posts: 2743


Stop staring.


View Profile
« Reply #13 on: January 03, 2010, 05:57:22 PM »

Like by throwing it
or jumping on it?
Logged

How is there no such thing as non-existence?!
Kegluneq
Big Bossy
Mossy
*
Posts: 2259



View Profile Email
« Reply #14 on: January 03, 2010, 06:19:11 PM »

The code you made should make there a chance to have a basketball pop out of a crate. I don't see any reason why it wouldn't work.

Upon testing the basketball out with the debugger (since I have Pro I get GM's actual debugger), I have found that the basketball is the most fun I've ever had throwing stuff around.

I mean, it's bouncy! What's not to love about that?
Logged

A wild SHINY MOSSY appeared!
Pages: [1] 2 3 ... 64
  Print  
 
Jump to: