UGX-Mods

Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: MrGVSV on August 09, 2016, 02:32:58 am

Title: Fading Brushmodels
Post by: MrGVSV on August 09, 2016, 02:32:58 am
I just wrote a script (it's based around MakeCents' awesome window breakables prefab link: https://ugx-mods.com/forum/index.php?topic=4602.0) that lets me simulate glass shattering upon shooting at it. However, once the brushmodels get launched in whatever direction,they still have their collision which makes navigating passed them in-game difficult. Any way I could remove their collision and/or have them fade away (the delete() function is just so ugly).

This is the code I thread to in my mapname.gsc
Code Snippet
Plaintext
breakStuffTrigger()
{
break_trigger_array = getEntArray("break_trigger", "targetname");
for (i = 0; i<break_trigger_array.size; i++)
{
break_trigger_array[i] thread breakStuff();
}
}

breakStuff()
{
self waittill("trigger");
stuff_break = getEntArray(self.target, "targetname");
self playsound("glass_00");
for(i=0; i<stuff_break.size; i++){
if(isdefined(stuff_break[i].script_sound)){
stuff_break[i] playsound(stuff_break[i].script_sound);
}else{
stuff_break[i] playsound("wallcrash");
}
stuff_break[i] PhysicsLaunch( stuff_break[i].origin , (randomintrange(-10000,10000),randomintrange(-100000,10),10000) );
}
wait 5;
for(p=0;p<stuff_break.size;p++){
stuff_break[p] delete();
}
self delete();
}

(Side note: the playsound functions don't seem to work :-\) Any help is appreciated!
Title: Re: Fading Brushmodels
Post by: death_reaper0 on August 09, 2016, 07:10:52 pm
for the sound try
Code Snippet
Plaintext
playsoundatposition ("glass_00", self.origin);
Title: Re: Fading Brushmodels
Post by: BluntStuffy on August 09, 2016, 07:36:56 pm
Quote
Any way I could remove their collision
Code Snippet
Plaintext
stuff_break[i] notsolid();



You cant have them fade out, maybe you could let them sink into the ground before you delete them. You could also try this, from animscripts\death.gsc:

Code Snippet
Plaintext
gib_delete()
{
wait( 10 + RandomFloat( 5 ) );
for( i = 0; i < 100; i++ )
{
if( !self IsBeingWatched() )
{
break;
}

wait( 1 );
}
self Delete();
}
Title: Re: Fading Brushmodels
Post by: vinnyz500 on August 09, 2016, 11:05:18 pm
Or to put it simply, make those brush models non colliding... Right click in 3D view and click non colliding
EDIT: If collision is a problem before breaking, make a clip and delete it or move it when you break the glass