| Author |
Topic: Moving map objects |
| Anarchic |
General Member Since: Jan 23, 2013 Posts: 13 Last: May 31, 2013 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Sunday, Mar. 31, 2013 09:52 pm |
 |
The map Chelm by Oraco has a script which randomly moves several selected objects into place or it hides them under the map. Is it possible apply this same type of scripting objects already built into a map? Say a tank or crates. I would like to scripting this so that maps seem a bit different each time.
First is it possible and second how do you specify which objects to move. Admittedly I'm not the most accomplished scripter.
Code from Chelm:
/==============================Random passage/element starts=========================
/* oraco - Preset obstacles loaded into the map outside players view will be randomly
selected to obstruct passages or place objects at each round/map load.
Map Requirement:
Select the brush/brushes that you want to remove and make script_brushmodel, set its targetname
to something unique such as "blockage1", make a script_origin somewhere near this script brush and set its
targetname to "ran_passage" for passage and "ran_element" for element placement; set its target to "blockage1"
the same name as your script origin's targetname, if all done correctly you will see the origin points to one
of the models or brushes. Thats it!
*/
doRandom(){
level endon("intermission");
ran_passage = getentarray("ran_passage", "targetname");
ran_element = getentarray("ran_element", "targetname");
//init random passage obstruct
for(k=0; k
//initialize all random passage obstacles to set = true
ran_passgroup = getentarray(ran_passage[k].target, "targetname");
for(i=0; i
ran_passgroup.set = true;
ran_passgroup.setloc = ran_passgroup.origin;
}
}
//init random element placement
for(j=0; j
//initialize all random elements to set = true
ran_elegroup = getentarray(ran_element[j].target, "targetname");
for(i=0; i
ran_elegroup.set = true;
ran_elegroup.setloc = ran_elegroup.origin;
}
}
//main loop for random generation
while(1){
//pass chance of blockage to each obstacle's script origin
for(k=0; k
if(isdefined(ran_passage[k].chance))
chance = randomInt(ran_passage[k].chance);
else{
//1/3 chance of obstruct
chance = randomInt(2);
//SD pro-mode, no random
if(getcvar("g_gametype") == "sd")
chance = 0;
//disable random, need map_restart
if(isdefined(getcvar("chelm_random")))
if(getcvar("chelm_random") == "0")
chance = 0;
}
ran_passage[k] thread ran_think(chance);
}
//pass chance of appearing of each element's script origin
for(k=0; k
//1/3 chance of appearing
if(isdefined(ran_element[k].chance))
chance = randomInt(ran_element[k].chance);
else{
//1/3 chance of obstruct
chance = randomInt(2);
}
ran_element[k] thread ran_think(chance);
}
self waittill("round_started");
}
}
//set or unset think
ran_think(chance){
ran_group = getentarray(self.target, "targetname");
if(chance == 1){
for(k=0; k
ran_group[k] thread ran_set(ran_group[k].setloc);
}
}
else{
for(k=0; k
ran_group[k] thread ran_unset(ran_group[k].setloc);
}
}
}
//set the obstacle to obstruct this passage
ran_set(oldloc){
if(!(self.origin == oldloc))
self.origin = oldloc;
}
//collect all obstacles into the bag under the map
ran_unset(oldloc){
if(self.origin == oldloc)
self.origin += (0,0,-1000);
}
//==============================Random passage/element ends=========================
edited on Mar. 31, 2013 02:53 pm by Anarchic |
 |
|
|
| Harbinger |
General Member Since: Nov 10, 2007 Posts: 54 Last: Apr 18, 2013 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Wednesday, Apr. 3, 2013 01:28 pm |
 |
It depends on what kind of model is in the map. There are a few kinds of models such as misc_models and script_models, among others. If it is not a script_model, then typically it is not possible to move it. The problem is, the server-side cannot see non-script_models because they are completely handled by the client-side, just like walls and ground patches. If it is a script_model and the code can find the entity, it is possible.
Generally, I would only consider moving around models in the map if the mapper is already moving the models differently then how I want to move them. It could cause problems otherwise. For example, they may use the model to cover a hole in the map, and if it moves, the hole is open. |
 |
|
|
| Anarchic |
General Member Since: Jan 23, 2013 Posts: 13 Last: May 31, 2013 [view latest posts] |
|
|
|
Category: CoD2 Scripting Posted: Thursday, Apr. 4, 2013 02:50 pm |
 |
Well here is my idea(s) and maybe you can add a bit more insight into this.
When cod2 started the mapping tools were not available so some of the first "mappers" figured out how to take the single player maps and turn them into mp maps playing mostly DM &TDM. Tally and Lasticott being the two most ovious designed to do it. If you go back and look at some of these maps they are beautiful, expansive, and epic but extremely choked. Typically they are choked by sandbags, tanktraps and barbedwire in a few select locations
My idea was/is to take those same SP maps..unchoke them, add well designed ctf spawns, S&D locations and rerelease then for the cod2 community.
Three ideas came to mind...delete the offending parts (barbwire, tanktraps, crates etc. Move the offending items under the map using the Oraco idea or creating ways to get over the choke points...add crates, jeeps or other climbable objects.
Just another effort to keep the game alive and pump a little more energy back into it.
edited on Apr. 4, 2013 08:01 am by Anarchic |
 |
|
|
| Harbinger |
General Member Since: Nov 10, 2007 Posts: 54 Last: Apr 18, 2013 [view latest posts] |
|
|
|
|
| Anarchic |
General Member Since: Jan 23, 2013 Posts: 13 Last: May 31, 2013 [view latest posts] |
|
|
|
|
| Harbinger |
General Member Since: Nov 10, 2007 Posts: 54 Last: Apr 18, 2013 [view latest posts] |
|
|
|
|
| Anarchic |
General Member Since: Jan 23, 2013 Posts: 13 Last: May 31, 2013 [view latest posts] |
|
|
|
|
| Harbinger |
General Member Since: Nov 10, 2007 Posts: 54 Last: Apr 18, 2013 [view latest posts] |
|
|
|
|
| Anarchic |
General Member Since: Jan 23, 2013 Posts: 13 Last: May 31, 2013 [view latest posts] |
|
|
|
|
| Harbinger |
General Member Since: Nov 10, 2007 Posts: 54 Last: Apr 18, 2013 [view latest posts] |
|
|
|
|
|
|
mp_TempleCall of Duty: Mods: Multiplayer (624.12Kb)
|