
| Forum: |
All Forums : Call of Duty 4 |
| Category: |
CoD4 MP Mapping CoD 4 mapping and level design for multiplayer.
|
| Moderators: |
foyleman, Foxhound, StrYdeR, techno2sl, batistablr, Welshy, Rasta, supersword, batistablr, playername, NovemberDobby |
|
|
| Author |
Topic: Destroyable target |
| glitch10k |
General Member Since: May 26, 2008 Posts: 14 Last: Feb 13, 2010 [view latest posts] |
|
|
|
|
| cskiller86 |
 |
General Member Since: Nov 23, 2009 Posts: 180 Last: Mar 16, 2010 [view latest posts] |
|
|
|
Category: CoD4 MP Mapping Posted: Monday, Feb. 8, 2010 05:45 am |
 |
I don't know how advanced you are with mapping and scripting, so if there's something you don't understand feel free to ask.
Well, you could make it so the target is made of a few squares as script_brushmodel (actually, squares with jagged and irregular edges), and each of it would have its own trigger_damage. Don't make too many squares because it could impact on PC performance.
Name the trigger_damage: target_trigger and then connect each trigger to its corresponding script_brushmodel (this is important !!!).
Also, I suggest the target to be renewed when you press a button. Maybe a plaster wall could come down in front of the target, so you don't see when the pieces reappear (for realism). If you like this idea, tell me and I'll change the script.
As for script it would be something like:
Code: main()
{
breakfx = loadfx ("misc/somefx"); //insert fx name and path here; you need an FX to cover the disappearing of the brush
piece_trigger = getentarray("target_trigger", "targetname");
for(i=0; i<piece_trigger.size;i++)
piece_trigger[i] thread break(breakfx);
}
break(breakfx)
{
piece_damage = 0;
piece_health = 10;
piece_broken = 0;
while(!piece_broken)
{
self waittil("damage", amount);
piece_damage+=amount;
if (piece_damage>piece_health)
{
piece_broken = 1;
self.target hide();
self hide();
wait 60; //waits for 60 secs before the pieces reappear
self.target show();
self show();
}
}
playFX(breakfx, self.origin);
//you could also play a sound everytime you hit the target
//self playsound("target_break");
} |
 |
|
|
| glitch10k |
General Member Since: May 26, 2008 Posts: 14 Last: Feb 13, 2010 [view latest posts] |
|
|
|
|
| [ZCT]Titan |
 |
General Member Since: Feb 23, 2009 Posts: 112 Last: Feb 8, 2010 [view latest posts] |
|
|
 |
|
|
| DeekCiti |
 |
General Member Since: Mar 13, 2008 Posts: 838 Last: Mar 16, 2010 [view latest posts] |
|
|
|
Category: CoD4 MP Mapping Posted: Monday, Feb. 8, 2010 11:37 pm |
 |
glitch10k writes...Quote: Tried out your code. don't know what i did wrong but kept getting a bad syntax...i'm kinda new to scripting to think you could simplify it a little.. maybe without sound and just the basics to build on. thx
You should post the line number or at least what "bad syntax" is causing the problem.
Press ( SHIFT + tilde ) to look at the full console. |
 |
|
|
| glitch10k |
General Member Since: May 26, 2008 Posts: 14 Last: Feb 13, 2010 [view latest posts] |
|
|
|
|
| glitch10k |
General Member Since: May 26, 2008 Posts: 14 Last: Feb 13, 2010 [view latest posts] |
|
|
|
|
| DeekCiti |
 |
General Member Since: Mar 13, 2008 Posts: 838 Last: Mar 16, 2010 [view latest posts] |
|
|
|
|
| glitch10k |
General Member Since: May 26, 2008 Posts: 14 Last: Feb 13, 2010 [view latest posts] |
|
|
|
|
| cskiller86 |
 |
General Member Since: Nov 23, 2009 Posts: 180 Last: Mar 16, 2010 [view latest posts] |
|
|
|
Category: CoD4 MP Mapping Posted: Tuesday, Feb. 9, 2010 05:35 am |
 |
What model will you use ?
Anyway, turn each of the models into script_model (you don't have to name them).
Next, for each of the targets, create a trigger_damage named trigger4target that has about the same dimensions as the target.
Next, connect each trigger to its corresponding script_model (first select trigger, then the target and press W).
Code: main()
{
target_trigger = getentarray("trigger4target", "targetname");
for(i=0; i<piece_trigger.size;i++)
target_trigger[i] thread targetdown();
}
targetdown()
{
target_damage = 0;
target_health = 10;
target_down = 0;
while(!target_down)
{
self waittil("damage", amount);
target_damage+=amount;
if (target_damage>target_health)
{
target_down = 1;
self.target rotateroll(90, 1);
self hide();
wait 60; //waits for 60 secs before the target pops back up
self.target rotateroll(-90, 1);
self show();
}
}
}
NOTES: - depending on the targets' rotation on the UP axis, you may have to use rotatepitch instead of rotateroll in these lines
Code: self.target rotateroll(90, 1);
self.target rotateroll(-90, 1);
- the same applies to the angle; if your target falls towards you, then you'll have to switch 90 with -90 in the first line, and -90 with 90 in the second one
- if you decide to use brushes to make your target, then you'll need to add an origin brush at the base of the target, select all the pieces and that origin brush and transform them into script_brushmodel (models rotate on their own center, so they don't need an origin brush) |
 |
|
|
|
Members Online
| vT-Ownage |
[Today] |
  |
1 Members and 3 Guests
|
|