Author Topic: Custom weapon eventing  (Read 2322 times)


Adjusting the fire rate or method (e.g. click lots like gun, hold down like bow) would be annoying, hard or impossible depending on the flexibility of weapon images.

Weapon->setModel is impossible without using loads of new datablocks for every kind of weapon you want. They'd also all be the same colour since you can't adjust the colorshift of one person's weapon versus another.

Weapon->spawnEmitter is likely to be impossible unless you preset two or three emitters in the code and then only those ones can be used.

Some kind of "playAnimation" would be possible but not at the same time as the emitters one.

Adjusting the projectiles is possible.

I'm not sure how you'd attempt "Weapon->spawnProjectile" but it might work with some hacky script object type things.

I had an idea a while back for something similar to this (never posted it though) some kind of events item used like the Pill rather than a weapon, so you could have "onPillUsed -> Player -> setPlayerScale" or whatever.
« Last Edit: May 08, 2010, 07:41:16 AM by Space Guy »

"onPillUsed -> Player -> setPlayerScale" or whatever.
How would that work with bricks though? That is why my idea of field events would be useful.

It would work on a special item linked to the brick when you pick it up.

Adjusting the fire rate or method (e.g. click lots like gun, hold down like bow) would be annoying, hard or impossible depending on the flexibility of weapon images.

Weapon->setModel is impossible without using loads of new datablocks for every kind of weapon you want. They'd also all be the same colour since you can't adjust the colorshift of one person's weapon versus another.

Weapon->spawnEmitter is likely to be impossible unless you preset two or three emitters in the code and then only those ones can be used.

Some kind of "playAnimation" would be possible but not at the same time as the emitters one.

Adjusting the projectiles is possible.

I'm not sure how you'd attempt "Weapon->spawnProjectile" but it might work with some hacky script object type things.

I had an idea a while back for something similar to this (never posted it though) some kind of events item used like the Pill rather than a weapon, so you could have "onPillUsed -> Player -> setPlayerScale" or whatever.
Hmm, sadly, not fully possible i see?

Well, perhaps it wasn't a good idea to determine the model.

-Default custom weapon model= printer
-SpawnProjectile : Just from the Muzzlepoint
-SpawnEmitter : Sets an emitter and after the time determined behind it it goes back to sending out no emitter. (Possible like this?)
-PlayAnimation could be done with bot events.
For example: OnCustomWeaponFire-Player-PlayAnimation-[Default player animation here]

As far as I know emitters can only be done by pre-set ones in the datablocks. What would work are a few limited presets like "Gun Flash" or "Rocket L. Spark" but not every single type in the game.

What would work is a couple items like "Event Gun" "Event Sword" "Event Rocket" to determine firing type, timing and the presets and then you can trigger things events on the brick that spawned it whenever the weapon is fired/hits/whatever.

As far as I know emitters can only be done by pre-set ones in the datablocks. What would work are a few limited presets like "Gun Flash" or "Rocket L. Spark" but not every single type in the game.

What would work is a couple items like "Event Gun" "Event Sword" "Event Rocket" to determine firing type, timing and the presets and then you can trigger things events on the brick that spawned it whenever the weapon is fired/hits/whatever.
Hmm, so you can't just change the particle emitter to an allready existing emitter?

Also, i don't really care as long as it catches the essence of this. ;P

Imagine:
Damage could be done with events, special actions like unmounting, changing datablock, healing or whatever.
I would really like the possibilities of it.

I'm pretty sure special effects for "on hit" are possible.

I might have a go at doing some of this as a basic test.

I'm pretty sure special effects for "on hit" are possible.

I might have a go at doing some of this as a basic test.
Great!
Please post some results of the test afterwards. ;)

What i see him thinking, though I'm going to fix this.

Get rid of emitter thing.
Keep Animation, Projectile, and whatever else you want.

I see a GUI where you have this empty space in the middle, you can like click tabs on the side, or a scroll list that shows the .dts files on the server this second. You select, lets say the sniper .dts, OK you want to add something else, there would have to be a tool to place a marker on some part of the model to attach another .dts file to that specified, so the sniper .dts with maybe an extra hand at the end, and there would have to be a thing that lets you decide to remove the left or right hand, to keep both in front of you, or one only, so you could make it look like a 2 handed sniper. This I'd very much love to see.

There could be some sort of color changer, idk if this is even possible but it'd give style.

Projectile change, there may want to be some RTB prefs for this, so you can select which projectiles to block people from using on their weapon (Example :
Code: [Select]
Mini Nuke - Rocket Launcher Projectile)
Emitters fail because it may cause lag.

Animation like if you swing your hand up when fire, if it's a sword, if you don't do animation, custom animation, ect.

Hope this helps people understand what it this probably means in the guys head.
Probably explained it a bit better.
I'm pretty sure special effects for "on hit" are possible.

I might have a go at doing some of this as a basic test.

Nvm, emitter for bullet hit i change my mind.

You can't explain what i am thinking unless you can read minds.

And this time, you are wrong too.

Currently I have it like this:

Inputs
onItemUse
onItemUnUse
onItemTrigger
onItemProjectileHit
(my existing onItemPickup event is compatible)

Outputs
Weapon -> spawnProjectile
Weapon -> spawnExplosion
Weapon -> setTimeout (Delays firing for a set time)
Weapon -> playSound (Plays a sound like most normal guns do)

If you pick up the specially created item "Event Gun", these events all work with it, triggering on the brick you got it from.

onItemTrigger -> Weapon -> playSound [spearFire.wav]
onItemTrigger -> Weapon -> spawnProjectile [90, Spear, "0 0 0" no spread, 0.5]
onItemTrigger -> Weapon -> setTimeout [500]

(Clicking fires a half-scale spear very fast)

onItemProjectileHit -> Target -> setPlayerScale [0.3]
(Shrinks target on hit)

I'm not sure whether the projectile should deal damage. Perhaps it does unless there are any on-hit events/effects?

spawnExplosion works for making some of the "emitter" effects, but they don't stick to the end of the gun so if you walk and fire at the same time the particles stay in mid-air behind you...
« Last Edit: May 08, 2010, 11:49:37 AM by Space Guy »

This would be impossible.
Not so. It could be done, but take up an ungodly amount of datablocks.

Currently I have it like this:

Inputs
onItemUse
onItemUnUse
onItemTrigger
onItemProjectileHit
(my existing onItemPickup event is compatible)

Outputs
Weapon -> spawnProjectile
Weapon -> spawnExplosion
Weapon -> setTimeout (Delays firing for a set time)
Weapon -> playSound (Plays a sound like most normal guns do)

If you pick up the specially created item "Event Gun", these events all work with it, triggering on the brick you got it from.

onItemTrigger -> Weapon -> playSound [spearFire.wav]
onItemTrigger -> Weapon -> spawnProjectile [90, Spear, "0 0 0" no spread, 0.5]
onItemTrigger -> Weapon -> setTimeout [500]

(Clicking fires a half-scale spear very fast)

onItemProjectileHit -> Target -> setPlayerScale [0.3]
(Shrinks target on hit)

I'm not sure whether the projectile should deal damage. Perhaps it does unless there are any on-hit events/effects?

spawnExplosion works for making some of the "emitter" effects, but they don't stick to the end of the gun so if you walk and fire at the same time the particles stay in mid-air behind you...
These are quite some cool things.
It really catches the essence of this.

The projectile shouldn't damage directly as you can event that, you could even event it so that it heals you.

You got me all excited. ;)