The Daily Click ::. Forums ::. Klik Coding Help ::. super awesome gun
 

Post Reply  Post Oekaki 
 

Posted By Message

Chloe Sagal

under the influence of FUN

Registered
  19/02/2009
Points
  607

Orange
8th March, 2009 at 19:21:35 -

i have a super awesome gun in my game, that decided for some reason the last couple of days, once it hits one of the zombies heads in my game, it hits every zombie that is currently in play in the head, so therefore every single zombie dies.

sounds great but it really sucks because i just cant seem to figure it out.

heres how i have my system set up.
everytime a zombie is created, so is a sprite, a head sprite, its own PMO and a target (to find the player). its set up with a loop so all i have to create is the zombie collision detector and everything else spawns from that. on top of that, each zombie cd is given a value assigned to it on 4 variables that have the fixed number of each object associated with it.

its been fairly air tight so far and everything works perfectly, of course except this.

ive tried several combinations, which are

bullet collides with head
head is overlapping zombie
fixed value of head is equal to assigned head of zombie

this one worked fine for a while, but if two zombies were touching eachother (even if the bullet wasnt touching one) they would both die. id set it back to that, but it doesnt work anymore, for some reason its like MMF2 slips a "or" statement after the collision statement.

bullet collides with head
fixed value of head is equal to assigned head of zombie

bullet collides with head
assigned head of zombie is equal to fixed value

bullet collides with head
bullet collides with zombie

assigned head of zombie is equal to fixed value
bullet collides with head

ive done various combinations of all of these, i even tried working it into the movment loop

on movment loop
spread value of zombie equals loop index
:various combinations of code that dont work:

but none of them work. im sure there is something extremely simple, because it seems like it just measures which ever zombie has a head with its fixed equal to the assined value.

the last thing im gonna try that i just thought of is working a "bullet collides" in the movement loop and if it does sets a value into the bullet to equal the fixed value of the zombie and then in the collision event set hit zombie is equal to fixed of zombie then do stuff. but incase it dont work, anyone have any other suggestions?

 
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal

Chloe Sagal

under the influence of FUN

Registered
  19/02/2009
Points
  607

Orange
8th March, 2009 at 19:28:56 -

oh yeah, and no, that didnt work either. im stumped guys.

 
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
8th March, 2009 at 19:36:50 -

didnt read through every variation you tried but you need to use the compare two values function instead of comparing the alt value of zombie directly.

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
8th March, 2009 at 20:36:05 -

Using spread values:

+ everytime new Zombie is created
-> spread value 0 in Head
-> spread value 0 in Zombie

+ bullet collides with Head
+ Zombie value = Head value
-> kill Zombie
-> kill Head

------------------------------------------------------------------------------------------

Or using MMFs "object matching":

+ bullet collides with head
-> set AltVal("Head") to 1

+ always
-> set AltVal("Zombie") to AltVal("Head")

+ AltVal("Zombie") = 1
-> kill Zombie

+ AltVal("Head") = 1
-> kill Head


You almost never want to use "compare two general values" when you have duplicates, as it will always retrieve values from just the most recently created instance, regardless of what other conditions you have.


 
n/a

Chloe Sagal

under the influence of FUN

Registered
  19/02/2009
Points
  607

Orange
8th March, 2009 at 20:52:41 -

@cecil - didnt work...

@sketchy - that first one is basically what i have, except not only do i have that, but it sets the fixed value to an alt value aswell... but unfortunatly i tried using just the spread value aswell. like i said its like it wants to put an or statement instead

ill try the second one tho, ill let you know if it works. thanks!

 
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
8th March, 2009 at 20:57:17 -


Originally Posted by Sketchy

You almost never want to use "compare two general values" when you have duplicates, as it will always retrieve values from just the most recently created instance, regardless of what other conditions you have.



youre kidding.

+compare alt value a("object 1") > 10
-destroy object 1

will only destroy all instances with alt value > 10.
at least im pretty sure. im at work and dont have mmf handy but thats how ive always handled it.

@chloecakes - try grouping all zombies into a qualifier and compare the alt value of the group.

 
n/a

Chloe Sagal

under the influence of FUN

Registered
  19/02/2009
Points
  607

Orange
8th March, 2009 at 20:59:21 -


Originally Posted by Sketchy
+ always
-> set AltVal("Zombie") to AltVal("Head")



i think this line killing it.

it dont work.

@cecil - ...ill give it a shot!

Edited by Chloe Sagal

 
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
8th March, 2009 at 21:04:48 -

Both ways will work fine, unless you're doing something else strange.

What events are you using to keep the heads attached to the zombies etc?


Yet another alternative:

+ new zombie created
-> spread 1 in head altval
-> spread 1 in zombie altval

+ always
-> set counter to 0

+ bullet collides with head
-> set counter to altval of head

