General > Features & Articles

Advanced Development Tutorial for FOnline

<< < (3/3)

Slowhand:
First things first. This, as well as the Mysterious Stranger is more like a module, rather than a tutorial, as it's complexity is too high to be of any proper use to teach stuff. Sorry about that.

7. Black Jack card game - Installation

Copy the following files to the "Server/scripts" folder:

* blackjack_manager.fos - manger class for the Blackjack module.
* blackjack_h.fos - contains specification for the Blackjack module.
* blackjack.fos - contains the the Blackjack class, the main mechanic of the Blackjack module.
* blackjack_dialogues.fos - contains the link to the dialogue file.
* blackjack_card.fos - contains the card class used by the Blackjack module.
* blackjack_deck.fos - contains the deck class used by the Blackjack module.
* blackjack_shoe.fos - contains the shoe class used by the Blackjack module, a shoe in Blackjack is a number of card decks shuffled together.Copy the following files to the "Server/dialogs" folder:

* blackjack_dealer.fodlg - the dialogue file for the dealer.
To complete the install, you also need to link stuff together, discussed several times in basic tutorial, like add "blackjack_dialogues.fos" to the script list, so the dialogue file can reference to it's scripts, you need to define a dialogue number to use the dialogue with and you need to create a map with an NPC or just add the dialogue to an NPC in a public map to try it out.

Testing:

- To help testing of rare cases, you can find some use cases on the bottom of the blackjack class. I left their calls commented out, so you can see where to put them, but it's basically at the end of init.

Current situation:

- Some features are not implemented and I will not implement them myself, that remains to the player. The split, basic function of Blackjack is cut out, because it produces a lot of complexity and I did not bother to implement it. Other than this, every function works, but it is not as configurable as promised, someone wanting to assign quests to this module, will have to work him/her self on scripting.

Edit:

- Fixed a a bug where when shoe ended there was no reshuffling.
- Added a few RP elements, shoe size can be seen, dealer's hole card can be seen and when shuffling happens, can be seen, depending on gambling and random check.

Slowhand:
8. Adding or modifying sound effects.

Modifying a sound effect - drinking nuka cola:

* Download and convert a sound to .ogg format.

* Search youtube for a sound effect that suits you. (Example: "_https://www.youtube.com/watch?v=7f24En4v_WM" - Opening bottle sound effect - Blopp )
* Go to an online youtube downloader to download the sound in .mp3 format.  (Example: video grabby )
* Use an audio converter to convert from .mp3 to .ogg format. (Example: I used VLC, you can follow "_https://www.youtube.com/watch?v=4MDB7ubuukc" this tutorial for it.)
* Once you got the .ogg file, test it with Winamp or VLC, and copy it into the "client/Data/faction.zip/sound/sfx" folder. (note: I used TotalCommander to copy files into .zip archives, it's easy with it, just browse the .zip file and copy the stuff into it, just like you would to a normal folder.)
* Edit the file "drugs.fos", change the line 91 from "cr.PlaySound("nukacola.ogg", true);" to "cr.PlaySound("blopp.ogg", true);"
* Test.
Testing it:

* Once you logged in with your admin character, type the command: ~getaccess admin admin (In case you changed the admin password, use different password, if in doubt check the GM abuse tutorial at fodev.net questions and answer section)
* You should get a message on top of the screen stating: "Mercenaries don't die - they just go to hell to regroup."
* Type "`give PID_NUKA_COLA 5 -p AdminCharName -legit" - this will give you 5 nuka colas. (Make sure you replace AdminCharName with your character's name)
* Drink a nuka cola and listen. The new blopping sound should be in effect.

Slowhand:
9. Adding or modifying graphical assets.

Client side:

* Creating a custom animation frame file (.fofrm), for the item to show on map:

* Navigate to ..\Client\data\base.zip\art\items\ folder, and look up the structure of a fofrm file.
* Create the fofrm file as described below, but to a temporary location of your choosing, copy the image to it as described later.
* fps=10 what fps will the animation of the item run, if there is animation, this is default 10, or sometimes 8.
* count=1 how many frames are the for the animation, if it's 1 then the item has no animation.
* offs_x=-23 move the middle of the image 23 pixels to the left, if positive then to the right. If this is 0, then it's centered on the X axis.
* offs_y=50 move the whole image 50 pixels up, so if an image is 100 pixels tall, it would be centered on the Y axis.
* [dir_0] this will tell the engine that frames will come for direction 0, which is how the item would look facing North-East on the map.
* frm_0=fish_circling1_01.png this is the image file for the first frame in given direction. If your item uses animations, there will be more of these with the suffix increasing
* Create image file:

* Download random image from web or create the one with your favorite paint tool, use .png file type when you save it.
* Custom images can contain all colors in 32 bit range, you can use transparency as well, thus .png files work best, as size not an issue. Side note: Original fallout 1/2 image files contained only up to 240 different colors and color blue was used for transparent color, but you don't need to worry about that.
* Create inventory image - repeat this process for the image that will be shown in inventory, if the item is picked up.
* Copy the .fofrm files and their images to the respective folder structure:

* ..\Client\data\base.zip\art\items\ for items on the map
* ..\Client\data\base.zip\art\inven\ for items in the inventory
* Alternatively, use a new zip file (example: fishing.zip) to store the data, you need to copy the .fofrm files to:

* ..\Client\data\fishing.zip\art\items\ for items on the map
* ..\Client\data\fishing.zip\art\inven\ for items in the inventory
* Add the new zip file (fishing.zip) to the config file to be loaded:

* Edit ..\Client\DataFiles.cfg and add this new line data\fishing.zip after data\base.zip
Server side:

* Adding the new item to the server

* Open the file ..\Server\proto\items\misc.foproto
* Find an item you wish to copy the attributes from and copy paste lines starting with [Proto] and ending with an empty line. Example: ProtoId=539 -which is the Meat
* Make sure to keep the empty line between items.
* There are various parameters you can change, but for simplicity we just copy flags, weight etc. from well working items.
* You will need to change the following parameters to:
* To change the image when the fish is dropped on the ground on a map, change this: PicMap=art\items\fishing\freshmeat.fofrm
* To change the image when the fish is in inventory, change this: PicInv=art\inven\fishing\fish_1.fofrm
* Give a unique ProtoID number, for example 26760, should look like this: ProtoId=26760
* Name and description to the new item

* Edit the file at location: ..\Server\text\engl\FOOBJ.MSG and add the following line accordingly keeping the sorted nature of the numbers in front of lines.
* {2676000}{}{Fish} for the name of the item
* {2676001}{}{Could be a derivative of Salmon and radiation.} for the description (or info) of the item.
* Notice that the number 2,676,000 is 100 times 26,760, and the two last digits will have a special meaning, denoting name or info, hence I colored them differently above.

Testing it:

* Once you logged in with your admin character, type the command: ~getaccess admin admin (In case you changed the admin password, use different password, if in doubt check the GM abuse tutorial at fodev.net questions and answer section)
* You should get a message on top of the screen stating: "Mercenaries don't die - they just go to hell to regroup."
* Type `give 26760 2 - this will give you 2 Fishes.
* Hover over the Fish you got in inventory, click with default mouse cursor to show description info, and check if it's the same you have added.
CHEAT SHEET:


Navigation

[0] Message Index

[*] Previous page

Go to full version