Pages: 1 ... 48 49 [50] 51 52 ... 61
  Print  
Author Topic: Game Maker Help Thread!  (Read 43796 times)
Nathan Cash
Mossy
*
Posts: 4596



View Profile Email
« Reply #735 on: July 16, 2012, 11:43:38 AM »

That's pretty simple I'll test it. Thanks
Logged

halibabica
Bossy
Mossy
*
Posts: 1921


*whipcrack*


View Profile WWW Email
« Reply #736 on: July 16, 2012, 02:01:34 PM »

Actually...thinking again, that could mess up one of oPlayer1's variables. If you want it to be picked up the moment the player bumps it, just use the code I described in a collision event instead (collision with oPlayer1, of course).
Logged

Sometimes I wonder if I like Spelunky too much.
ManTrap mod - Tastes Like Spelunky
Hand-drawn comic - Spelunkying
Nathan Cash
Mossy
*
Posts: 4596



View Profile Email
« Reply #737 on: July 16, 2012, 02:42:55 PM »

I put it in the step event of the new item and nothing was messed up
Logged

Darc_Wolf
Shoot
*
Posts: 13


View Profile Email
« Reply #738 on: August 02, 2012, 05:06:22 AM »

So, I'm trying to add an item that basically doubles the length of your whip. So far, I have it mostly done. It only appears in shops, I've gotten it to appear.

I was sure this would happen, but it was the only way I could get it to work. Right now, in the items step event, I have


if (held)
{
hasLongWhip=true;
instance_destroy();
}

Of course, this means that if you pick it up from the shop, you get it, and you don't need to buy it since it just gives it to you. How do I make it so you have to buy it or drop it?
Logged
halibabica
Bossy
Mossy
*
Posts: 1921


*whipcrack*


View Profile WWW Email
« Reply #739 on: August 02, 2012, 06:38:55 AM »

For the shop question, I don't know exactly what you need to do, but take a look at how other items work in that regard. A straight copy/paste might even be safest.

I spotted something else you'll need to change in that code, though. You need to make 'hasLongWhip' a global variable. Otherwise, the player will lose it between rooms. Add 'global.hasLongWhip' to scrClearGlobals to establish it.
Logged

Sometimes I wonder if I like Spelunky too much.
ManTrap mod - Tastes Like Spelunky
Hand-drawn comic - Spelunkying
Darc_Wolf
Shoot
*
Posts: 13


View Profile Email
« Reply #740 on: August 02, 2012, 07:39:58 AM »

Yeah, it was already a global variable, I just forgot to add that to my post. Also, what are the shop items? I copied and pasted from oMattock, which had a price and everything.
Logged
halibabica
Bossy
Mossy
*
Posts: 1921


*whipcrack*


View Profile WWW Email
« Reply #741 on: August 02, 2012, 08:33:37 AM »

Try copying something like the Climbing Gloves, or any other power-up that disappears when purchased. It should have the same properties as what you're adding.
Logged

Sometimes I wonder if I like Spelunky too much.
ManTrap mod - Tastes Like Spelunky
Hand-drawn comic - Spelunkying
Darc_Wolf
Shoot
*
Posts: 13


View Profile Email
« Reply #742 on: August 02, 2012, 08:55:46 AM »

Er, I derped actually. I copied the Spike shoes (oSpikeShoes) not the Mattock. I suspect the code for making stuff disappear is in the a script for the player, not the item.
Logged
Moloch
Mossbaby
*
Posts: 373



View Profile WWW
« Reply #743 on: August 02, 2012, 07:06:45 PM »

Er, I derped actually. I copied the Spike shoes (oSpikeShoes) not the Mattock. I suspect the code for making stuff disappear is in the a script for the player, not the item.

If you haven't already, look at the scripts in the "Character" folder, especially scrStealItem (which handles buying items too) and scrHoldItem.
Logged

Darc_Wolf
Shoot
*
Posts: 13


View Profile Email
« Reply #744 on: August 02, 2012, 07:12:18 PM »

Aha! Thank you very much! scrStealItem is exactly what I was looking for. Thanks.

EDIT:
What does "    global.equipped[8,1] = true
    global.equipped[8,2] = true
    global.equipped[8,4] += 1;"

mean? It's different for each item, and I have no idea how to use those. If it helps, I'm using the fanmod for YASM 1.6. (I don't plan on releasing this)
Logged
Nathan Cash
Mossy
*
Posts: 4596



View Profile Email
« Reply #745 on: August 02, 2012, 08:14:06 PM »

YOU BETTER RELEASE IT PUNK!!!  Grin
Logged

Moloch
Mossbaby
*
Posts: 373



View Profile WWW
« Reply #746 on: August 02, 2012, 08:21:43 PM »

Aha! Thank you very much! scrStealItem is exactly what I was looking for. Thanks.

EDIT:
What does "    global.equipped[8,1] = true
    global.equipped[8,2] = true
    global.equipped[8,4] += 1;"

mean? It's different for each item, and I have no idea how to use those. If it helps, I'm using the fanmod for YASM 1.6. (I don't plan on releasing this)

That's the array for the worn item inventory (cape, shoes, etc) in YASM. It's initialized in scrClearEquipped.

item 8 = Jordans
8,1 = does  the player own them?
8,2 = if they are currently being worn?
8,4 = quantity owned (added by fan mod, so you can sell extra gear you pick up)

In hindsight, the inventory system was designed very poorly. It's functional, but not modular. I've wanted to add new items to the mod but my lack of forethought and sloppy coding have made it unappealing. In this case, the length of the inventory arrays are hard coded, when I should have set their length in a global variable when they were initialized or used Game Maker's built-in data structures. Apologies.

EDIT:
How about a mindfuck? Check the YASM 1.6 fanmod scrScumGlobals script, line 15. Change the value to 1. It works, but there is no item pickup for it.
« Last Edit: August 02, 2012, 08:38:02 PM by Moloch » Logged

Darc_Wolf
Shoot
*
Posts: 13


View Profile Email
« Reply #747 on: August 02, 2012, 09:40:37 PM »

Yeah, it was weird working with that. I had trouble getting my whip upgrade to work until I added something small to the whip code. My guess is that's what he had trouble with, or he couldn't figure out how to add an item, oh well, I got mine to work.

Also, that seems to add it to the inventory, which is good, however, it'll take a bit more to be able to disable having a longer whip.
Logged
Moloch
Mossbaby
*
Posts: 373



View Profile WWW
« Reply #748 on: August 02, 2012, 10:04:56 PM »

The whip upgrade was something I never finished fleshing out some versions ago, so it was disabled.

Duh. I just realized that by replacing the Jordans with the long whip you avoid the mess of trying to add additional items to the inventory. Carry on..
Logged

Darc_Wolf
Shoot
*
Posts: 13


View Profile Email
« Reply #749 on: August 02, 2012, 10:19:19 PM »

Um...actually, I managed to add it just fine. I just copied the one from paste, and changed the 13 to 14. Seems to work just fine.
Logged
Pages: 1 ... 48 49 [50] 51 52 ... 61
  Print  
 
Jump to: