Jump to content
Sign in to follow this  
-RT- Sauron

Some scripting questions

Recommended Posts

Hello all,

im sorta new to scripting, spent some hours looking into Xeno's domination and made some modifies to it (mantaining full credit to Xeno of course), also i look often at community.bistudio.com but there are some things which i don't have very clear.

1) It seems to me that a script can be either server-side, or client-side, or even both. From the documentation i get that isServer tells me where i am, so i can decide on which side a script, or parts of it, should run, am i correct ?

2) How do i change the number of inventory slots (how many items you can have) a soldier class have by default ?

3) How can i create a custom solider class ?

My Guess in #2 and #3 is that i have to create an addon, and i can't do that in a custom mission, am i correct ?

4) Is it possible to load a file and get its contents in a string ?

5) Is it possible to save a file, save the map status ? i've seen that if you create a multiplayer game and host it, without the dedicated server, when you exit the game saves the map state, and by re-entering you can choose to resume your mission, how do i do that on the dedicated server, and by script commands ?

I would like to save player stats in a file, and reload them at mission load, to not loose points in some maps, like Domination ranked.

There is the "disableSerialization" command which i get what it does, but there is no explicit serializeMap or something command.

6) Where i can find the number of points the game gives you based on which enemy you kill? sometimes i see you get 1 point, sometimes two, etc, im sure it depends on the enemy you kill, like, if you kill a leader it should be more than one point, or im wrong ?

7) It seems to me that all the documentation about scripting i have found is done by the community, which is pretty wrong.. There are some things on which there is still a big controversy, like the movingEnabled attribute in dialogs/displays, i haven't seen an official statement on it (possibly i didn't find it) is that so ?

8) Debugging sometimes is PITA, when you are not using PBO files the game nicely reloads scripts which aren't alive anymore but some of them rightfullly stay alive (in domi f.e there are some scripts which check things then go sleep and check again etc), is there a way to force the reloading of them ? (and facing the consequences this may make in the map of course)

9) There doesn't seem to be a way to check the whole map scripts before running them and playing them, a missing closed parenthesis can screw you up badly, is there a better way to debug ? i made a small C program to check for opening and closing of parenthesis, but a full non in game syntax checker would be very helpful...

Thanks in advance, sorry for the many questions :-)

Edited by [RT] Sauron

Share this post


Link to post
Share on other sites

1) By default everything is basically run on all machines (server and clients). You can limit the location with "if (isserver)" etc.

2/3) You are correct

4) preprocessFile

5) I'm not aware of any way to save on dedis.

8) Not exactly sure what you mean, but you could try to quit a script by using scopeName and breakOut. Then just exec the script again.

9) Tell me when you find one. ;)

Share this post


Link to post
Share on other sites

Always use preprocessFileLineNumbers (instead of preprocessFile).

Helps you debugging problems a lot. More details at OFPEC in Spooners posts.

Share this post


Link to post
Share on other sites

I fear i didn't make myself clear enough on the loading file part, i was aware of loading commands, however i was going to use them for loading strings from a file which is outside a .PBO file, think about loading player settings (associated with the player uid) all this done for some kind of "living after map reset" settings.

Since the PBO is essentially a virtual drive, i guess loadfile apis will not work outside of it, leaving the map unpacked should work, albeit slowly, but im not sure what happens when you load an unpacked map, if the server sends single scripts to the user or not, gonna try this though.

Thanks much guys, appreciate you answers.

I'll check out the mod section to see how i can make custom classes.

Edited by [RT] Sauron

Share this post


Link to post
Share on other sites

I'm not sure loadFile is limited to files inside .pbo, you should be able to access files unpacked.

Problem is, AFAIK, you can't write anything on file apart from writing in arma.RPT file by using debug_log

Share this post


Link to post
Share on other sites

1) If you run a script via action menu, its local, where the unit is local that pressed the action. Scripts that are executed from initlin eor init.sqf are global (on every client and server is one instance). Maybe if you want a script just to be executed on server via init line you must write this to the script to exit if the script is on a client

if (isserver) exitwith {};

23 )Yes, you habe to make a costum addon. You can tweak the slots in the addonconfig. But you can make a script, that counts the items in inventory and delete all unwanted items (to many in inventory etc). Or you can use a bag addon like in SLX to carrie more items.

4) ...

5) Its not yet possible. Somebody released a extended .dll for ArmA. With this dll you was able to save vars to files AND databases. Maybe in the future this dll will be avaiable for ArmA2 too.

6) Dont know.... maybe trying out. "Score player" returns your score in a script.

7) The most documentation is from the Biki http://community.bistudio.com/wiki/Main_Page. Most people just try to make it more easy to understand.

8) You can check, if scripts are "done": http://community.bistudio.com/wiki/scriptDone .

With this you can maybe force "dead" scripts to be reinitialized

9) Just start the ArmA2.exe with the param -showScriptErrors and you can see every script error with scriptline ingame.

Share this post


Link to post
Share on other sites

loadFile should work outside of pbos. Yet only inside the arma folder.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×