• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ ideals or help for weapons system

2057623

Member
Joined
Jan 16, 2012
Messages
130
Reaction score
15
Hi, guys, I wanted to know if anyone can give me any ideas or even help. I want to and I'm setting up a server similar to Tibiagun, but it's going to be 100% different, lol. I just wanted a shooting system like his. I can make the system by items.xml. I added new ammoType attributes to the source. Each ammunition has its attribute with its effect. It works via items.xml. The problem is that in items.xml you can only configure one type of ammotype. It doesn't recognize 2 or more. I wanted to be able to configure other things, like how many effects will come out if it's a machine gun, etc. But I've tried several ways to come up with a way, but I couldn't. So I went to chatGPT and asked for help, but nothing either. I had the idea of trying to make it recognize more than one type of ammunition in the ammoType attributes, but it gave me 1001 problems. If anyone can help me, I'll be really grateful. I've been trying to find a way for over a week, but without success.

As I said, I use the Hellgrave server, which is available on a forum that I downloaded. I don't know if it's available here, but it's available on a Brazilian forum. It's TFs 1.3x, just to be on the record, lol.
 
If you want several effects or such you could try:
1. Create a custom weapons scripts for each weapon.
2. Make source changes to look for a secondary effect.
3. Create a global script which includes all weapons in an array.
 
If you want several effects or such you could try:
1. Create a custom weapons scripts for each weapon.
2. Make source changes to look for a secondary effect.
3. Create a global script which includes all weapons in an array.

So but how am I going to create, the ones I created it didn't work, for it to work I had to configure everything in the items.xml then it works and it does the ammunition effect, I've tried actions, lib, weapons, I've tried a lot of poor things but nothing researched.
 

Mjmackan

gave to you best ideas how to handle with it.​

i would only add that you can create a function like

"onWeaponUse" (i think it exsists already, but it must work with xml values and script - so rework here need) for lua side, add new origins, new types of weapons, and simply sort these weapons by id and create a table like

LUA:
local Weapons = {
  [ID XXXX] = {
      ORIGIN_TYPE = 6,
      EFFECT_ON_TARGET = CONST_ME_MAGIC_GREEN,
      additionalConditions = {},
      spell = { "Berserk", chance = 0.7, cooldown = 30000 },
  },
  [ID XXXX] = {
      ORIGIN_TYPE = 6,
      EFFECT_ON_TARGET = CONST_ME_MAGIC_GREEN,
      additionalConditions = {},
      createSpell = { radius = 6, DAMAGE_TYPE = 2, minDamage = 5, maxDamage = 10, chance = 0.6, cooldown = 20000 }
  }
}

then create some functions that player will cast exists spell or it will create a spell (like in monsters)

and so on, good luck with your project!
 
Last edited:

Mjmackan

gave to you best ideas how to handle with it.​

i would only add that you can create a function like

"onWeaponUse" (i think it exsists already, but it must work with xml values and script - so rework here need) for lua side, add new origins, new types of weapons, and simply sort these weapons by id and create a table like

LUA:
local Weapons = {
  [ID XXXX] = {
      ORIGIN_TYPE = 6,
      EFFECT_ON_TARGET = CONST_ME_MAGIC_GREEN,
      additionalConditions = {},
      spell = { "Berserk", chance = 0.7, cooldown = 30000 },
  },
  [ID XXXX] = {
      ORIGIN_TYPE = 6,
      EFFECT_ON_TARGET = CONST_ME_MAGIC_GREEN,
      additionalConditions = {},
      createSpell = { radius = 6, DAMAGE_TYPE = 2, minDamage = 5, maxDamage = 10, chance = 0.6, cooldown = 20000 }
  }
}

then create some functions that player will cast exists spell or it will create a spell (like in monsters)

and so on, good luck with your project!

But that's the problem Mjmackan said, but he said it.
1. Create custom weapon scripts for each weapon.
I've already tried creating actions or in other folders, but it didn't work, because if I had managed to do it as easily as you say, I wouldn't even be losing it, lol.

He talked about changes, ok, the source has countless files, countless lines in each file, I don't know which part works.

And about your code, you told me to create "onWeaponUse", thanks for the idea, but I don't know anything about how to create this function, I've tried several ways but none of them worked, I want something organized like you said, but everything I did didn't work, either it didn't attack or it gave 1001 errors, if it were as easy for me as Mjmackan said, I wouldn't even be here, lol. But thanks for the answer, I'll wait and see if anyone has a simpler solution like the one you need to fix.
 
Back
Top