+ altval of zombie = value counter
-> kill zombie




 
n/a

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
8th March, 2009 at 21:10:58 -

I'm surprised you can't just use a normal "bullet collides with zombie head -> destroy head" event. Unless there's 500 zombies on the screen at once shouldn't that work? Geez, no wonder my coding sucks if it wouldn't haha.

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Chloe Sagal

under the influence of FUN

Registered
  19/02/2009
Points
  607

Orange
8th March, 2009 at 21:29:09 -

i really dont understand why this isnt working. i set the spread value to a completely separate value, unrelated to the rest of the program, and put in that system that you stated and it still doesnt work, so it might be what you said, the head snap, because its in a loop and it might just be tossing the same random heads all over the place or something, i really dont get how that is working. its retarded, ive tried eveyrthing and there is no reasonable explaination of why this particular event stopped working, and why it continues to screw itself repeadedly.

 
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
8th March, 2009 at 21:31:03 -


Originally Posted by miss chloecakes

Originally Posted by Sketchy
+ always
-> set AltVal("Zombie") to AltVal("Head")



i think this line killing it.

it dont work.



In that case, there's something wrong with the system you used for matching the heads to the bodies in some other events (maybe for the positioning, or attacks or something).
If you just allow MMF to automatically match them, all 3 methods work fine.

If you post the source maybe we could help.


 
n/a

Peblo

Custom ratings must be 50 characters or less

Registered
  05/07/2002
Points
  185

Game of the Week WinnerVIP MemberI'm on a Boat360 OwnerAttention GetterThe Cake is a LieCardboard BoxHero of TimePS3 OwnerIt's-a me, Mario!
I'm a Storm TrooperSonic SpeedStrawberryI like Aliens!Wii OwnerMushroomGhostbuster!
8th March, 2009 at 21:33:17 -

Hm. If bullet is touching a zombie, destroy bullet, add 1 to an alterable value. If that alterable value is above 1 then destroy zombie. Or, if bullet hits zombie, pick one zombie at random and destroy zombie.

It might be that you aren't being selective enough with your zombie picking with the fixed value. MMF is picky and doesn't play well with others.f

 
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath

Chloe Sagal

under the influence of FUN

Registered
  19/02/2009
Points
  607

Orange
8th March, 2009 at 21:40:11 -

lol, i did pick on at random, and if the headID was equal to kill counter, than it dies, but it just ignored the value portion and just picked on at random, so i shot this one zombie in the face and blew his head off, he was fine, but the guy behind me bled to death for an unexplained reason.

i think it mightve been because i still have the set counter to 0, and by the time the game processes the right one its already at 0, so ill set it after the event happens and see how that goes, if not i guess im posting my source code.

EDIT: yeah it didnt work. i got it down to one zombie at a time though, just not the right zombie (go figure). anyone interested in taking a gander at my source code? if you want let me know and ill pm it.

Edited by Chloe Sagal

 
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal

Peblo

Custom ratings must be 50 characters or less

Registered
  05/07/2002
Points
  185

Game of the Week WinnerVIP MemberI'm on a Boat360 OwnerAttention GetterThe Cake is a LieCardboard BoxHero of TimePS3 OwnerIt's-a me, Mario!
I'm a Storm TrooperSonic SpeedStrawberryI like Aliens!Wii OwnerMushroomGhostbuster!
8th March, 2009 at 21:46:06 -

If you mark the problematic lines with a comment, I'll look at it.

 
"Isn't it always amazing how we characterize a person's intelligence by how closely their thinking matches ours?"
~Belgarath

Chloe Sagal

under the influence of FUN

Registered
  19/02/2009
Points
  607

Orange
8th March, 2009 at 21:55:13 -

sent.

anyone else interested in taking a whack at it?

 
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
8th March, 2009 at 23:18:00 -

im not experiencing the problem you say is happenning. when i hit a zombie in the head only that zombie bleeds and dies. although some zombies when hit DONT bleed and just freeze in place.

if you dont figure it out ill trove through your code. it seems a bit complicated and i have not used the PMO (always code my own platform movement) so i will see what i can understand.

Edited by Cecilectomy

 
n/a

0ko



Registered
  11/01/2009
Points
  318
9th March, 2009 at 02:06:47 -

why can't you just use say,an object named "variables" have it so,if bullet collides with zombie head set alterable value a of "alterable values" to 1 (or you could use flags)

and in the behaviors event editor for the head have it so if alterable value a of the object called variables = 1 the destroy head.

then,if no zombies (group.1 or enemies) are on screen,set alterable value back to 0.

I don't know,maybe I just don't understand the problem.

Edited by 0ko

 
n/a

Chloe Sagal

under the influence of FUN

Registered
  19/02/2009
Points
  607

Orange
9th March, 2009 at 16:23:28 -


