Page 1 of 2

New arrow problem

Posted: Sun Nov 25, 2012 11:30 pm
by LordGarth
Hell all.

I have made new arrows and when I shoot and recover them, they are not the same arrow. Each arrow reverts back to broadhead arrow.

I pick them up as steel arrow but when I shoot a monster and the arrow falls and I pick the arrow up later, it is now a broad head arrow.

This is the case wether it is a sharp projectile or not.

Need help

Thx,

LG

Re: New arrow problem

Posted: Mon Nov 26, 2012 1:07 am
by Grimwold
The sharp property of projectiles means whether it will get stuck in the monster and be dropped when it dies... sharp = gets stuck. blunt = drops to the floor when thrown.

Re: New arrow problem

Posted: Mon Nov 26, 2012 2:08 am
by Komag
You need to define a whole new class IIRC, since all the special arrows are already hardcoded to revert to broadhead after using them.

Re: New arrow problem

Posted: Mon Nov 26, 2012 7:32 am
by msyblade
I agree,this is a matter of defineObject vs cloneObject. Define a new projectile instead of cloning the original.

Re: New arrow problem

Posted: Mon Nov 26, 2012 11:37 am
by Komag
I think in this case it's also more than that, but I haven't done it myself so I'm not 100% sure. But it came up recently, to do with weapon ammo or something

Re: New arrow problem

Posted: Mon Nov 26, 2012 4:51 pm
by msyblade
I also have not tried this, but I think a workaround is possible. Redefine the sling, with name/pics/models you want, and "ammo" = whatever you want it to shoot. If that does not work, redefine the name of your ammo to rock, (hopefully) keeping the other properties in tact. Again haven't tried this, but i'm betting the "Arrow class" of ammo is hardcoded to revert to broadhead upon use, as Komag suggested.Rock ammo type is not.

Re: New arrow problem

Posted: Mon Nov 26, 2012 5:17 pm
by Grimwold
creating a new ammoType seems to work well... here's my "Knife Thrower" (looks like a crossbow!) that fires "knife" ammo

Code: Select all

	defineObject{
		name = "knife_ammo",
		class = "Item",
		uiName = "Knife Ammo",
		model = "assets/models/items/throwing_knife.fbx",
		ammoType = "knife",
		gfxIndex = 42,
		attackPower = 8,
		coolDownTime = 4,
		impactSound = "impact_blade",
		stackable = true,
		sharpProjectile = true,
		projectileRotationSpeed = 0,
		projectileRotationX = 90,
		projectileRotationY = 90,
		weight = 0.2,
	}

	defineObject{
		name = "knife_thrower",
		class = "Item",
		uiName = "Knife Thrower",
		model = "assets/models/items/crossbow.fbx",
		skill = "missile_weapons",
		gfxIndex = 14,
		attackPower = 20,
		coolDownTime = 5.5,
		attackMethod = "rangedAttack",
		attackSound = "swipe_bow",
		impactSound = "impact_blunt",
		rangedWeapon = true,
		ammo = "knife",
		weight = 1.5,
	}
as long as you have an "ammoType=" declaration within the item you want to use as your ammo, that matches with an "ammo = " declaration in your item to use as your weapon.

Of course this means a standard bow will not fire this ammo... but you could redefine the bows and arrows to use a new ammo type, say called "new_arrow".. and use that for all new and existing bows/arrows.

Re: New arrow problem

Posted: Mon Nov 26, 2012 6:41 pm
by Diarmuid
I'm very interested in this as well... But if you redefine a new ammo for all arrows and bows, will you lose the functionality of enchanted arrows reverting back to normal? Or if you clone, let's say, a fire arrow it will work?

Re: New arrow problem

Posted: Mon Nov 26, 2012 6:51 pm
by Grimwold
Diarmuid wrote:I'm very interested in this as well... But if you redefine a new ammo for all arrows and bows, will you lose the functionality of enchanted arrows reverting back to normal? Or if you clone, let's say, a fire arrow it will work?
I've just tested it myself using a "newarrow" ammo type for the original arrows and yes, you do lose the reversion (e.g. poison arrows stay as poison arrows after the monster dies)... so that must be hardcoded to the "arrow" ammo type.

There would probably be a workaround using the onProjectileHit() monster hook to convert any fired poison arrows to broadhead arrows. (or possibly onDie() to check for any arrows dropped by the monster)

Re: New arrow problem

Posted: Mon Nov 26, 2012 8:56 pm
by LordGarth
It works

Just name all new arrows with ammotype "arrow1" and in the bows code ammo = "arrow1",

All new arrows stay what they are. I tried my steel arrows, slayer arrows, ghost arrow and planar arrow.

And they all stayed what they are after hitting a monster.

YAY

I should be getting some ram tomorrow and then I hope I can export to dat file with 8 gig ram.

Then I just have to playtest and I can finally release my game.

LG