Raised This Month: $ Target: $400
 0% 

Creating a room dynamically off the map


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 07-05-2006 , 13:31   Creating a room dynamically off the map
Reply With Quote #1

Basically I'd like to create a room that I could teleport players to...

But I want to be able to create the room for any given map (so make sure the room isn't planted somewhere where the map is in use)

Is this possible?

Thanks,
Josh
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 07-05-2006 , 14:24   Re: Creating a room dynamically off the map
Reply With Quote #2

Pick some random location, then scan upward and check PointContents each time. Once you hit a good spot, scan around it and if there's anything around it pick a new point.

Once you find enough space, make a bunch of func_walls or something to make a small room.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 07-05-2006 , 14:28   Re: Creating a room dynamically off the map
Reply With Quote #3

Think there is a code example anywhere?
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 07-05-2006 , 15:17   Re: Creating a room dynamically off the map
Reply With Quote #4

Quote:
Originally Posted by Geesu
Think there is a code example anywhere?
Here's a pseudo implementation of it minus the room (I dunno how big you want it)

Code:
// dist between center and shortest point of each wall #define ROOM_RADIUS 100.0 // the real thing is 4096.0, but we don't really want to go off the map #define MAP_MAX 3800.0 fnFindLocation(Float:vVec[3]) {     static Float:vOrigin[3],iContents         vOrigin[0] = random_float(-MAP_MAX,MAP_MAX)     vOrigin[1] = random_float(-MAP_MAX,MAP_MAX)         vOrigin[2] = -MAP_MAX         do     {         if(vOrigin[2] > MAP_MAX)             return fnFindLocation(vVec)                     vOrigin[2] += 10.0         iContents = PointContents(vOrigin)     }     while(iContents != CONTENTS_EMPTY)         vOrigin[2] += 200.0     if(PointContents(vOrigin) != CONTENTS_EMPTY)         return fnFindLocation(vVec)     vOrigin[2] -= 160.0         for(new iCount = 0;iCount < 2;iCount++)     {         vOrigin[iCount] += ROOM_RADIUS         if(PointContents(vOrigin) != CONTENTS_EMPTY)             return fnFindLocation(vVec)         vOrigin[iCount] -= ROOM_RADIUS                 vOrigin[iCount] -= ROOM_RADIUS         if(PointContents(vOrigin) != CONTENTS_EMPTY)             return fnFindLocation(vVec)         vOrigin[iCount] += ROOM_RADIUS     }             vVec = vOrigin         return PLUGIN_CONTINUE }
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 07-05-2006 , 15:18   Re: Creating a room dynamically off the map
Reply With Quote #5

Awesome thanks, this will get me started Is there a downside to going off the map ??
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 07-05-2006 , 15:41   Re: Creating a room dynamically off the map
Reply With Quote #6

Quote:
Originally Posted by Geesu
Awesome thanks, this will get me started Is there a downside to going off the map ??
No, I guess it should really be

Code:
// dist between center and shortest point of each wall #define ROOM_RADIUS 100.0 // limits of the map #define MAP_MAX 4096.0 - ROOM_RADIUS
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
VEN
Veteran Member
Join Date: Jan 2005
Old 07-06-2006 , 15:52   Re: Creating a room dynamically off the map
Reply With Quote #7

I'd simply trace a few lines instead of looping.
VEN is offline
Geesu
Veteran Member
Join Date: Mar 2004
Location: Cincinnati, OH
Old 07-06-2006 , 15:52   Re: Creating a room dynamically off the map
Reply With Quote #8

Quote:
Originally Posted by VEN
I'd simply trace a few lines instead of looping.
Interesting... not a bad idea...
__________________
Need war3ft help? DO NOT PM ME... Check the forums
Geesu is offline
Send a message via AIM to Geesu Send a message via MSN to Geesu
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 07-06-2006 , 17:43   Re: Creating a room dynamically off the map
Reply With Quote #9

Quote:
Originally Posted by VEN
I'd simply trace a few lines instead of looping.
I don't think that would work well, I haven't had good results with trace_line when using it off the map.

If it does though that's a good idea.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
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 08:02.


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