Blockland Forums > Suggestions & Requests
Custom weapon eventing
lordician:
--- Quote from: A Twig on May 08, 2010, 09:37:30 AM ---
--- End quote ---
You can't explain what i am thinking unless you can read minds.
And this time, you are wrong too.
Space Guy:
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...
Peejster:
--- Quote from: Slugger on May 07, 2010, 11:48:13 PM ---This would be impossible.
--- End quote ---
Not so. It could be done, but take up an ungodly amount of datablocks.
lordician:
--- Quote from: Space Guy on May 08, 2010, 10:50:14 AM ---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...
--- End quote ---
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. ;)
lordician:
Bumpercars.