Raised This Month: $51 Target: $400
 12% 

Random map locations


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 05-26-2013 , 20:27   Random map locations
Reply With Quote #1

It would be possible to pick up a few points of a random map to spawn something?

As weapons?

I searched but could not find and ended up doing using the following form:

PHP Code:
new Floatminbounds [3];
GetEntPropVector (0Prop_Data "m_WorldMins" minbounds);
new 
Floatmaxbounds [3];
GetEntPropVector (0Prop_Data "m_WorldMaxs" maxbounds); 
However it is not good.

Can anyone help me, thanks.
__________________
My Plugins | VIEW HERE | I accept private requests, send me a PM.
Buy respawn | Uber Recall | Grenade drop | Damage Supperssor
Meet the Medic | Disguise Expert | Crazy Jet

CZSBrasil TEAM
rodrigo286 is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 05-26-2013 , 20:35   Re: Random map locations
Reply With Quote #2

Maybe grab a random vector between those points, coupled with a check that it's not TR_PointOutsideWorld with a downwards ray trace.

Or maybe the navigation mesh could contain some useful info.
__________________

Last edited by 11530; 05-26-2013 at 21:03.
11530 is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 05-28-2013 , 06:48   Re: Random map locations
Reply With Quote #3

You can find the spawnpoints.
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 05-30-2013 , 01:26   Re: Random map locations
Reply With Quote #4

However this giving various errors, but have not found the error.

PHP Code:
Create()
{
    new 
Float:FVec[3];
    
GetRandomFlarePostion(FVec[]);

    new 
RFEnt CreateEntityByName("light_dynamic");
    
DispatchKeyValueFloat(RFEnt"spotlight_radius"400.0);
    
DispatchKeyValueFloat(RFEnt"distance"1000.0);
    
Format(corsizeof(cor), "%140 95 203 255"); 
    
DispatchKeyValue(RFEnt"_light"cor); 
    
DispatchKeyValue(RFEnt"brightness""1"); 
    
DispatchKeyValue(RFEnt"style""1");  
    
DispatchSpawn(RFEnt);
    
TeleportEntity(RFEntFVecNULL_VECTORNULL_VECTOR);
    
AcceptEntityInput(RFEnt"TurnOn");
}

stock GetRandomFlarePostion(FVec[])
{
    new 
Float:vec1 GetRandomInt(0999);
    new 
Float:vec2 GetRandomInt(0999);
    new 
Float:vec3 GetRandomFloat(10.020.0);

    if(
vec1 == vec3 && vec1 == vec2 && vec3 == vec2)
    {
        
GetRandomFlarePostion(FVec);
    }
    else if(
TR_PointOutsideWorld(FVec[3])
    {
        
GetRandomFlarePostion(FVec);
    }
    else 
    {
        
FVec[0] = vec1;
        
FVec[1] = vec2;
        
FVec[2] = vec3;
    } 
Thanks for help.
__________________
My Plugins | VIEW HERE | I accept private requests, send me a PM.
Buy respawn | Uber Recall | Grenade drop | Damage Supperssor
Meet the Medic | Disguise Expert | Crazy Jet

CZSBrasil TEAM
rodrigo286 is offline
exCeeder.
Junior Member
Join Date: May 2013
Location: .
Old 05-30-2013 , 02:59   Re: Random map locations
Reply With Quote #5

You have wrote:
PHP Code:
    new Float:vec1 GetRandomInt(0999); 
    new 
Float:vec2 GetRandomInt(0999); 
    new 
Float:vec3 GetRandomFloat(10.020.0); 
You have create a new Float, but with GetRandomInt you get an Integer and not a Float.
That is the Error.

Make that so:
PHP Code:
stock GetRandomFlarePostion(FVec[])

    new 
Float:vec1 GetRandomFloat(0.0999.0);
    new 
Float:vec2 GetRandomFloat(0.0999.0);
    new 
Float:vec3 GetRandomFloat(10.020.0);

    if(
vec1 == vec3 && vec1 == vec2 && vec3 == vec2)
    { 
        
GetRandomFlarePostion(FVec);
    }
    
    else if(
TR_PointOutsideWorld(FVec[3]))
    { 
        
GetRandomFlarePostion(FVec);
    }
    
    else  
    {
        
FVec[0] = float:vec1;
        
FVec[1] = float:vec2;
        
FVec[2] = float:vec3;
    }
    
    return 
FVec[3];

MFG,
eXceeder

Last edited by exCeeder.; 05-30-2013 at 03:24.
exCeeder. is offline
mcpan313
Senior Member
Join Date: Mar 2010
Old 05-30-2013 , 05:38   Re: Random map locations
Reply With Quote #6

native Float:GetRandomFloat(Float:fMin=0.0, Float:fMax=1.0);

My mistake. this range is not 0.0 to 1.0


PHP Code:
stock GetRandomFlarePostion(Float:FVec[3])
{
    
FVec[0] = GetRandomFloat(-999.0999.0);
    
FVec[1] = GetRandomFloat(-999.0999.0);
    
FVec[2] = GetRandomFloat(10.020.0);

    if (
FVec[0] == FVec[2] && FVec[0] == FVec[1] && FVec[1] == FVec[2]
        || 
TR_PointOutsideWorld(FVec))
    {
        
GetRandomFlarePostion(FVec);
    }

better version
__________________
sorry, for my poor english.

Last edited by mcpan313; 05-30-2013 at 10:12.
mcpan313 is offline
Send a message via MSN to mcpan313
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 05-30-2013 , 11:43   Re: Random map locations
Reply With Quote #7

mcpan313, thank you, really worked now it randomly creates the lighting.

Height would be the distance from the floor?

Thanks.

Exceeder, I got some errors but thank you because now I know to properly use the structure.

Thanks for help !
__________________
My Plugins | VIEW HERE | I accept private requests, send me a PM.
Buy respawn | Uber Recall | Grenade drop | Damage Supperssor
Meet the Medic | Disguise Expert | Crazy Jet

CZSBrasil TEAM
rodrigo286 is offline
mcpan313
Senior Member
Join Date: Mar 2010
Old 05-30-2013 , 11:53   Re: Random map locations
Reply With Quote #8

Quote:
Originally Posted by rodrigo286 View Post
Height would be the distance from the floor?
Maybe, but most of the time starts from the underground, you can test it.
__________________
sorry, for my poor english.
mcpan313 is offline
Send a message via MSN to mcpan313
rodrigo286
Veteran Member
Join Date: Sep 2010
Location: Brazil, São Paulo
Old 05-30-2013 , 12:26   Re: Random map locations
Reply With Quote #9

Is to leave it more Random? Because I get the impression that he is more in some parts of the map and others less.

Thanks.
__________________
My Plugins | VIEW HERE | I accept private requests, send me a PM.
Buy respawn | Uber Recall | Grenade drop | Damage Supperssor
Meet the Medic | Disguise Expert | Crazy Jet

CZSBrasil TEAM
rodrigo286 is offline
mcpan313
Senior Member
Join Date: Mar 2010
Old 05-30-2013 , 22:16   Re: Random map locations
Reply With Quote #10

Quote:
Originally Posted by rodrigo286 View Post
Is to leave it more Random? Because I get the impression that he is more in some parts of the map and others less.
I suggest you use it
http://hg.alliedmods.net/cssdm/file/.../dm_preset_spawns.sp
__________________
sorry, for my poor english.
mcpan313 is offline
Send a message via MSN to mcpan313
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 01:57.


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