Poll

Good idea?

Very good
18 (58.1%)
Good
5 (16.1%)
Ok
5 (16.1%)
Bad
1 (3.2%)
Very bad
2 (6.5%)

Total Members Voted: 31

Author Topic: VCE Weapons - Customisable Weapons using Events  (Read 4595 times)

Instead of modfying every weapon, I planned on doing something different.

Since I can't change the weapon, I'll change the damage that the player receives.

(First we must heal the player, and set up all of the values)

Code: [Select]
[X] 0 [0] onActivate -> Player -> addHealth -> [999]
[X] 1 [0] onActivate -> Player -> VCE_modVariable -> [hp] set [<var:pl:health>]
[X] 2 [0] onActivate -> Player -> VCE_modVariable -> [def] set [0] (This is the player's defense)

(For now, I'm setting the hp to the player's health. We can later use <var:pl:hpmax> for when the player earns more health)

Code: [Select]
[X] 3 [0] onActivate -> Self -> VCE_stateFunction -> [<var:cl:bl_id>] [ ]
[X] 4 [0] onActivate -> Self -> VCE_callFunction -> [<var:cl:bl_id>] [ ]
[X] 5 [33] onVariableFunction -> Self -> VCE_callFunction -> [<var:cl:bl_id>] [ ]

(The above events allow each player to have their own function. It's more reliable than using a print count loop.)

(Now we start up the health system)

Code: [Select]
[X] 6 [0] onVariableFunction -> Self -> VCE_ifValue -> [<var:pl:maxhealth>] != [<var:pl:health>] [7 9] (If the player is hurt...)
[X] 7 [0] onVariableTrue -> Player -> VCE_modVariable -> [dam] set [<var:pl:damage>] (We need to be able to tweak this, so we make a copy)
[X] 8 [0] onVariableTrue -> Player -> VCE_modVariable -> [dam] subtract [<var:pl:def>] (Lower the damage by our defense)
[X] 9 [0] onVariableTrue -> Player -> VCE_ifVariable -> [dam] > [0] [10 13] (If there is still some damage)
[X] 10 [0] onVariableTrue -> Player -> VCE_modVariable -> [<var:pl:hp>] subtract [<var:pl:damage>] (Deal the damage to our variable)
[X] 11 [0] onVariableTrue -> Self -> VCE_ifValue -> [<var:pl:hp>] <= [0] [ ] (If the player should be dead..)
[X] 12 [0] onVariableTrue -> Player -> Kill (Kill the player)
[X] 13 [0] onVariableFalse -> Player -> addHealth [999] (If not, heal the player's actual health)

This should lower the damage by our said defense, and the player's usable health points may be adjusted is desired.

These events still allow instant killing weapons (Those that do 100 or more be default) to instantly be killed.

-Snip-

I know those events, but they do not change:
Speed
Range
Explosion Size
Name
or Projectile

And there is no way to with current events. Which is why ive requested them.

I know what you want.

You want to be able to customize your weapon. Instead, I'm taking the approach that lies on the opposite end of the spectrum.

Instead of customizing the weapon, customize the victims.

But customising the victims cant change a weapons name.

One problem is how you'd actually go about setting up these weapons on a server. You're saying to use "<var:weapon[name]:[attributes]>" but that sort of thing would have to be changed through a lot of tedious near-identical events and would most likely only be set once and then left, since you're defining it per weapon type rather than per player.

Using variables to change a bow to temporarily shoot fire arrows would be helpful, having it suddenly change for everyone on the server is not.

Maybe i didnt make it clear enough.

By "Weapon" i mean the single weapon, that the player has. Not all the weapons of that type on the server.

Chances are, too much would have to be done.

However, let's say you made a bow that didn't fire an arrow. I could rig this up with events to all you to shoot any kind of arrow, at nearly any speed or size. I could also implement ammo.

This is probably as far as I could take it.

Maybe i didnt make it clear enough.

By "Weapon" i mean the single weapon, that the player has. Not all the weapons of that type on the server.

What you don't understand is that this is damn near impossible. Each player would have to have their own weapon datablock. Changing datablocks, creating datablocks, and deleting datablocks if just too must to ask for a server to handle.

Instead of continuing to push for something impossible, go for the next best thing, which I am trying to offer you.

In Team Fortress 2, there's various parts of a system for creating items with different attributes, similar to what I think you're suggesting. Theirs is in two parts: various "unique" weapons that come pre-determined with different names, and ones with simple stat adjustments. I'm not sure whether you're looking for one, the other or both.

For instance, you could run into a person who's carrying the unique 'Force-A-Nature' shotgun variant. No matter which person has it, it always has these attributes:
Quote
Blockhead is wielding The Force-A-Nature
Knockback on target and shooter
+50% faster firing speed
+20% bullets per shot

-10% damage done
-60% clip size


The other method has various generated items, where one of the default types in the game is modified with some positive and some negative stats and given to one specific player's loadout. For example, a person finds or is given this:
Quote
Blockhead is wielding Common Pistol
+25% damage done
-30% fire rate

In the actual game this wasn't used much, only to test it by giving developers ones with lots of overpowered functions for fun, but in Blockland this goes very well with the event system so you can add functions to specific player's items e.g. "bow shoots fire arrows" for a challenge, "explosive shotgun" powerup.



For the 'unique' items I'd suggest having them all created from a file when you create the server, with the changes listed:

config/server/statWeapons/mortar.txt
Code: [Select]
Mortar L.
BASE Rocket L.
HIDDEN PROJECTILE gravityRocketProjectile
DESC "Rockets launch in an arc"
DAMAGE 1.2
RADIUS 1.5
SPEED 0.75
RATE 0.67

Quote
Mortar L.
Projectiles launch in an arc
+20% damage
+50% splash radius

-25% projectile speed
-33% fire rate

For the other system there'd be some events where you pick a weapon type (e.g. any, all Bows, specific "Iron Sword", current slot) to either apply an individual change to plus a value or to clear changes for.



Note that if this was to be made, in order to adjust the fire rate it would have to apply only to weapon types specifically made for it and changing the projectile to ones with special effects would most likely not work with changing the damage amount.
« Last Edit: August 19, 2010, 03:17:12 PM by Space Guy »

That's just creating a bunch of weapons. I think he is wanting a weapon where you can change/view the stats at will while the server is running.

It's the changing of datablocks that has me concerned.

It depends on how it's done. You can change the firing rate without extra datablocks by hacking the state system a lot, but that's why it needs the weapons to be specifically designed for it. If he wants the colour of it changed then it won't work, and I don't know how the item displaying works so changing the name may or may not be possible. (Unless the ones created at server startup are the only ones able to be named but have unique item datablocks with a shared weapon image datablock)

Honestly, i have no idea how it will work. If i did, i would of made it already, or found it imposable and locked the topic. What i can do is tell people who do understand what i want, and how its done. Ive done those in the OP, i cant help anymore than that.

Could my previous method be of any help?
The weapons could fire a projectile, that does 0 damage, and the events make a raycast that damages the hit object as much as the variable? Could be glitchy with moving targets..

Not particularly. You wanted the events to include being able to change the projectile, re-scripting every other projectile from any gun that exists to use that would be annoying.

You could try just altering the item
temporerily for example a client buys a damage upgrade for his gun which adds 5 damage to each shot. The next time he picks up a gun the changes are gone.

How about a variable for firing rate/burst fire

i.e. 3 shot bursts, 1 shot or fully auto.