Author Topic: IBan's City RPG How do I add weapons to shop/add-ons  (Read 780 times)

I want to add some more weapons that people can sell and buy and stuff. I am using Iban's CityRPG. Can someone please tell me how with an example on how to do it explaining it too? Also is it possible to add a whole add-on of weapons to the shop?

This should work, tell me if you encounter any problems!

Step one: Loading item

Fist thing you need to do is to make sure that this weapon loads so that you dont break anything. To do this you can use a function called "forceRequiredAddon".

Open up server.cs inside gamemode_CityRPG.zip

Scroll down to the end of the file

Add this line
forceRequiredAddon("Your_ItemName");

Make sure to replace Your_ItemName with the name of the item you are loading. It should be in the format of "Weapon_WeaponName". If you are unsure what you should put here, put the name of the add-ons .zip file.

Step two: Getting the items datablock

Open up the zip file for the weapon you are adding. Look in each of the files for this line
Code: [Select]
datablock ItemData(somethingData)
Highlight somethingData and copy it, you will need it in the next step.

Step Three: adding the preferences

In the gamemode_CityRPG zip folder open up prefs.cs

Press Ctrl+F and search for
Quote
Weapon Prices
.

You will need to edit a few values. First is
Code: [Select]
$CityRPG::ItemCount = someNumber. Take the number that is after the equals sign and set it to one plus whatever it is. For example if it is 6, set it to 7. Easy enough?

Code: [Select]
$CityRPG::prices::weapon::name[7] = "Paste What We Copied in step 2 here, leave the quotes!";
$CityRPG::prices::weapon::price[7] = 500; // Set this to what the price should be for it
$CityRPG::prices::weapon::mineral[7] = 250; // set this to how many minerals it should cost

Make sure that you set 7 to whatever number you just set $CityRPG::ItemCount to.

That should be all!
Cheers!
« Last Edit: August 16, 2014, 12:39:14 AM by RarwMuffinz »

This should work, tell me if you encounter any problems!

Step one: Loading item

Fist thing you need to do is to make sure that this weapon loads so that you dont break anything. To do this you can use a function called "forceRequiredAddon".

Open up server.cs inside gamemode_CityRPG.zip

Scroll down to the end of the file

Add this line
forceRequiredAddon("Your_ItemName");

Make sure to replace Your_ItemName with the name of the item you are loading. It should be in the format of "Weapon_WeaponName". If you are unsure what you should put here, put the name of the add-ons .zip file.

Step two: Getting the items datablock

Open up the zip file for the weapon you are adding. Look in each of the files for this line
Code: [Select]
datablock ItemData(somethingData)
Highlight somethingData and copy it, you will need it in the next step.

Step Three: adding the preferences

In the gamemode_CityRPG zip folder open up prefs.cs

Press Ctrl+F and search for .

You will need to edit a few values. First is
Code: [Select]
$CityRPG::ItemCount = someNumber. Take the number that is after the equals sign and set it to one plus whatever it is. For example if it is 6, set it to 7. Easy enough?

Code: [Select]
$CityRPG::prices::weapon::name[7] = "Paste What We Copied in step 2 here, leave the quotes!";
$CityRPG::prices::weapon::price[7] = 500; // Set this to what the price should be for it
$CityRPG::prices::weapon::mineral[7] = 250; // set this to how many minerals it should cost

Make sure that you set 7 to whatever number you just set $CityRPG::ItemCount to.

That should be all!
Cheers!

Thanks man I added all the weapons I wanted.