Indoors detection?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Indoors detection?

Post by Rookie One.pl »

Hi,

I've written a server-side Enemy Territory-style artillery support mod which I'm going to release soon. However, I've come upon a problem - if a room is high enough, you can call artillery support indoors, which is not very realistic, is it? :? I've mostly solved it by tracing the skybox height by this thread:

Code: Select all

trace_skybox_height local.location:
	local.newloc = trace ( local.location[0] local.location[1] 16384 ) ( local.location[0] local.location[1] -16384 )
	local.height = local.newloc[2]
end local.height
Then, the surface is traced by this thread:

Code: Select all

trace_surface local.location:
	local.skybox = waitthread trace_skybox_height local.location
	local.tracedorigin = trace ( local.location[0] local.location[1] (local.skybox - 1) ) ( local.location[0] local.location[1] -16384 )
end local.tracedorigin
But if there's no skybox or there's no space between the skybox and some other brush, like the V2 indoors, you still can call artillery there... :? Anyone got an idea how to fix this without placing some "no-artillery-zone" in the map? I want to have it as much map-independent as possible.

Cheers,

Rookie One
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

trigger

Post by tltrude »

Make a thread for spawning triggers where they can't call the effect. In other words, make it so all they have to do is put in the coordinates, or altitude, and the effect will be turned off.
Tom Trude,

Image
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Well, it's gotten a little messy, but I sorted it out. Damn, it would've been MUCH easier if EA just made skyboxes instead of sky-whatyoumaycallit-thingamabob... It's gotten a bit too map-dependent. :( I set an array in the map script of the origins of the borders of areas where you're not allowed to call the artillery support in and I've got a thread that checks whether an origin is in bounds of any of these areas. Bit elaborate, huh? :P

The only maps I've got problems with are V2 and Algiers as they are the only ones that don't have a flat skybox. :?
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Grassy
First Lieutenant
Posts: 221
Joined: Sun Aug 22, 2004 11:36 am

Post by Grassy »

Here is a real nifty re-usable routine for random artliiery or even flack in the air if you want it. :D
It was found in an SH campaign script. I like it because it is flexible for many uses, I have used it in ending movies with flack going off around bombers flying over the map, and also use it in the below example for a simple area artillery field.
For flack just (un rem) the third dimension marked with a comment.

Code: Select all

//------------------------
axis_artillery:
//------------------------
  waitthread execute_fx_region $alzone1 fx/scriptbazookaexplosion.tik   animate/fx_mortar_dirt.tik   arty_leadin04  1  5  20  800
end

// Automatically generates a repeating effect in a bounding box.
//
// To use:
//			- Place a box that is a "script_model" in the level.
//      - Or spawn it in the map like this;
//         local.clipbrush = spawn script_object
//         local.clipbrush.origin = ( xx xx xx )
//         local.clipbrush setsize ( -xx -xx -xx ) ( xx xx xx )
//         local.clipbrush notsolid
//         local.clipbrush targetname "bob"
//
//			- Give the box a targetname of something. eg; $bob
//			- Spawn a thread for the box, similar to the following:
//				"thread execute_fx_region $bob models/fx/exp_flak_far1.tik  animate/fx_mortar_dirt.tik  arty_leadin04 1  10  30  800"
//
// Arguments:
//      -  First is the name of your box
//      -  Next is the fx tiki file you want to use
//      -  Then a second animation effect like water splash or dirt from a bomb blast
//      -  Next is the sound file you want to play, best to keep this sound short
//      -  The first numerical argument is the minimum time between bursts.
//      -  The second is the maximum time between bursts.
//      -  The third value is the total run time of the event
//      -  The fourth value is a radius damage level if using this routine for artillery
//
//------------------------
execute_fx_region local.box local.fx local.fx2 local.sound local.mindelay local.maxdelay local.duration local.damage:
//------------------------
	local.origin = local.box.origin
	local.mins = local.box.getmins
	local.maxs = local.box.getmaxs
	local.bounds = local.maxs - local.mins
	local.delay = local.maxdelay - local.mindelay
  local.runtime = 1
	while (local.runtime < local.duration )
	{
		local.temp = spawn local.fx
		if ( local.fx2 !=NIL || local.fx2 != NULL )
		{  local.temp2 = spawn local.fx2  }
		
		if ( local.damage !=NIL || local.damage !=NULL )
    {  local.temp.radiusdamage = local.damage  }
    
		if ( local.sound !=NIL || local.sound !=NULL )
    {  local.noise = local.sound  }
    
    local.x = randomint(local.bounds[0]) - (local.bounds[0] / 2)
		local.y = randomint(local.bounds[1]) - (local.bounds[1] / 2)

//remove the rem from the line below for the third dimension for flack usage.
		//local.z = randomint(local.bounds[2]) - (local.bounds[2] / 2)
		
		local.temp.origin = local.origin + (local.x local.y 0 )
    local.temp2.origin = local.temp.origin
    
		//local.temp notsolid
		local.temp playsound local.noise
		local.temp anim start
		local.temp2 anim start
		local.waittime = local.mindelay + randomfloat(local.delay)
		wait local.waittime
		local.temp remove
		local.temp2 remove
		local.runtime++
	}
