Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 5 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Next Page
subscribe
Author Topic: Moving map objects
Anarchic
General Member
Since: Jan 23, 2013
Posts: 13
Last: May 31, 2013
[view latest posts]
Level 1
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
Share |
Harbinger
General Member
Since: Nov 10, 2007
Posts: 54
Last: Apr 18, 2013
[view latest posts]
Level 3
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.
Share |
Anarchic
General Member
Since: Jan 23, 2013
Posts: 13
Last: May 31, 2013
[view latest posts]
Level 1
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
Share |
Harbinger
General Member
Since: Nov 10, 2007
Posts: 54
Last: Apr 18, 2013
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Friday, Apr. 5, 2013 12:02 am
Im guessing what they did was edit the .bsp file. The ,bsp stores the actual map data and can be edited with wordpad. It might be possible to remove the models directly that way directly, or the misc_models could be changes to script_models. All of the clients would have to then be given the new .bsp.

This method is really not great. It is hard to tell what will happen when changes are made to the .bsp. It is possible more often then not to find the models in the .bsp and do something with them by finding the model by its name. It is a difficult process though and generally a bad idea.
Share |
Anarchic
General Member
Since: Jan 23, 2013
Posts: 13
Last: May 31, 2013
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Saturday, Apr. 6, 2013 01:18 pm
I'm already editing the bsp file. I've figured out how to add spawn points, delete spawnpoints, move flag positions, add random grenades/weapons and delete object models (tanks, crates, etc) but the kicker is that the brush assiciated with that model (that makes it solid) remains and is invisible.

For example I have removed barbedwire but that area is still blocked or I have moved a ladder but the ladder brush does not move with it.

Yes your right. Its easy to break the .bsp file and the map and as for testing/redistributing they have to be renamed so as not to conflict with existing released maps.

IS there way, as you suggest change a model to a script model via this method then move it and its brush?

edited on Apr. 6, 2013 06:18 am by Anarchic
Share |
Harbinger
General Member
Since: Nov 10, 2007
Posts: 54
Last: Apr 18, 2013
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Saturday, Apr. 6, 2013 03:37 pm
Only if it is a script_brushmodel. Everything else is clientside. If you can change the other brush models into script_brushmodels, you can move them.
Share |
Anarchic
General Member
Since: Jan 23, 2013
Posts: 13
Last: May 31, 2013
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Apr. 7, 2013 02:16 pm
Right.
Thats what I was afraid of. Looking at the bsp files I can see the ladder listed as an xmodel object but not the ladder brush which must be compiled into the map.

Is it not possible to hex edit the location of the ladder brush?
Share |
Harbinger
General Member
Since: Nov 10, 2007
Posts: 54
Last: Apr 18, 2013
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Sunday, Apr. 7, 2013 02:31 pm
Not unless you can figure out what the big mess of characters mean. Since there is probably tens of thousands of characters there, it really is not possible.
Share |
Anarchic
General Member
Since: Jan 23, 2013
Posts: 13
Last: May 31, 2013
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Sunday, Apr. 14, 2013 01:36 pm
I think I can find the ladder brush in the bsp file as a simple search for the word "ladder" finds it listed near the top of most files but its the sections that follow that must indicate position and those would need to be hex edited.
Share |
Harbinger
General Member
Since: Nov 10, 2007
Posts: 54
Last: Apr 18, 2013
[view latest posts]
Level 3
Category: CoD2 Scripting
Posted: Sunday, Apr. 14, 2013 03:08 pm
Move it to (0,0,0), that will put it outside the map most likely.
Share |
Restricted Access Topic is Locked
Page
Next Page
subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»