Jump to content


MatFang

Member Since 17 Oct 2010
Offline Last Active Jul 07 2012 12:21 PM

Topics I've Started

2D Platformer- Gun Swapping Glitch

10 October 2011 - 03:02 AM

I've been working on my 2Dimensional platformer and I have encountered a small problem. I've been creating multiple guns and options to swap the guns in the middle of a level/ field.

I've been tinkering with the code I have, and I've simplified most of it to see if it would make things easier. Though unfortunately, all the tinkering and testing isn't fixing my problem.

I want the player to be able to swap guns as much as they want (even if it's the same two guns over and over). Whenever I swap the character's gun about 3-4 times, the ability to swap just disappears. I can't swap the guns any more, but I can still pick them up. This is becoming a slight hazard because I plan to have many guns in the future and losing the ability to swap will frustrate players.

Below I've posted some of the code that I've been using within a script and the collision events of the three guns I already have. Maybe someone here will be able to fix the problem.

scr_toss()
if weapon_1 = "Pistol_A" then
{object = instance_create(other.x,other.y,obj_pistol)
weapon_1 = "None"}

if weapon_1 = "Submachine_A" then
{object = instance_create(other.x,other.y,obj_submachine)
weapon_1 = "None"}

if weapon_1 = "Shotgun_A" then
{object = instance_create(other.x,other.y,obj_shotgun)
weapon_1 = "None"}

obj_pistol
if keyboard_check_pressed(ord('X')) then 
{
switch (weapon_1)
{
    case "None": with(other)instance_destroy()
               weapon_1="Pistol_A"; break;
    case "Shotgun_A": scr_toss() 
               with(other)instance_destroy()
               weapon_1="Pistol_A"; break;
    case "Submachine_A": scr_toss()
               with(other)instance_destroy()
               weapon_1="Pistol_A"; break;
    default: exit;
}
}

obj_shotgun
if keyboard_check_pressed(ord('X')) then 
{
switch (weapon_1)
{
    case "None": with(other)instance_destroy()
               weapon_1="Shotgun_A"; break;
    case "Pistol_A": scr_toss()
               with(other)instance_destroy()
               weapon_1="Shotgun_A"; break;
    case "Submachine_A": scr_toss()
               with(other)instance_destroy()
               weapon_1="Shotgun_A"; break;
    default: exit;
}
}

obj_submachine
if keyboard_check_pressed(ord('X')) then 
{
switch (weapon_1)
{
    case "None": with(other)instance_destroy()
               weapon_1="Submachine_A"; break;
    case "Pistol_A": scr_toss() 
               with(other)instance_destroy()
               weapon_1="Submachine_A"; break;
    case "Shotgun_A": scr_toss()
               with(other)instance_destroy()
               weapon_1="Submachine_A"; break;
    default: exit;
}
}

D3D/ FPS MMO Questions

24 June 2011 - 05:29 PM

These questions have been messing with me for quite a while, and no matter how much I try to study them from the manual and use them, I still don't get a clear understanding...

D3D Function Questions:
What is the whole use of stacks or other data structures?
What purpose do the D3D functions that involve vertexes serve?
(I don't use vertexes often, so it's kinda a topic I get confused in)

FPS MMO Questions:
I'm gonna start with I have tried over and over in my old FPS projects (None Of Which I can Recover from an old computer that fried)
and I have heard that the drawing involves lengthdir_x and lengthdir_y?

How can I draw a part of the player's model (Possibly an Arm holding things) in the player's view, like in almost every First Person Shooter?
How would I make the player's model turn on another person's screen?

3_D: Enemy Always Looks At Player

13 March 2011 - 06:15 PM

I'm trying to make my enemy always look in the direction of the player, but I can't seem to make it work.
Can someone help me?

I put the code into my step event, if it helps any.

Here are my failed solutions:
//Solution 1
dir = point_direction(x,y,obj_player.x,obj_player.y)
direction = dir

//Solution 2
direction = obj_player.direction+90

A problem I'm also having is with the direction. I have this code in the step event along with the above code:
speed = 1.565
move_towards_point(obj_player.x,obj_player.y,speed)
The problem is that when the direction is found, the enemy will move in that direction instead of the move_towards_point().

Sending Movements through a Server and Client

07 March 2011 - 12:24 AM

NOTE: I've been to the Novice/Intermediate Forum with this problem, and no one replied.

I'm making my MMORPG New Darkened (Temp Title) and I know some about sending things between clients and servers, but I have ran into a problem.

In my client, I have made a code in the step event that if ord('D') is pressed (keyboard_check_direct()), the client sends a message to the server telling it that the player is moving right. I have after the message is sent, (hspeed = 2.5).

I have the following code in my Client User's step event:
if keyboard_check_direct(ord('D'))
{
x += 2.5
   clearbuffer();
   writebyte(MOVE_D);
   writebyte(obj_player.x);
   writebyte(obj_player.y);
   send_server();
}

I put in the Server User's user defined 0 event:
switch (readbyte())
{
    /*
    case EXAMPLE:
        scr_case_example();
    break;
    */
    
    case MOVE_D:
        scr_case_moved();
    break;
    
    
    //No identifier present in the message, so show an error message
    default:
        show_message("Unknown packet received.");
        dllfree();
        iniEnd();
        game_end();
}

In scr_case_moved() :
{
    clearbuffer();
    writebyte(obj_player.x);
    writebyte(obj_player.y);
    send_client("all");
}

I keep getting errors from the server that says "Unknown Packet Recieved". I don't know where I went wrong in this code, but can someone find the error(s)? I'm stuck, seeing is how this is my first MMORPG.

New Darkened: Inventory System Idea

06 March 2011 - 04:59 PM

For those who don't know: This is an MMORPG Idea Topic!
Team Request Here: http://gmc.yoyogames...howtopic=500011
I'm working on making a player movable at the current moments, but I really want to figure out how my game's inventory is gonna work to my best wants.

What I want in an Inventory:
-15 Items (At Least)
-Full Custimizability
-Simple To Make


Now, I came up with an idea for an inventory that fits only two of those wants, 15 Items and Full Custimizability.

The idea is to have an '.ini' file for every user's inventory in this format:
[UsersInventory]
user = Example

[InventoryItem]
Item1 = NoItem
Item2 = Gold-200
Item3 = Pistol
Item4 = NoItem
Item5 = NoItem

What do you guys think about this idea?

Improvement Suggestions:
-(Improvement Suggestion): (User Who Posted)