Raised This Month: $ Target: $400
 0% 

Spawn Entity at Random Point of the Map


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mysty
Member
Join Date: Oct 2015
Location: FUCK OFF
Old 12-10-2015 , 08:17   Spawn Entity at Random Point of the Map
Reply With Quote #1

I'm trying to make an entity spawn somewhere random on the map that is open, in other words somewhere where the player can touch it. Is this possible?
mysty is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 12-10-2015 , 10:59   Re: Spawn Entity at Random Point of the Map
Reply With Quote #2

Quote:
Originally Posted by mysty View Post
I'm trying to make an entity spawn somewhere random on the map that is open, in other words somewhere where the player can touch it. Is this possible?
A quick idea would be to save the position of random players every X seconds for Y times. Then you would have random spawn points for your entity and you would be 100% sure that player can touche it.
__________________
Want to check my plugins ?
Arkarr is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 12-10-2015 , 11:16   Re: Spawn Entity at Random Point of the Map
Reply With Quote #3

Also include locations of health/ammo.

Sometimes those can be out-of-map by bad map makers, so it depends on what you're trying to do whether that's an option or not.
__________________

Last edited by Chdata; 12-10-2015 at 11:16.
Chdata is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 12-10-2015 , 12:17   Re: Spawn Entity at Random Point of the Map
Reply With Quote #4

Use a trace with random angles? I'm 100% sure this works. But in my opinion it's better todo it with manually set spawns, cuz this would only work 100% on 100% open areas.
__________________
zipcore is offline
mysty
Member
Join Date: Oct 2015
Location: FUCK OFF
Old 12-10-2015 , 12:39   Re: Spawn Entity at Random Point of the Map
Reply With Quote #5

Quote:
Originally Posted by Arkarr View Post
A quick idea would be to save the position of random players every X seconds for Y times. Then you would have random spawn points for your entity and you would be 100% sure that player can touche it.
Quote:
Originally Posted by Chdata View Post
Also include locations of health/ammo.

Sometimes those can be out-of-map by bad map makers, so it depends on what you're trying to do whether that's an option or not.
thanks!
mysty is offline
jess
Member
Join Date: Aug 2015
Location: mb
Old 12-10-2015 , 16:18   Re: Spawn Entity at Random Point of the Map
Reply With Quote #6

A trick that I've seen used in some plugins, such as those no-standing-still ones, to prevent camping, is they create entities every so often on a players location, or store the location in an array for a set amount of time - or permanently. You can even set intervals, so that you don't record locations on top of each other. The other thing you can do is cycle through the entities and grab their x/y/z coordinates, but then again, you can run into issues with the entities being outside the playable area.
__________________
L4D2 Loot RPG
Steam
jess is offline
Chdata
Veteran Member
Join Date: Aug 2012
Location: Computer Chair, Illinois
Old 12-12-2015 , 13:01   Re: Spawn Entity at Random Point of the Map
Reply With Quote #7

^ Pretty much what Arkarr suggested with taking locations of players.
__________________
Chdata is offline
thecount
Veteran Member
Join Date: Jul 2013
Old 12-12-2015 , 13:08   Re: Spawn Entity at Random Point of the Map
Reply With Quote #8

This probably belongs in the scripting category, but to concur again, the way I usually use is to save players' location in an array and once that array is filled, start from the beginning to update new locations.

Last edited by thecount; 12-12-2015 at 13:09.
thecount is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 12-12-2015 , 23:27   Re: Spawn Entity at Random Point of the Map
Reply With Quote #9

Sampling player locations or pickups is your best bet. With enough data it will be decently random but also in trafficked areas.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.
friagram is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:27.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode