Jump to content


Photo

Instance Nearest Extended


  • Please log in to reply
72 replies to this topic

#1 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1070 posts

Posted 19 March 2007 - 02:46 PM

Overview:
This extension provides some new instance_nearest functions that allow you to set conditions the instances must meet before being considered. For example, you could find the 4th nearest instance with health less than 30, or the 3rd farthest instance with myvarname greater than 2.

Extension Webpage

Edited by Kyle_Solo, 01 March 2010 - 06:08 AM.

  • 0

#2 fire_soul453

fire_soul453

    aarons video games

  • GMC Member
  • 542 posts

Posted 01 April 2007 - 01:59 AM

instance_nth_nearest(x,y,obj,n) - this one can be very useful thanks for making the extension keep up the good work
  • 0

#3 Mynameisonic

Mynameisonic

    GMC Member

  • New Member
  • 170 posts

Posted 03 April 2007 - 10:07 PM

I agree with Fire Soul, nth nearest and xth nearest are very useful (in fact I will probably use this or something like it in one of my games one of these days...). However, I don't quite understand the purpose of the dsd() function. Is it just to restore a sprite to its defaults more quickly than normal? Anyway, keep working on it, it's a good start!

Edited by Mynameisonic, 03 April 2007 - 10:08 PM.

  • 0

#4 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1070 posts

Posted 03 April 2007 - 10:10 PM

EDIT: No longer relevant

Edited by Kyle_Solo, 15 October 2007 - 12:25 AM.

  • 0

#5 Bill23

Bill23

    GMC Member

  • GMC Member
  • 460 posts
  • Version:GM:Studio

Posted 14 October 2007 - 08:36 PM

Does instance_xth_nearest(x,y,obj,n,expression) use execute_string ?
  • 0

#6 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1070 posts

Posted 15 October 2007 - 12:11 AM

Not anymore.
  • 0

#7 Flamer_Shaftglutton

Flamer_Shaftglutton

    GMC Member

  • GMC Member
  • 304 posts

Posted 17 October 2007 - 02:58 PM

So let me see if I understand: instance_xth_nearest() finds you the nth nearest whose variable is a certain value? That's what I'm assuming, which would be great.

I don't see how anyone could pass this up. This is a must have for almost all games!
  • 0

#8 The_Cookie_Monster

The_Cookie_Monster

    GMC Member

  • New Member
  • 217 posts

Posted 17 October 2007 - 04:53 PM

If only I saw this three days ago... Nice work!
  • 0

#9 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1070 posts

Posted 17 October 2007 - 09:04 PM

So let me see if I understand: instance_xth_nearest() finds you the nth nearest whose variable is a certain value? That's what I'm assuming, which would be great.

I don't see how anyone could pass this up. This is a must have for almost all games!

That's exactly what it does, and it no longer uses execute_string (so no security hole anymore).

Glad you like it!
  • 0

#10 thegreatgaveno@mac.com

thegreatgaveno@mac.com

    GMC Member

  • New Member
  • 178 posts

Posted 21 October 2007 - 10:18 PM

I've been looking for something like this for a long time. Very helpful idea and I look forward to testing it out.
-Gavin
  • 0

#11 Licht

Licht

    GMC Member

  • New Member
  • 23 posts

Posted 21 October 2007 - 11:12 PM

Very nice, thanks a ton!
  • 0

#12 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1070 posts

Posted 22 October 2007 - 03:06 PM

Update! New features:
Actually returns -1 when no instance is found (it didn't before).
Doesn't care if "variable" is not defined in some instances of "obj"
Faster, takes less memory
  • 0

#13 Cheppa

Cheppa

    GMC Member

  • GMC Member
  • 50 posts

Posted 23 October 2007 - 09:29 AM

WOW! This is very useful! Thank you very much!
  • 0

#14 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1070 posts

Posted 24 October 2007 - 06:20 PM

Added instance_furthest functions.
  • 0

#15 Eva unit-01

Eva unit-01

    GMC Member

  • New Member
  • 771 posts

Posted 24 October 2007 - 09:01 PM

Ok so how does this work? i'm all good up until I hit that n thing and then i'm lost, what does that mean and how can these be used? Does it mean it finds the nearest instance of anything or what?

..little confused..
  • 0

#16 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1070 posts

Posted 24 October 2007 - 09:17 PM

With instance_nth_nearest you can find the first closest (the closest, same as instance_nearest). Or you could find the second closest instance. Or the third closest. Or the nth closest instance.

With instance_xth_nearest you can find the nth closest instance of an obj (ex: obj_target) that has a variable (ex: health) equal to a value (ex: 100).

Does that clear it up?
  • 0

#17 Katuko

Katuko

    GMC Member

  • GMC Member
  • 4887 posts

Posted 25 October 2007 - 06:06 PM

This is very useful indeed. Good job. :GM008:
A question though: Does the instance_xth_nearest() accept for example '<100' as the value? I haven't got time to test it right now, but if it does, this will be even more useful. (AI attacking only players low on health, or those with a high score, or whatever.)

<(Katuko)>
  • 0

#18 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1070 posts

Posted 25 October 2007 - 08:06 PM

It's in the works. Never fear, it will support at least these operators (and no execute_string!):
<,>,<=,>=,!=,=
  • 0

#19 Katuko

Katuko

    GMC Member

  • GMC Member
  • 4887 posts

Posted 25 October 2007 - 08:09 PM

That's great. Keep up the good work! :GM008:
  • 0

#20 Kyle_Solo

Kyle_Solo

    GMC Member

  • GMC Member
  • 1070 posts

Posted 25 October 2007 - 08:46 PM

Update! Now supports operators (optional argument)!
Added instance_xth_number!
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users