[MOD] Additional inventory items on character creation

Place for sharing your game modifications for Life is Feudal: Your Own

RudgerWolvram
 
Posts: 37
Joined: 01 Jan 2015, 22:27

Re: [MOD] Additional inventory items on character creation

Post by RudgerWolvram » 07 Mar 2015, 08:28

Koiecks wrote:So I figured out the hard way that when running your server thru Bluefang that you should not place a /DELIMITER (sp) command in the patch.sql

It will cause too many errors on start up that it crashes. Once removed and updated it ran again with no problems.


I can see that as a problem with some providers.
MariaDB, which this was written for is a drop-in replacement for MySQL.
The programmer that started MySQL named it after his first daughter (My) then after it was sold, forked it and opened it back up and named it after his second daughter (Maria).

That said, while it is a drop in replacement, there are some things required in Maria (that most server admins run) that are not required or are unknown to My. The Delimiter aspect appears to be one, so Bluefang most likely runs a MySQL DB for the game instead of Maria.

For those that don't work after the patch, you may check and make sure that the trigger or a similar trigger does not exist already, if it does, you need to drop it and re-create it.
If you look through some of the patch.sql, you'll notice that it has a lot of CREATE PROCEDURE, etc. with a DROP PROCEDURE a few lines above it. This effectively refreshes the procedures and such that they patch in game.

So far they have not used any triggers in the patch or game code (TRIGGER can replace PROCEDURE for drops/creates)

Another thing to watch out for with triggers is that My and Maria does not have the capacity to handle multiple triggers of the same type on the same table.

For example, if you want to do a BEFORE INSERT on the character table to add skills upon creation, you cannot create a second BEFORE INSERT on the character table for adding items to their inventory for something like a newbie pack. Those 2 must be added to the same BEFORE INSERT trigger.

User avatar
Rjmspoel
True Believer
 
Posts: 69
Joined: 01 Oct 2014, 12:44

Re: [MOD] Additional inventory items on character creation

Post by Rjmspoel » 10 Jun 2015, 14:15

OK just found out the hard way this isn't working anymore, these are the new rulesets compatible with server version 0.5.0.1

Code: Select all
CREATE TRIGGER `character_after_insert` AFTER INSERT ON `character` FOR EACH ROW BEGIN
   SET @backpack = NEW.RootContainerID;
   SET @temp = f_insertNewItemInventory(@backpack, 1059, 100, 16, 50000, 50000, '',''); /* copper coins */
   SET @temp = f_insertNewItemInventory(@backpack, 1060, 100, 8, 50000, 50000, '',''); /* silver coins */
   SET @temp = f_insertNewItemInventory(@backpack, 1061, 100, 8, 50000, 50000, '',''); /* gold coins */
   SET @temp = f_insertNewItemInventory(@backpack, 48, 100, 1, 50000, 50000, '',''); /* pickaxe */
   SET @temp = f_insertNewItemInventory(@backpack, 46, 100, 1, 50000, 50000, '',''); /* hatchet */
   SET @temp = f_insertNewItemInventory(@backpack, 974, 50, 25, 50000, 50000, '',''); /* 25x q50 Apple Buns */
   SET @temp = f_insertNewItemInventory(@backpack, 299, 50, 1, 15000, 15000, '',''); /* simple clothes */
   SET @temp = f_insertNewItemInventory(@backpack, 890, 50, 1, 15000, 15000, '',''); /* novice padded greaves */
   SET @temp = f_insertNewItemInventory(@backpack, 38, 50, 1, 15000, 15000, '',''); /* torch */
END;


:Yahoo!:


Kristo84
Beta Tester
 
Posts: 13
Joined: 27 Apr 2015, 21:14

Re: [MOD] Additional inventory items on character creation

Post by Kristo84 » 13 Jun 2015, 09:27

Rjmspoel wrote:OK just found out the hard way this isn't working anymore, these are the new rulesets compatible with server version 0.5.0.1

