MODSon[line.com] Wiki - Beta 1.0
Call of Duty: Script
From MODSonline Wiki
Contents |
[edit] Introduction
Script in Call of Duty are in two part:
- The map script_model;
- The script called when the map is ran.
[edit] script_model
This is a special type of object in Radiant that is non-colliding and not solid. It doesn't represent anything else than the origine of the event described in the script. The script_model needs to carry the pair (Key-Value) targetname and a name of your choice.
[edit] The script file
As in the mapname.gsc file, this is a file that is called upon running the map. The event contained within the script file can be permanent or temporary. It can run once or can be repeated over time. Example of script are: light controled by the player, sound of a door when opened or closed, airplane flying over the map, or even a wall to blow up.
REMEMBER THAT A SCRIPT FILE IS A TEXT FILE WITH A SPECIFIC EXTENSION
[edit] Location of the files
The script file should be placed in the following folder:
./Call of Duty/main/maps/mp/
[edit] Example: Sound of an engine
- Add a model to the map and a script_model. Give the script_model the Key: targetname and the Value: enginesound.
- Create a new script file, called mysound.gsc. Add to it the following:
main()
{
thread engine_sound();
}
engine_sound()
{
alert = getentarray("enginesound","targetname");
while(1)
{
for(i=1;i<alerts.size;i++)
{
alert[0].playsound("T34engine");
alert[0].playsound("T34engine");
wait(3);
self thread engine_sound();
return;
}
}
}
- Add the following line to the mapname.gsc file:
maps/mp/mysound::main();
right after the following:
maps/mp/_load::main();
