shooter game problems

Posted by TypicalAndy
basically, I made a rocket launcher, when the rocket hits the other player the self player destroys and then the other one too, then they both are stuck in the air....

Replies (16)

Last message on 4 Sep 2018

Size43 (Administrator) on 18 Jul 2018, 23:49:54
What does your code look like?
TypicalAndy (Topicstarter) on 18 Jul 2018, 23:55:20
in the PlayerObject theres a Collide event for the bullet,

Delete Instance Self
Create RespawnSystem
the RespawnSystem has a Alarm for 3 Seconds
Create Player Object at x,y

those are blocks By the way...
Size43 (Administrator) on 20 Jul 2018, 13:06:26
Re-reading your original post, I just need to clarify something: is the issue that both the self and other player get destroyed, or that the players are both stuck in the air?
TypicalAndy (Topicstarter) on 26 Jul 2018, 16:44:17
both, when you kill a player every player object gets destroyed then they are stuck in the air.
Size43 (Administrator) on 28 Jul 2018, 16:45:24
Please double-check that you don't have accidentially set any block to operate on all obj_player / obj_other_player objects instead of self or other.

Secondly, do you have any collision code in the bullet or the other player object? If there's a bit of code that only destroys the obj_player object, but runs on all clients it will destroy all objects anyways.
TypicalAndy (Topicstarter) on 29 Aug 2018, 22:01:09
UPDATE: I have looked into the sync documentation, I set HP For player and a collide code in the bullet but when it hits the player, the player wont die. i used a code from a comment of the documentation

collide code of bullet:

if owner == gms_self_playerid()
{
other.hp -= 10
instance_destroy()
}
Size43 (Administrator) on 30 Aug 2018, 13:53:07
I think you might want a "!=" instead of a "==" there.

Right now it only subtracts health when the bullet was created by the same player. It sounds like you instead want it to subtract health when a player gets hit with a bullet from another player.
TypicalAndy (Topicstarter) on 30 Aug 2018, 18:39:59
now im getting some error...



___________________________________________
############################################################################################
FATAL ERROR in
action number 1
of Step EventoPlayer
for object oRocketBullet:

Variable <unknown_object>.<unknown variable>(100096, -2147483648) not set before reading it.
at gml_Object_oRocketBullet_Collision_5
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_oRocketBullet_Collision_5 (line -1)
Size43 (Administrator) on 31 Aug 2018, 13:49:36
The <unknown variable> seems to suggest something is wrong with GM itself. If it worked before, and all you changed was == to != it shouldn't give you that error.
TypicalAndy (Topicstarter) on 31 Aug 2018, 15:21:14
when I made != it started to give me the error, when == nothing happened.
Size43 (Administrator) on 31 Aug 2018, 16:32:43
What happens if you change it back to ==?
TypicalAndy (Topicstarter) on 31 Aug 2018, 16:33:47
then the player wont die or get any hp removed.
Size43 (Administrator) on 31 Aug 2018, 16:35:19
Did you just check that, or answer based on what you remember?

I'm asking to make sure the switch from == to != actually causes the error you're seeing.
TypicalAndy (Topicstarter) on 31 Aug 2018, 16:41:14
the switch from == to != causes the error. and when i set it to == the player wont lose HP or die.
Size43 (Administrator) on 3 Sep 2018, 10:08:33
That sounds a lot like a GM:Studio bug. What GM version are you on? Try updating GM:Studio if you're not already on the latest version.
TypicalAndy (Topicstarter) on 4 Sep 2018, 21:05:50
I am at 1.4.8 but It does not want to update to 1.4.9 (Steam) I guess I'll have to wait...