| Author |
Topic: HowTo: Rotate Effects (Example Lighthouse) |
| Sgt_Skywalker |
General Member Since: Mar 27, 2004 Posts: 35 Last: Dec 16, 2005 [view latest posts] |
|
|
|
Category: CoDUO Mapping Posted: Tuesday, Feb. 15, 2005 01:53 pm |
 |
Hi admins,
feel free to bring this kinda tutorial to your tutorial section if you like it. Sorry if you find errors or if my explanations sound strange. I'm not a native english speaker.
Okay, we'll start...
Searching alot for some neat effects like dynamic lights is very frustrating if you map for CoD. The reason for this is: CoD does not support almost any dynamic effect as you know it from Quake 3. Many techniques for implementing effects look quite different. Unfortunately neither Infinity Ward nor Gray Matter present some detail documentation for the use of shaders, effects or any "CoD-specialities". Maybe one day we will get some more info from them *hint-hint* :casanova:
Therefor all the informations in this tutorial were found out by studying the pk3 files that came with the game.
Make a lighthouse:
First we open our map in Graydiant and create a script_model in our world. I use the original xmodel from the SP-map Sicily1. Its called "xmodel/o_br_prp_lhouse_lamp".
You could also create a script_brushmodel. The most important is next to open your entity editor (key "N") while your new script_model / script_brushmodel is still selected.
Add a key "targetname" and give it the value lighthouse_light. This targetname will reappear later in your script file. That's it for Radiant. Save your map and compile it.
For convenience reasons I always create a startup script (e.g. c:call of dutyuomapsmpmymap.gsc) with the following content:
Code:
| // Made by Sgt. Skywalker
// Copyright 2005
main() {
ambientPlay("ambient_mp_harbor");
game["allies"] = "american";
game["axis"] = "german";
game["attackers"] = "axis";
game["defenders"] = "allies";
game["american_soldiertype"] = "airborne";
game["american_soldiervariation"] = "normal";
game["german_soldiertype"] = "german_waffen";
game["german_soldiervariation"] = "normal";
mapsmp_load::main();
mapsmpmymap_fx::main(); //kick off fx script here
|
|
So I have a second script (e.g. c:call of dutyuomapsmpmymap_fx.gsc) where all the interesting stuff happens:
Code:
|
// Made by Sgt. Skywalker
// Copyright 2005
main()
{
level._effect["light_beam"] = loadfx ("fx/map_sicily1/v_light_lighthouse.efx");
// which effect will we use
wait(2); // wait 2 seconds to get some cpu threads
level thread lighthouse_light(); // call thread "lighthouse_light"
}
lighthouse_light() // the fx thread
{
lighthouse_lights = getentarray("lighthouse_light","targetname");
// create an array of all script_models and script_brushmodels
// which targetname is lighthouse_light
for ( i = 0; i < lighthouse_lights.size; i++ ) // loop the whole time
{
playfxontag( level._effect["light_beam"], lighthouse_lights, "tag_light" ); // play fx
lighthouse_lights thread lighthouse_move(); // call thread lighthouse_light_move
wait(0.2); // wait 0,2 seconds or it will look silly if 10 lighthouses rotate identically
}
}
lighthouse_light_move() // move the fx
{
while(1) // yet another loop
{
self rotateto((0,45,0),4,1,1); // rotate within 4 seconds by 45 degrees on y-axis
self waittill("rotatedone"); // wait until the rotation is done
self rotateto((0,-45,0),4,1,1); // Play it again, Sam
self waittill("rotatedone"); // yet another waiting time
}
}
|
|
Syntax of self rotateto((x,y,z),a,b,c):
x = rotate around x-axis
y = rotate around y-axis
z = rotate around z-axis
a = time in secs how long rotation will take
b = time in secs for accelleration
c = time in secs for decelleration
I hope you like it.
sincerely Sgt. Skywalker
Ingame it will look like this:
 |
 |
|
|
| O-NM-Elmo |
 |
General Member Since: May 20, 2004 Posts: 57 Last: Jul 22, 2005 [view latest posts] |
|
|
|
|
| Sgt_Skywalker |
General Member Since: Mar 27, 2004 Posts: 35 Last: Dec 16, 2005 [view latest posts] |
|
|
|
|
| O-NM-Elmo |
 |
General Member Since: May 20, 2004 Posts: 57 Last: Jul 22, 2005 [view latest posts] |
|
|
|
|
| Hercules |
 |
General Member Since: Jan 23, 2005 Posts: 775 Last: Apr 26, 2011 [view latest posts] |
|
|
 |
|
|
| Sgt_Skywalker |
General Member Since: Mar 27, 2004 Posts: 35 Last: Dec 16, 2005 [view latest posts] |
|
|
|
Category: CoDUO Mapping Posted: Wednesday, Feb. 16, 2005 05:05 pm |
 |
sorry sorry sorry guys...
it seems pasting into the thread produced some strange errors..
first you have to place it to your uomapsmp directory. it will not work in CoD-"Classic".
so please try this for your mymap_fx.gsc:
main()
{
level._effect["light_beam"] = loadfx ("fx/map_sicily1/v_light_lighthouse.efx");
wait(2);
level thread lighthouse_light();
}
lighthouse_light()
{
lighthouse_lights = getentarray("lighthouse_light","targetname");
for ( i = 0; i < lighthouse_lights.size; i++ )
{
playfxontag( level._effect["light_beam"], lighthouse_lights , "tag_light" );
lighthouse_lights thread lighthouse_light_move();
wait(0.2);
}
}
lighthouse_light_move()
{
while(1)
{
self rotateto((0,45,0),4,1,1);
self waittill("rotatedone");
self rotateto((0,-45,0),4,1,1);
self waittill("rotatedone");
}
}
i hope this works fine for you
me culpa....
cheers Sg.t Skywalker |
 |
|
|
| O-NM-Elmo |
 |
General Member Since: May 20, 2004 Posts: 57 Last: Jul 22, 2005 [view latest posts] |
|
|
|
|
| StrYdeR |
General Member Since: May 11, 2004 Posts: 11671 Last: Oct 7, 2021 [view latest posts] |
|
|
 |
 |
|
|
| O-NM-Elmo |
 |
General Member Since: May 20, 2004 Posts: 57 Last: Jul 22, 2005 [view latest posts] |
|
|
|
|
| Sgt_Skywalker |
General Member Since: Mar 27, 2004 Posts: 35 Last: Dec 16, 2005 [view latest posts] |
|
|
|
Category: CoDUO Mapping Posted: Thursday, Feb. 17, 2005 04:49 pm |
 |
stryder,
i'd love to see my tu in your gorgeous tut's section
thanks alot.
cheers
Sgt. Skywalker |
 |
|
|
|
|
mp_TempleCall of Duty: Mods: Multiplayer (624.12Kb)
|