Call of Duty 4: Breakable Windows: Difference between revisions
Jump to navigation
Jump to search
(New page: {{warning_forpro}} Image:Nutshell.png This tutorial will explain how to add breakable glass with a certain amount of damage in your maps (as in SP level Launch Facility). ''By -=FD=-'...) |
mNo edit summary |
||
(2 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
[[Category:Call of Duty 4]] | |||
[[Category:Modtools]] | |||
[[Category:Radiant]] | |||
[[Category:Advanced Editing]] | |||
{{warning_forpro}} | {{warning_forpro}} | ||
[[Image:Nutshell.png]] This tutorial will explain how to add breakable glass with a certain amount of damage in your maps (as in SP level Launch Facility). | [[Image:Nutshell.png]] This tutorial will explain how to add breakable glass with a certain amount of damage in your maps (as in SP level Launch Facility). | ||
Line 23: | Line 27: | ||
==Scripting== | ==Scripting== | ||
*Create a new file under /raw/maps/mp/ called _breakglass.gsc and have the following in: | |||
<pre> | <pre> | ||
main() | main() | ||
Line 50: | Line 56: | ||
totaldamage+=amount; | totaldamage+=amount; | ||
if(totaldamage>targetdamage) | if(totaldamage>targetdamage) | ||
windowbroken=1; | windowbroken=1; | ||
} | } | ||
// self playsound("glass_break"); | // self playsound("glass_break"); | ||
PlayFX(windfx, self.origin ); | PlayFX(windfx, self.origin ); | ||
for(j=0;j<broken.size;j++) | |||
broken[j] show(); | |||
window delete(); | window delete(); | ||
self delete(); | self delete(); | ||
} | }</pre> | ||
</pre> | |||
In your main mp GSC, after ''maps\mp\_load::main();'' add this line: | |||
maps\mp\_breakglass::main(); | |||
Now, add this to your Zone File: | |||
rawfile,maps/mp/_breakglass.gsc | |||
== Optional == | == Optional == |
Latest revision as of 23:20, 22 February 2012
This tutorial assumes that you already know how to create, compile & create GSCs,CSVs & FastFiles for your maps
This tutorial will explain how to add breakable glass with a certain amount of damage in your maps (as in SP level Launch Facility).
By -=FD=-
In Radiant
- Make a trigger_damage the same size as your window
- Give your trigger_damage the key/values:
targetname windtrig
- Make your UNBROKEN window, convert it to a script_brushmodel
- Unselect everything, Select the trigger then the window and press W
- If you want to, make the broken bits of your window, convert them to a script_brushmodel
- Select all the broken bits and give them the targetname 'brokenwindow1' (increment the number for each window)
- Save, and add the script into one of your .gsc files (preferrably mp_mapname_fx.gsc but I think it would work in mp_mapname.gsc)
- Add this line to your zone file:
fx,props/car_glass_large
Scripting
- Create a new file under /raw/maps/mp/ called _breakglass.gsc and have the following in:
main() { windfx = loadfx ("props/car_glass_large"); windtrigs = getentarray("windtrig","targetname"); for(i=0;i<windtrigs.size;i++) windtrigs[i] thread dowindow(i,windfx); } dowindow(windnumber,windfx) { window = getent(self.target,"targetname"); totaldamage=0; targetdamage=100; windowbroken=0; broken = getentarray("brokenwindow"+(windnumber+1),"targetname"); for(j=0;j<broken.size;j++) { broken[j] notsolid(); broken[j] hide(); } window show(); while(!windowbroken) { self waittill ("damage",amount); totaldamage+=amount; if(totaldamage>targetdamage) windowbroken=1; } // self playsound("glass_break"); PlayFX(windfx, self.origin ); for(j=0;j<broken.size;j++) broken[j] show(); window delete(); self delete(); }
In your main mp GSC, after maps\mp\_load::main(); add this line:
maps\mp\_breakglass::main();
Now, add this to your Zone File:
rawfile,maps/mp/_breakglass.gsc
Optional
Create a soundalias file for the sound, and uncomment / add your soundname to the self playsound line
If you want to change how much damage it takes to break, change 'targetdamage' in the 'dowindow' routine to another number, at the moment it takes about 3 shots from most weapons.