Originally Posted by Cecil
im not experiencing the problem you say is happenning. when i hit a zombie in the head only that zombie bleeds and dies. although some zombies when hit DONT bleed and just freeze in place.

if you dont figure it out ill trove through your code. it seems a bit complicated and i have not used the PMO (always code my own platform movement) so i will see what i can understand.



yeah, thats basically what it does, but when you shoot that zombie and the head dissapears, then it actually kills off another zombie, possibly off the screen, keep an eye on the number of objects, it starts at like 49, then every five on that is another zombie, so about 54. if you get something like 53 or 58, then theres a zombie stuck without a head an needs to be shot.


Originally Posted by Cecil
why can't you just use say,an object named "variables" have it so,if bullet collides with zombie head set alterable value a of "alterable values" to 1 (or you could use flags)

and in the behaviors event editor for the head have it so if alterable value a of the object called variables = 1 the destroy head.

then,if no zombies (group.1 or enemies) are on screen,set alterable value back to 0.

I don't know,maybe I just don't understand the problem.



hell, i dont even understand it, every method listed here should work, but it dont.

 
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
9th March, 2009 at 17:51:04 -

wtf? how did that quote from me? the second one. i didnt say that lol.

 
n/a

0ko



Registered
  11/01/2009
Points
  318
9th March, 2009 at 18:08:08 -

cecil! how dare you get credit for my post?!

oh and chloecakes,could you post an example file of it not working so I can try out my idea?

also if there's a still live headless zombie on screen,just set it up so if head isn't overlapping zombie,destroy zombie.

Edited by 0ko

 
n/a

Chloe Sagal

under the influence of FUN

Registered
  19/02/2009
Points
  607

Orange
9th March, 2009 at 19:08:22 -

oops! i forgot to change the name, i usually just quote one and copy the quote code then change the name, i just forgots. my bad!

@oko - i sent you the file in a pm

 
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
9th March, 2009 at 19:23:00 -

I think i know your problem, i had that problem aswell with multiple objects, there is a simple solution to it. It's not a solution but more of a guideline when using fixed values.

You have two objects. Zombie and Head. So basicly, when comparing fixed value, if you need to give actions to both objects in a same event.
Do this:

When you create a zombie, give to the head fixed of zombie in an altval.
And to check anything you need use this as condition, then you can give actions to both objects without any more conditions.

Zombie fixed = althead?
althead = zombie fixed?

and thats it.


 
Code me a sausage!

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
9th March, 2009 at 19:25:49 -

Go on then, send me the source too
I'm bored enough right now to take a look

 
n/a

Chloe Sagal

under the influence of FUN

Registered
  19/02/2009
Points
  607

Orange
9th March, 2009 at 19:52:38 -


Originally Posted by Don Luciano
I think i know your problem, i had that problem aswell with multiple objects, there is a simple solution to it. It's not a solution but more of a guideline when using fixed values.

You have two objects. Zombie and Head. So basicly, when comparing fixed value, if you need to give actions to both objects in a same event.
Do this:

When you create a zombie, give to the head fixed of zombie in an altval.
And to check anything you need use this as condition, then you can give actions to both objects without any more conditions.

Zombie fixed = althead?
althead = zombie fixed?

and thats it.



thats actually the way that i had it set up at first. maybe its possible that i should check it both ways like you have here and see if that works.

@sketchy - i sent you the file too.

thanks so much for your help everyone, sorry im such a problem!

 
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal

Chloe Sagal

under the influence of FUN

Registered
  19/02/2009
Points
  607

Orange
9th March, 2009 at 20:23:55 -

alright, peblo touched on it possibly having something to do with the spread values not lining up, and i set up a system that adds to a value everytime a zombie is created, and when the head is created, it sets that value to the zombie and the head copies the value set on the zombie. now, i definatly know for sure that it destroys the correct zombie now, except now it still destroys everyhead, so the bug is obviously in the bullet hits head script, not the actual detection of values. the scipt to start it is just "bullet overlapps head". from there it sets the kill value, creates the blood spot and starts the blood drop loop, then destroys the bullet and the head. ive got a few ideas on how i can fix it, but ive got to head out for a few hours and ill try it when i get back. if anyone gets any ideas please feel free to let me know.

thanks so much guys!

EDIT: nvm i got it! i set the destroy bullet and destroy head to the top of the actions, and it worked! my guess was the bullet was travelling so fast by the time it got around to destroying the head, it didn't know which one to pick! lol. and i thought that putting that at the top would disable the rest of the event? maybe since it was already initiated it cant just cancel it.

P.S. did any one who tested it find the tiny house funny? im going to finish it tonight and post an update. thank you to everyone who helped!

Edited by Chloe Sagal

 
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal
   

Post Reply



 



Advertisement

Worth A Click