PDA

View Full Version : [COD2][Request]Tutorial print hello world to screen/load gsc script's on server



pizzadox
12th April 2020, 21:18
Hello killtube,

i'm new here and want to say "hello". With this done I excuse for my bad english (i'm from germany:p).
I think that I'm familiar with scripting/coding (some years of batch and a year Java), so I know the
BASICS.

Some day's ago I played on one of the COD 2 mp servers and now i just want to print a simple
"Hello World" to player screen. But till now this seemed to be impossible because the whole
forum is posting nice gsc scripts but I don't get arround to understand what I have to do to run the
scripts. I saw some "mods" (projects or how ever you would like to call it) they worked but I don't
get it.

So my request is if there a tutorial which shows me how to accomplish that.

I searched for some hours, but with no results. I saw the many gsc (maybe this is the wrong route with
this gsc scripts so give me a hint to the correct route) scripts on this forum but didn't know
how to use them, especially were to put them that my server will load them or excute them. I copied
some of them into the iw07 folder (in the maps/mp/gametypes folder) or edited the _load.gsc with no
results (or got an error message after some seconds the game started loading the map).

So I hope one of you can help me to achieve my goal to print a simple "Hello World" after a player
connected and spawned for the first time.

If I missed any detail you want to know about my request don't hasitate to ask because i wan't to get
further. Also if I didn't saw a tutorial or missed anything within my search please don't kill me. In
addition to that please don't understand this text/request as anoffence to you! This is a simple but
helping request to get arround COD 2 scripting.

Thank you! Killtube! Your pizzadox

PS: I hope I hit the right Sub-Forum.

Mitch
13th April 2020, 10:33
Hi,

iw_07.iwd and iw_15.iwd (patch 1.2/1.3) contain all the stock script files

maps/mp/: map script files
maps/mp/gametypes: gametype script files

What you are looking for are located in gametypes folder.
For example, take a look in tdm.gsc at the function spawnPlayer() and _healthoverlay.gsc

Printing a message, is possible with iprintlnbold (https://znation.nl/cod4script/iprintlnbold.htm).

Edit: do not change stock iwds.
Otherwise you will get impure client when joining most servers.

Create a new zip file with .iwd extension with the same folder structure e.g. z_mod.iwd: maps/mp/gametypes
IWD file name order overrides files in other iwds.
For example, iw_15.iwd overrides iw_07.iwd.

serthy
13th April 2020, 10:56
Funny, I just did a quick video, because I forgot how to do it myself.
However it is on windows:

https://youtu.be/9-n75APn81g

pizzadox
13th April 2020, 15:13
Thank you Guys,

this helped me a lot. In addition to my last request, is there a list with all
functions and keywords which i could need to write scripts or should I
stick to the two files you recommended for me?

So thank you a lot for your invested time and effort!

Your pizzadox

serthy
13th April 2020, 15:52
There are a few things that get you started scripting wise in CoD2:
- your map script gets called first
- then the game calls maps/mp/gametypes/_callbacksetup::CallBack_StartGameType()
- Kills, Damage, Player Connected, Player Disconnected events get called from the game in _callbacksetup.gsc
- the gametypes setsup callbacks such that these calls gets redirected to the correct one in tdm.gsc/ctf.gsc etc.
- images/huds/models and some more need to be 'precached' in the first frame of the game
- start your game with +developer 1, so the console gives you error messages, there is no debugger, so iPrintln() and runtime errors are your only friends
- this is only *.gsc files, for menu modding/weapon/effect/model modding its another story
- https://scripts.zeroy.com/ & https://wiki.zeroy.com/index.php for more keywords etc
- you call functions on objects: 'player thread myFunc()' -> in myFunc() you can refer to the caller as 'self'
- minimal waittime (based on server framerate sv_fps is 1/20 = 0.05
- you shouldn't have infinite loops, or you get a runtime error
- you can activate bots to help a bit more, just see on tdm.gsc on top the commented out line on addTestClients()
- gsc files and a few others are serverside, they can stay in your fs_game-folder and arent needed for the clients, images/models/sounds/menus need to be inside an iwd (zip) file and are downloaded on connect

pizzadox
13th April 2020, 18:44
Of course thank you for your advises.

vesicant
10th April 2022, 22:25
gsc files and a few others are serverside, they can stay in your fs_game-folder and arent needed for the clients, images/models/sounds/menus need to be inside an iwd (zip) file and are downloaded on connect

Does anyone know the full list of files that can stay serverside vs. files that have to be downloaded to the client?

Paho
12th April 2022, 11:40
Does anyone know the full list of files that can stay serverside vs. files that have to be downloaded to the client?

If some file is not in the mods or maps on the server to which you are connected, and which are cached somewhere (from somewhere a non-existent file is accessed), then the presence of it in the client in any other downloaded file from other servers will lead to conflict.