Scripting?!

Post your scripting questions / solutions here

Moderator: Moderators

User avatar
k47a
товарищ
Posts: 810
Joined: Fri Mar 25, 2005 1:19 pm

Scripting?!

Post by k47a »

Yeah, I know, it's bad to ask this question, but I've never done any scripting before (either), so please excuse.... Well, how can I do scripting? I mean, where do I write the stuff in? :oops:
ivan
User avatar
Deutsche Dogge
First Lieutenant
Posts: 183
Joined: Wed May 07, 2003 11:50 pm
Location: Quebec
Contact:

Post by Deutsche Dogge »

Have a look at existing maps files (*mapname*.scr) they are in pak5.pk3 and pak6.pk3 in "maps/dm/" or "maps/obj/" and also go around in the other files included with the game, pak0.pk3 contains a lot of scripts. Looking at how the developers worked can give you a good start.

Also go to http://www.gronnevik.se/rjukan/ as it contains a lot of tutorials and explanations.

There is no "easy way to start", you have to read existing stuff and you'll get it. :)

And never overlook the Search button of the forums if you ever need to find something, can be already there.

Have fun learning. :)
Image
Click sig to visit the alternation modding community
User avatar
k47a
товарищ
Posts: 810
Joined: Fri Mar 25, 2005 1:19 pm

Post by k47a »

Yo, thanks a lot for the tips!
Bu, well, t I don't even know where I can find the scripting files - I mean, where I have to write the commands in... :(
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

open the pak5.pk3 go into the maps folder,then go into the Dm or OBJ folder wich ever gametype ur editing,then choose the .scr u want to edit for the map.e.g(mohdm1.scr)
just edit them with notepad.
Image
User avatar
k47a
товарищ
Posts: 810
Joined: Fri Mar 25, 2005 1:19 pm

Post by k47a »

Aaaaaaaaaaaaaaaaaaaaarhg!!!! :shock:
I can't open that file!!! :( Do I have to run the MOHAA (the actual game)???
Sorry I'm so bloody stupid...
ivan
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

You can open it with winzip ;)
Image
User avatar
k47a
товарищ
Posts: 810
Joined: Fri Mar 25, 2005 1:19 pm

Post by k47a »

Okay, I got it unzipped and have an acrobat reader file in my MOHAA/main folder which I can't open though... So how do I open that damn pak.files, please... I'm on the edge of hyperventilating, you see...
ivan
LiquorKraZy
Captain
Posts: 267
Joined: Tue Aug 10, 2004 5:38 am
Location: CA
Contact:

Post by LiquorKraZy »

use notepad...
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

I'm using Total Commander - it accesses .pk3s like directories. ;)
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
k47a
товарищ
Posts: 810
Joined: Fri Mar 25, 2005 1:19 pm

Post by k47a »

Okay, sorry guys, nvm, I give up... When I tried notepad, my computer hung itself and fell in kinda endless loop... :?
Anyway, what's Total Commander? Could I open the scripting stuff while in the game?
ivan
bighoss
Major
Posts: 276
Joined: Fri Jan 09, 2004 3:34 pm
Location: USA, Ohio

Post by bighoss »

Umm I'm not sure, but I don't think you can. An easy way to open a pk3 file is to make a copy of it on your desktop or somewhere away from the original. When you have the copy there, rename it from a pk3 to a zip file. You should be able to open it now. Then when you find the scr files you can't just double click them. Your computer will probably believe it to be a screensaver. Just open notepad and then open the file or maybe right click and open with notepad that way. Hope this helped.
Image
Strive to accomplish great things!!
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

mohdm2

Post by tltrude »

Here, this is the script for mohdm2 (Destroyed Village). Copy it to Notepad and save it as "mohdm_sample_script.scr" for now.

Code: Select all

// DESTROYED VILLAGE
// ARCHITECTURE: NED
// SCRIPTING: NED

main:

// set scoreboard messages
setcvar "g_obj_alliedtext1" "Destroyed Village"
setcvar "g_obj_alliedtext2" ""
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""

setcvar "g_scoreboardpic" "mohdm2"

	// call additional stuff for playing this map round based is needed
	if(level.roundbased)
		thread roundbasedthread

	level waittill prespawn

	//*** Precache Dm Stuff
	exec global/DMprecache.scr

	exec global/door_locked.scr::lock
	level.script = maps/dm/mohdm2.scr
	exec global/ambient.scr mohdm2
	
	level waittill spawn

end

//-----------------------------------------------------------------------------

roundbasedthread:

	// Can specify different scoreboard messages for round based games here.

	level waitTill prespawn

	level waittill spawn

	// set the parameters for this round based match
	level.dmrespawning = 0 // 1 or 0
	level.dmroundlimit = 5 // round time limit in minutes
	level.clockside = kills // set to axis, allies, kills, or draw

	level waittill roundstart

end
The above script does not do much. It adds text and a picture to the scoreboard. It adds background sound and door locked sounds. It allows the map to be played as a roundbased game.

Text that follows the "//" symbols is not read by the game. They are use to add comments for scripters.
Tom Trude,

Image
User avatar
Deutsche Dogge
First Lieutenant
Posts: 183
Joined: Wed May 07, 2003 11:50 pm
Location: Quebec
Contact:

Post by Deutsche Dogge »

ivan saurochel wrote:Okay, sorry guys, nvm, I give up... When I tried notepad, my computer hung itself and fell in kinda endless loop... :?
Anyway, what's Total Commander? Could I open the scripting stuff while in the game?
ivan
You can edit while in game. Get in a map, open the console and type editscript, it will open a notepad with the map script file, when you are done, just save (with the editor menu or ctrl+s) and the file will be located in "mohaa/main/maps/dm(or obj)/mapname*.scr. Then you can restart the map for it to take effect (maybe get out of the map completely before restarting, i can't be sure as i use this method only for minor changes and not for item spawning and major changes)


Now on other points:
- winRAR can open .pk* files (right-click in explorer, open with..., select winRAR)
- PakScape can open pk* files too and is easy to use
- Notepad don't open pk* files, as you might thought since Petey posted a useless piece of information.
- Notepad can open .scr, mus, tik, shader, cfg, st, urc files that comes with the game.

And you can also find very usefull informations that is not in the forums but is on this site too. Click on the ".map" link on the top of the page and have a look at the lefthand menu under "tutorials".
or click here http://dynamic4.gamespy.com/~map/mohaa/ ... tegory=All
Image
Click sig to visit the alternation modding community
LiquorKraZy
Captain
Posts: 267
Joined: Tue Aug 10, 2004 5:38 am
Location: CA
Contact:

Post by LiquorKraZy »

- Notepad don't open pk* files, as you might thought since Petey posted a useless piece of information.
i thought he was asking about opening the .scr files...but thanks for the acknowledgement! :wink:
User avatar
k47a
товарищ
Posts: 810
Joined: Fri Mar 25, 2005 1:19 pm

Post by k47a »

Ay thanks so much for your help and patience. I'm gonna check it out asap (hey, I'm supposed to be very busy as a student, right?! :D
Image
Post Reply