Code: Select all
CREATE TRIGGER `character_after_insert` AFTER INSERT ON `character` FOR EACH ROW BEGIN
   SET @backpack = NEW.RootContainerID;
   SET @temp = f_insertNewItemInventory(@backpack, 1059, 100, 16, 50000, 50000, '',''); /* copper coins */
   SET @temp = f_insertNewItemInventory(@backpack, 1060, 100, 8, 50000, 50000, '',''); /* silver coins */
   SET @temp = f_insertNewItemInventory(@backpack, 1061, 100, 8, 50000, 50000, '',''); /* gold coins */
   SET @temp = f_insertNewItemInventory(@backpack, 48, 100, 1, 50000, 50000, '',''); /* pickaxe */
   SET @temp = f_insertNewItemInventory(@backpack, 46, 100, 1, 50000, 50000, '',''); /* hatchet */
   SET @temp = f_insertNewItemInventory(@backpack, 974, 50, 25, 50000, 50000, '',''); /* 25x q50 Apple Buns */
   SET @temp = f_insertNewItemInventory(@backpack, 299, 50, 1, 15000, 15000, '',''); /* simple clothes */
   SET @temp = f_insertNewItemInventory(@backpack, 890, 50, 1, 15000, 15000, '',''); /* novice padded greaves */
   SET @temp = f_insertNewItemInventory(@backpack, 38, 50, 1, 15000, 15000, '',''); /* torch */
END;


:Yahoo!:


this code doesnt work

User avatar
Rjmspoel
True Believer
 
Posts: 69
Joined: 01 Oct 2014, 12:44

Re: [MOD] Additional inventory items on character creation

Post by Rjmspoel » 14 Jun 2015, 11:19

Yes it does, I have a server running that code without issues.


Kristo84
Beta Tester
 
Posts: 13
Joined: 27 Apr 2015, 21:14

Re: [MOD] Additional inventory items on character creation

Post by Kristo84 » 14 Jun 2015, 16:35

I write this code in my db and my server fail with error 1024 create character.

User avatar
Rjmspoel
True Believer
 
Posts: 69
Joined: 01 Oct 2014, 12:44

Re: [MOD] Additional inventory items on character creation

Post by Rjmspoel » 14 Jun 2015, 19:09

I would suggest to copy into notepad ++ and not into wordpad as it will wrap it up, copy from here and paste into ur patch.sql right on the end.

Also make note that it's 2 x ' and not "

pasting into any other but notepad ++ will make it go " when copying from there, also make sure theres the spaces after the comma's except the last bit.


Kristo84
Beta Tester
 
Posts: 13
Joined: 27 Apr 2015, 21:14

Re: [MOD] Additional inventory items on character creation

Post by Kristo84 » 15 Jun 2015, 09:03

