Raised This Month: $85 Target: $400
 21% 

Random locations generator


Post New Thread Reply   
 
Thread Tools Display Modes
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 01-12-2018 , 12:40   Re: Random locations generator
Reply With Quote #21

Quote:
Originally Posted by edon1337 View Post
Would I be able to use this to spawn players in the highest map point but making sure they'll fall into a safe place (not in water or any other unsafe zone) also to have a minimal distance (enough to not stuck a player into another) between players?
Yes, but have two ways of use this

1. Caching spawns positions like csdm: Create spawns -> Cache -> Use in a static (Read spawns.txt file)
2. Dynamically creating and use without store spawns.

I prefer first way so you can edit spawn points, removing that you do not want. And finally store removed spawns to not be generated again.
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar,get_pcvar_num(pCvar) ? 1); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-12-2018 , 14:08   Re: Random locations generator
Reply With Quote #22

Quote:
Originally Posted by ^SmileY View Post
Yes, but have two ways of use this

1. Caching spawns positions like csdm: Create spawns -> Cache -> Use in a static (Read spawns.txt file)
2. Dynamically creating and use without store spawns.

I prefer first way so you can edit spawn points, removing that you do not want. And finally store removed spawns to not be generated again.
I need the spawn points to be generated automatically, as there won't be just one map, I'm already using the manual way of storing origins in an external file.
__________________
Counter-Strike Battle Royale
[===============]

Pre-Order it, now!
edon1337 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: Brazil, SP
Old 01-13-2018 , 20:25   Re: Random locations generator
Reply With Quote #23

It creates random locations as obviously, it says. Can be in non-sense point. The first way is better to me because you can select a point where you want, like in the corners, that's the best position to be respawned (in DM mod, I mean). This include is pretty useful for plugins like Respawn Boxes with bonus or anything else that needs to be respawned randomly.
__________________
EFFx is offline
Send a message via Skype™ to EFFx
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 01-15-2018 , 09:16   Re: Random locations generator
Reply With Quote #24

You can use this once per map, dump the results and build your custom respawns file.
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-15-2018 , 09:53   Re: Random locations generator
Reply With Quote #25

Quote:
Originally Posted by joropito View Post
You can use this once per map, dump the results and build your custom respawns file.
How would I implement a method to spawn players in the highest map point in your plugin?
I have this stock, but it doesn't work correctly.
PHP Code:
stock get_max_z(indexFloat:point[3])
{
    new 
Float:aimorigin[3], Float:origin[3], Float:vangles[3], Float:fov
    
    
// you'll want to replace aimorigin with the victim's origin
    
fm_get_aim_origin(indexaimorigin)
    
    
pev(indexpev_originorigin)
    
pev(indexpev_view_ofsvangles// view offset for killer's eye's origin
    
origin[0] += vangles[0]
    
origin[1] += vangles[1]
    
origin[2] += vangles[2]
    
    
pev(indexpev_fovfov)
    
fov /= 1.5 // for some reason this works well, but theoretically it should be 2.0
    
    
pev(indexpev_v_anglevangles
    
vangles[0] *= -1.0 // this is done because looking up angle < 0, level angle = 0, looking down angle > 0
    
    
point[0] = aimorigin[0]
    
point[1] = aimorigin[1]
    
// magic calculations brought to you by my brain + some guesswork
    
point[2] = aimorigin[2] + get_distance_f(aimoriginorigin) * floatsin(fov M_PI 360) / floatsin((180 vangles[0] - fov) * M_PI 360)
    
    
// this is better than nudging the entity straight down
    // it will do a traceline between the killer's head and the desired
    // point, and it will stop when it hits a wall or ceiling or whatever
    
new tr create_tr2()
    
engfunc(EngFunc_TraceLineoriginpointDONT_IGNORE_MONSTERSindextr)
    
get_tr2(trTR_vecEndPospoint)
    
free_tr2(tr)
    
    
    
// just in case we end up outside the map, move the point closer to the killer
    
new pc engfunc(EngFunc_PointContentspoint)
    while(
pc == CONTENTS_SOLID || pc == CONTENTS_SKY)
    {
        
point[0] += (origin[0] - point[0]) * 0.05
        point
[1] += (origin[1] - point[1]) * 0.05
        point
[2] += (origin[2] - point[2]) * 0.05
        pc 
engfunc(EngFunc_PointContentspoint)
    }

EDIT: OMG I tested the plugin, and it's working exactly how I need it to, the only thing I need to implement is that stock. I'm trying to re-make Player Unknown's Battlegrounds so I need to find the highest 'z' point, could help me please?

EDIT2: There's also times where you get spawned in places where you get stuck, but rarely. Tested in de_dust2 and de_mon. Most likely corners.
__________________
Counter-Strike Battle Royale
[===============]

Pre-Order it, now!

Last edited by edon1337; Yesterday at 13:03.
edon1337 is offline
Reply


Thread Tools
Display Modes

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 04:20.


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