end
//------------------------//------------------------//------------------------//------------------------
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Nah, I think you misunderstood me. I just wanted the players to prevent calling artillery support indoors, but to let them do this everywhere else, and that script of yours doesn't solve it. :?
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
Master-Of-Fungus-Foo-D
Muffin Man
Posts: 1544
Joined: Tue Jan 27, 2004 12:33 am
Location: cali, United States

Post by Master-Of-Fungus-Foo-D »

put triggers in the doors so when the enter indoors it disables heir abilty to call it? :?
just a suggestion
Image
The Fungus Theme song!!!

Code: Select all

while (local.player istouching self)
Elgan
Site Admin
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post by Elgan »

eek trace up and then up again..hmm

i had a airstrike mod where the plane would fly in drop and fly off using the binox. Also a flak88 shooting thing . Think thats artillery.anyway

I had the bomb fall and blow up on the thing it hit. SO if the target was indoors it would hit the roof.

Maybe find this spot using trace but physicaly drop the bomb anyway. ANd sighttrace. If the player is inside and the target is on the roof they are outside and it wont work. THis might work for v2 anyway. If they are looking through a window they might be able to call is still. But wudnt u be able to call the coors from a window?. Also if u called a coord from inside in real life the bomb would hit the foor if it was a coord for inside. get me?


Another idea. Find the skybow by tracing outside down to the top of the map? Then thats the height. right now trace up from that player/ If its not the skybow then maybe ur inside? if it is a flat skybox u cud just trace the heights and even sighttrace the player and the z of the sky. if it cant see down from the sky onto the player they are in somthing like a room.

hope any of this helps!.
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Master-Of-Fungus-Foo-D wrote:put triggers in the doors so when the enter indoors it disables heir abilty to call it? :?
just a suggestion
Sure... And how do you know if the player leaves or enter the building without spawning another trigger? :?
Elgan wrote:eek trace up and then up again..hmm
Nah, it traces from 16384 Z to the first solid surface, which is usually skybox. Then it traces from skybox height - 1 to -16384 to get the surface origin.
Elgan wrote:I had the bomb fall and blow up on the thing it hit. SO if the target was indoors it would hit the roof.

Maybe find this spot using trace but physicaly drop the bomb anyway.
Sure, but remember, that there's no skybox at V2 indoors area and the roof of for instance the garage is the first solid surface the tracing encounters. So it would drop bomb inside the building anyway. And if you called a fire mission outside the bombs would explode at the top of the skybox, which would be even worse. :?
Elgan wrote:ANd sighttrace. If the player is inside and the target is on the roof they are outside and it wont work. THis might work for v2 anyway. If they are looking through a window they might be able to call is still. But wudnt u be able to call the coors from a window?. Also if u called a coord from inside in real life the bomb would hit the foor if it was a coord for inside. get me?
Sighttracing is quite useless as it's already done when the player clicks his binoculars. And on maps with normal skybox, like Destroyed village, when you call a fire mission somewhere near a building, the bombs sometimes hit nearby buildings' roofs. It's just making sure you can't call a fire mission inside a building. I want to make it work like it does in Wolfenstein Enemy Territory - play as a field ops to see how it works in there.
Elgan wrote:Another idea. Find the skybow by tracing outside down to the top of the map? Then thats the height. right now trace up from that player/ If its not the skybow then maybe ur inside? if it is a flat skybox u cud just trace the heights and even sighttrace the player and the z of the sky. if it cant see down from the sky onto the player they are in somthing like a room.
Don't forget that skybox is not always of the same thickness. It can be 0 units thick, but it can also be 128. How can you be sure that what you've traced actually is the skybox? It would be much simpler if tracing would skip it like it does with grates and windows. :?
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

this is a bit over my head to offer an idea, but can't tell the trace to go from the skybox, a certain amount of units down from there, maybe 128 to be safe, and then start a trace to the player? is that possible?
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

Imagine that a roof of a building is 1 unit down from a skybox which is 8 units thick. And what you get? You are able to call artillery into the building. :?
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

it's all i can think of, unless there's more commands i think you're stuck with using that or trace from skybox.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Post Reply