i use notepad ++ :(.

my code is the following:

Code: Select all
CREATE TRIGGER `t_characterLimit` AFTER INSERT ON `character` FOR EACH ROW BEGIN
   SET @characterCount = (SELECT COUNT(*) FROM `character` ch WHERE ch.AccountID = NEW.AccountID);
   IF @characterCount > 2 THEN
      SET @msg = "Cannot create more than 2 characters per account";
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = @msg;
   END IF;
   SET @backpack = NEW.RootContainerID;
   SET @temp = f_insertNewItemInventory(@backpack, 1059, 100, 100, 50000, 50000, '',''); /* copper coins */
   SET @temp = f_insertNewItemInventory(@backpack, 1060, 100, 50, 50000, 50000, '',''); /* silver coins */
   SET @temp = f_insertNewItemInventory(@backpack, 1061, 100, 25, 50000, 50000, '',''); /* gold coins */   
END


it´s correct?

User avatar
Azzerhoden
Alpha Tester
 
Posts: 1621
Joined: 08 May 2014, 17:44

Re: [MOD] Additional inventory items on character creation

Post by Azzerhoden » 15 Jun 2015, 19:56

I couldn't get this to work either. Was able to create the backpack just fine, but as soon as I tried to add any items - error when creating a new character.
| - Alpha Tester and Zealous Believer
Image

Kingdom of Hyperion founding Duchy - A practical RP Community est. 1999 - Apply Today!

User avatar
Rjmspoel
True Believer
 
Posts: 69
Joined: 01 Oct 2014, 12:44

Re: [MOD] Additional inventory items on character creation

Post by Rjmspoel » 15 Jun 2015, 20:32

Azzerhoden wrote:I couldn't get this to work either. Was able to create the backpack just fine, but as soon as I tried to add any items - error when creating a new character.


With my code you do not get a backpack, all is just inserted into the players inventory.

User avatar
Rjmspoel
True Believer
 
Posts: 69
Joined: 01 Oct 2014, 12:44

Re: [MOD] Additional inventory items on character creation

Post by Rjmspoel » 15 Jun 2015, 20:37

Kristo84 wrote:i use notepad ++ :(.

my code is the following:

Code: Select all
CREATE TRIGGER `t_characterLimit` AFTER INSERT ON `character` FOR EACH ROW BEGIN
   SET @characterCount = (SELECT COUNT(*) FROM `character` ch WHERE ch.AccountID = NEW.AccountID);
   IF @characterCount > 2 THEN
      SET @msg = "Cannot create more than 2 characters per account";
      SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = @msg;
   END IF;
   SET @backpack = NEW.RootContainerID;
   SET @temp = f_insertNewItemInventory(@backpack, 1059, 100, 100, 50000, 50000, '',''); /* copper coins */
   SET @temp = f_insertNewItemInventory(@backpack, 1060, 100, 50, 50000, 50000, '',''); /* silver coins */
   SET @temp = f_insertNewItemInventory(@backpack, 1061, 100, 25, 50000, 50000, '',''); /* gold coins */   
END


it´s correct?


I know my code works, I have double checked and checked again, I do not have the character limit though as since last patch the devs disabled creation above 8, dunno exactly what they did so can not vouch for them, but try without the character limit and see if it works (which I know it will) if you are running 0.5.1.0


NoVoS
 
Posts: 3
Joined: 02 Jul 2015, 10:34

Re: [MOD] Additional inventory items on character creation

Post by NoVoS » 02 Jul 2015, 10:36

This isent working for me in 5.5.2

Code: Select all
CREATE TRIGGER `character_after_insert` AFTER INSERT ON `character` FOR EACH ROW BEGIN
   SET @backpack = NEW.RootContainerID;
   SET @temp = f_insertNewItemInventory(@backpack, 1059, 100, 100, 50000, 50000, '',''); /* copper coins */
   SET @temp = f_insertNewItemInventory(@backpack, 1060, 100, 50, 50000, 50000, '',''); /* silver coins */
   SET @temp = f_insertNewItemInventory(@backpack, 1061, 100, 25, 50000, 50000, '',''); /* gold coins */   
END

User avatar
Rjmspoel
True Believer
 
Posts: 69
Joined: 01 Oct 2014, 12:44

Re: [MOD] Additional inventory items on character creation

Post by Rjmspoel » 03 Jul 2015, 21:39

No, the devs are trying freaking hard to make sure none of the mods work anymore with each version they update


NoVoS
 
Posts: 3
Joined: 02 Jul 2015, 10:34

Re: [MOD] Additional inventory items on character creation

Post by NoVoS » 03 Jul 2015, 22:02

na that's .... but is there any solution for 0.5.5.2?

User avatar
Rjmspoel
True Believer
 
Posts: 69
Joined: 01 Oct 2014, 12:44

Re: [MOD] Additional inventory items on character creation

Post by Rjmspoel » 06 Jul 2015, 14:17

No....

User avatar
Azzerhoden
Alpha Tester
 
Posts: 1621
Joined: 08 May 2014, 17:44

Re: [MOD] Additional inventory items on character creation

Post by Azzerhoden » 09 Jul 2015, 23:50

So, I was able to resolve this. Had to run all the commands in the query window to get an error to point me to the solution. After it made perfect sense.... :pardon:

The issue is that with the changes to f_insertNewItemInventory, you do not pass in '' for the 7th and 8th parameter (though it will work depending on variables unknown to me....). You instead pass in the NULL value.

Here's my code that adds a sack, then populates it with some items.
Code: Select all
DELIMITER #
CREATE TRIGGER `character_after_insert` AFTER INSERT ON `character` FOR EACH ROW BEGIN
   SET @sack = f_createContainer(NEW.RootContainerID, 459, 0);
   SET @temp = f_insertNewItemInventory(@sack, 555, 50, 1, 50000, 50000, NULL, NULL); /* practice sword */
   SET @temp = f_insertNewItemInventory(@sack, 41, 100, 1, 50000, 50000, NULL, NULL); /* primitive shovel */
   SET @temp = f_insertNewItemInventory(@sack, 43, 100, 1, 50000, 50000, NULL, NULL); /* primitive hammer */
   SET @temp = f_insertNewItemInventory(@sack, 45, 100, 1, 50000, 50000, NULL, NULL); /* primitive axe */
   SET @temp = f_insertNewItemInventory(@sack, 50, 100, 1, 50000, 50000, NULL, NULL); /* primitive saw */
   SET @temp = f_insertNewItemInventory(@sack, 30, 100, 1, 50000, 50000, NULL, NULL); /* primitive sickle */
   SET @temp = f_insertNewItemInventory(@sack, 47, 100, 1, 50000, 50000, NULL, NULL); /* primitive pickaxe */
   SET @temp = f_insertNewItemInventory(@sack, 289, 100, 1, 50000, 50000, NULL, NULL); /* primitive knife */
   SET @temp = f_insertNewItemInventory(@sack, 974, 50, 25, 50000, 50000, NULL, NULL); /* 25x q50 Apple Buns */
   SET @temp = f_insertNewItemInventory(@sack, 1028, 50, 1, 15000, 15000, NULL, NULL); /* primitive cooking pot */
END #


Just tested - works for me
| - Alpha Tester and Zealous Believer
Image

Kingdom of Hyperion founding Duchy - A practical RP Community est. 1999 - Apply Today!

User avatar
Rjmspoel
True Believer
 
Posts: 69
Joined: 01 Oct 2014, 12:44

Re: [MOD] Additional inventory items on character creation

Post by Rjmspoel » 10 Jul 2015, 15:52

Can not use a DELIMITER with BlueFang Servers it seems :(

You are running mysql db Azzerhoden?

User avatar
Azzerhoden
Alpha Tester
 
Posts: 1621
Joined: 08 May 2014, 17:44

Re: [MOD] Additional inventory items on character creation

Post by Azzerhoden » 10 Jul 2015, 16:25

I am, I run it on a NFOServer. I think you can run the trigger without specifying a delimiter though. I'm sure I saw something in another thread on these forums.
| - Alpha Tester and Zealous Believer
Image

Kingdom of Hyperion founding Duchy - A practical RP Community est. 1999 - Apply Today!


NavyS34l
 
Posts: 41
Joined: 15 Jun 2015, 16:12

Re: [MOD] Additional inventory items on character creation

Post by NavyS34l » 11 Jul 2015, 03:31

@Rjmspoel

Cant you just manually create the trigger from Heidi or whatever tool you're using and paste the BEGIN-END in? That is what I did and its working fine.

Thanks for the post Azzerhoden. I found out the same fix beforehand just didn't have time to post it, damn work in the AM.
Image

User avatar
Rjmspoel
True Believer
 
Posts: 69
Joined: 01 Oct 2014, 12:44

Re: [MOD] Additional inventory items on character creation

Post by Rjmspoel » 11 Jul 2015, 08:53

NavyS34l wrote:@Rjmspoel

Cant you just manually create the trigger from Heidi or whatever tool you're using and paste the BEGIN-END in? That is what I did and its working fine.

Thanks for the post Azzerhoden. I found out the same fix beforehand just didn't have time to post it, damn work in the AM.



Yea gonna do that and see if it works, complementary job Azzerhoden for experimenting, I can't just experiment on our server, people go mad if i screw up something and need a wipe :P


NavyS34l
 
Posts: 41
Joined: 15 Jun 2015, 16:12

Re: [MOD] Additional inventory items on character creation

Post by NavyS34l » 12 Jul 2015, 03:40

Yeah my server is the same way. Luckily if it doesnt work you can just delete the trigger and reboot, everything is good.
Image


Zhalls
Alpha Tester
 
Posts: 89
Joined: 14 Mar 2014, 19:30

Re: [MOD] Additional inventory items on character creation

Post by Zhalls » 13 Aug 2015, 05:25

Works flawlessly as of 8/12/15.
Thanks!


GriffinLion
 
Posts: 3
Joined: 13 Mar 2016, 01:11

Re: [MOD] Additional inventory items on character creation

Post by GriffinLion » 13 Mar 2016, 01:16

Hi all,

I'm extremely new to SQL scripts, the info here has helped me a lot in setting up my new rented server,

However after using the parameters you guys suggested i edited it to give metal tools & a low level horse.

I removed the horse code from the script in the Patch.sql file and re uploaded it, But still the horse spawns?

does the game add the feature into another SQL file somewhere that i also have to remove? so the horse no longer spawns in the starter kit.

Thanks for your help in advanced


Piter_Ragnarson
 
Posts: 3
Joined: 21 Nov 2013, 19:49

Re: [MOD] Additional inventory items on character creation

Post by Piter_Ragnarson » 19 Mar 2016, 11:02

GriffinLion wrote:Hi all,

I'm extremely new to SQL scripts, the info here has helped me a lot in setting up my new rented server,

However after using the parameters you guys suggested i edited it to give metal tools & a low level horse.

I removed the horse code from the script in the Patch.sql file and re uploaded it, But still the horse spawns?

does the game add the feature into another SQL file somewhere that i also have to remove? so the horse no longer spawns in the starter kit.

Thanks for your help in advanced


For ONE time add smth like this in your patch sql

DROP TRIGGER `asd`;
replace asd wjth the name of your trigger, that add tools and horses

add this line before your trigger
After one server restart you can delete this line.


Catherine
 
Posts: 31
Joined: 01 Mar 2016, 10:00

Re: [MOD] Additional inventory items on character creation

Post by Catherine » 30 Mar 2016, 11:20

non of the scripts wich are in this thread are working for me.
is there anyone who can help us with how and where to put the code and make it work properly

User avatar
Custodian
Mod Developer
 
Posts: 655
Joined: 08 Jun 2015, 14:58
Location: Lisbon

Re: [MOD] Additional inventory items on character creation

Post by Custodian » 30 Mar 2016, 11:22

Padme wrote:non of the scripts wich are in this thread are working for me.
is there anyone who can help us with how and where to put the code and make it work properly

You dont need to use any scripts.
Alter server file "data\cm_createchar.xml" to change startup items for different races.


Catherine
 
Posts: 31
Joined: 01 Mar 2016, 10:00

Re: [MOD] Additional inventory items on character creation

Post by Catherine » 30 Mar 2016, 11:39

Custodian wrote:
Padme wrote:non of the scripts wich are in this thread are working for me.
is there anyone who can help us with how and where to put the code and make it work properly

You dont need to use any scripts.
Alter server file "data\cm_createchar.xml" to change startup items for different races.



thx :D


Everettham
Alpha Tester
 
Posts: 56
Joined: 22 Apr 2014, 02:16

Re: [MOD] Additional inventory items on character creation

Post by Everettham » 09 May 2016, 19:10

Anyway to alter this code so that items spawn not just at character creation but after respawn from death as well?

Code: Select all
DELIMITER //
CREATE TRIGGER `character_after_insert` AFTER INSERT ON `character` FOR EACH ROW BEGIN
SET @backpack = f_createContainer(NEW.RootContainerID, 458, 0);
SET @temp = f_insertNewItemInventory(@backpack, 555, 50, 1, 50000, 50000, '', 0,0,0,0, 0,0);
END//


Cromesqui
 
Posts: 4
Joined: 23 Aug 2016, 08:43

Re: [MOD] Additional inventory items on character creation

Post by Cromesqui » 23 Aug 2016, 19:10

Custodian wrote:
Padme wrote:non of the scripts wich are in this thread are working for me.
is there anyone who can help us with how and where to put the code and make it work properly

You dont need to use any scripts.
Alter server file "data\cm_createchar.xml" to change startup items for different races.



it's works perfecly


Cromesqui
 
Posts: 4
Joined: 23 Aug 2016, 08:43

Re: [MOD] Additional inventory items on character creation

Post by Cromesqui » 23 Aug 2016, 19:12

[quote="Everettham"]Anyway to alter this code so that items spawn not just at character creation but after respawn from death as well?





need the same, i'd like to change the skill too, for poeples could us sword, bow and leather armor


Cromesqui
 
Posts: 4
Joined: 23 Aug 2016, 08:43

Re: [MOD] Additional inventory items on character creation

Post by Cromesqui » 23 Aug 2016, 19:19

to change add skill a creating char, it could be here? data skill_types.xml


i'm afraid it's cumulate skills points after respawning

Return to Game mods