Page 1 of 1

Fire the CANNONS!

Posted: Thu Sep 24, 2015 1:19 am
by Emera Nova
So I'm working on something at the moment and I'd like to make it so after some text pops up (AKA Fire the cannons) a few spawners will be triggered to fire a cannonball at the party much like if you had the ratling boss firing his cannon. How do I set it up so that I have a projectile that is a cannonball that I can have shot out of a spawner.

Code: Select all

defineObject{
	name = "test_cannonball",
	baseObject = "cannon_ball",
	components = {
		{
			class = "Model",
			model = "assets/models/items/cannon_ball.fbx",
		},
		{
			class = "Projectile",
			impactSound = "gun_shot_cannon",
			spawnOffsetY = 1.35,
			velocity = 10,
			projectileRotationSpeed = 10,
			projectileRotationZ = -30,
			radius = 0.1,
		},
	},
}
xD this works as far as shooting a ball at the party but it doesn't deal damage, it also throws up an error after hitting the party.

Re: Fire the CANNONS!

Posted: Thu Sep 24, 2015 1:49 am
by minmay
1. cannon shots aren't projectiles, firearm attacks don't work like projectiles at all. They are arguably more similar to melee attacks. Look at the definitions for ratlings to see how to make a firearm attack without using an item with a FirearmAttackComponent.

2. you are getting an error because you are trying to make a thrown item by adding a ProjectileComponent yourself. You should NEVER manually add a ProjectileComponent to an object with an ItemComponent. You HAVE to use ItemComponent:throwItem().

Re: Fire the CANNONS!

Posted: Thu Sep 24, 2015 4:21 pm
by Emera Nova
Thanks minmay, I'll take a look at that, for now I've put in the ratling boss without the ability to move and his model turned off so he can fire off the attack.