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 , 14:28   Re: Creating a room dynamically off the map
Reply With Quote #1

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 #2

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
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