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

Members Online

»
0 Active | 47 Guests
Online:

LATEST FORUM THREADS

»
SOF2 Prefabs map
SoFII Mapping
coduo mapping tools
CoDUO Mapping
Gaming
Q4 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 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked
Page
Previous Page
subscribe
Author Topic: Script calls - Hooking between game engine and scripts?
Sevenz
General Member
Since: Apr 24, 2006
Posts: 2390
Last: May 10, 2013
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Tuesday, Jan. 31, 2012 02:17 am
Quote:
I think that Sevenz is trying to work out what gets called by the engine as a map is loaded.

Right, i'm interested into what is called when and will eventually create a flowchart for scripters. Will help to understand where to place what code IMO. And i find it quite interesting how a hardcoded engine interacts with runtime scripts.

Thank you Tally for the detailed explaination!

Quote:
codescripts\delete::main() seems not

Put a trigger_touch in a custom map and set the VEHICLE spawn flag. Then it should be called to remove that trigger, as vehicle touch triggers aren't supported (check console, iirc the game tells you this)
Share |
SparkyMcSparks
General Member
Since: Feb 27, 2004
Posts: 1713
Last: Dec 29, 2016
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Tuesday, Jan. 31, 2012 04:11 am
Tally writes...
Quote:
As for codescripts\struct::InitStructs() - it is totally redundant; it doesn't do anything at all. The struct array is actual defined in the engine code itself. I think it is legacy code left over from when they were building the COD2 engine. It is not well known that, half way through the development of COD2, Infinity Ward did a U turn on how the engine would work and how it would be structured. I was told this when I visited the IW studios the first time, but a clear example of it can be seen in that half of the materials files are strange .TGA files which replaced COD1's .STYPE files, and then they switched over to Maya .MTL files (materials files). This was about half way through development. The initStruct() function appears to be similar redundant development - kind of like leaving in all the Quake 3 menu .H and .C stuff, which was/is never used in any COD game (not even in the Return to Castle Wolfenstein engine).


It's used in SP (I haven't tried MP).
EDIT: It's used in MP too.

Comment out the line inside InitStructs() and you'll get fatal SREs at initial runtime from CreateStruct() that level.struct array isn't defined.

Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Tuesday, Jan. 31, 2012 05:07 am
this level.struct is kinda strange in my eyes
there are alot of getStruct() and getStructArray()'s in various cod-titles (utility-funcs) but i didnt found anywhere something like level.struct = getentarray( bla , bla ); except of in InitStructs() & CreateStruct() ...
Share |
SparkyMcSparks
General Member
Since: Feb 27, 2004
Posts: 1713
Last: Dec 29, 2016
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Tuesday, Jan. 31, 2012 02:23 pm
serthy writes...
Quote:
this level.struct is kinda strange in my eyes
there are alot of getStruct() and getStructArray()'s in various cod-titles (utility-funcs) but i didnt found anywhere something like level.struct = getentarray( bla , bla ); except of in InitStructs() & CreateStruct() ...


It's for structs placed in Radiant. Code calls the functions inside the script, hence why it's in the codescripts folder and there is no level.struct = get_stuff() anywhere in script.

level.struct is used in struct_class_init() function within ...\raw\common_scripts\utility.gsc to organize level.struct into level.struct_class_names array based on target, targetname, script_noteworthy, or script_linkname keys.

getstruct() and getstructarray() returns structs from level.struct_class_names

struct_class_init() is used in both SP and MP, so it should break MP too if you comment out stuff inside codescripts\struct.gsc
Share |
Tally
General Member
Since: Apr 21, 2005
Posts: 819
Last: Oct 26, 2012
[view latest posts]
Level 7
Category: CoD4 Scripting
Posted: Wednesday, Feb. 1, 2012 12:49 am
SparkyMcSparks writes...
Quote:
serthy writes...
Quote:
this level.struct is kinda strange in my eyes
there are alot of getStruct() and getStructArray()'s in various cod-titles (utility-funcs) but i didnt found anywhere something like level.struct = getentarray( bla , bla ); except of in InitStructs() & CreateStruct() ...


It's for structs placed in Radiant. Code calls the functions inside the script, hence why it's in the codescripts folder and there is no level.struct = get_stuff() anywhere in script.

level.struct is used in struct_class_init() function within ...\raw\common_scripts\utility.gsc to organize level.struct into level.struct_class_names array based on target, targetname, script_noteworthy, or script_linkname keys.

getstruct() and getstructarray() returns structs from level.struct_class_names

struct_class_init() is used in both SP and MP, so it should break MP too if you comment out stuff inside codescripts\struct.gsc


Thanks for the info.

When I tested this, I tested on COD2, as I have a new rig which doesn't have COD4 installed (yet). With COD2, I commented out level.struct in struct::init() and ran a MP server without any errors. Even in developer mode, it doesn't complain. So, in COD2, the struct.gsc file must only be used in SP. I didn't test COD2 SP.

And of course, COD2 doesn't have any common_scripts folder, so there is a significant change right there.

In all, I was therefore wrong to assume that nothing had changed in that department between 2 and 4.
Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Saturday, Feb. 11, 2012 04:36 am
Quote:
So, in COD2, the struct.gsc file must only be used in SP.

True, placed around 30 script_structs in a small testmap, half of them with a targetname of 'struct'. In MP you cant get them neither in level.struct nor in getentArray() or getentArray("struct","targetname").
Share |
Restricted Access Topic is Locked
Page
Previous Page
subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 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

»