Page 1 of 1
Indoors detection?
Posted: Sun Feb 13, 2005 3:02 pm
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
trigger
Posted: Sun Feb 13, 2005 9:26 pm
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.
Posted: Sun Feb 13, 2005 9:37 pm
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 sky
boxes 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?
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.

Posted: Mon Feb 14, 2005 3:45 pm
by Grassy
Here is a real nifty re-usable routine for random artliiery or even flack in the air if you want it.
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
//------------------------//------------------------//------------------------//------------------------
Posted: Mon Feb 14, 2005 8:13 pm
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.

Posted: Mon Feb 14, 2005 9:45 pm
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
Posted: Tue Feb 15, 2005 12:29 am
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!.
Posted: Tue Feb 15, 2005 10:26 am
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 sky
box, 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.

Posted: Tue Feb 15, 2005 8:53 pm
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?
Posted: Tue Feb 15, 2005 9:09 pm
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.

Posted: Tue Feb 15, 2005 9:11 pm
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.