Jump to content

I'm stuck and need other modders help!


Austin

Recommended Posts

Alright, so we have a bow that has it's AmmoType=HomemadeArrows

 

But, well of course, it doesn't use the arrows at all. It just shoots like one of those shoot em' up games. Anyway, is there a way to stop this from happening? Tried almost every trick in the book.. But nope.

Link to comment
Share on other sites

I mean, it doesn't need ammo, at all..

 

and there isn't really much code to post..

item HomemadeBow	{		AmmoType	=	HomemadeArrows,		ImpactSound	=	null,		MaxRange	=	18,		RangeFalloff	=	TRUE,		WeaponSprite	=	null,		SoundVolume	=	200,		MinAngle	=	0.7,		Type	=	Weapon,		MinimumSwingTime	=	2,		ToHitModifier	=	1.5,		NPCSoundBoost	=	1.5,		KnockBackOnNoDeath	=	FALSE,		Ranged	=	TRUE,		SwingAmountBeforeImpact	=	0,		ProjectileCount	=	1,		ConditionLowerChanceOneIn	=	60,		Weight	=	1.7,		SplatNumber	=	1,		PushBackMod	=	0.8,		MaxDamage	=	1,		SubCategory	=	Firearm,		AimingMod	=	2,		ConditionMax	=	10,		ShareDamage	=	FALSE,		MaxHitCount	=	1,		IsAimedHandWeapon	=	TRUE,		IsAimedFirearm	=	TRUE,		DoorDamage	=	1,		IdleAnim	=	Idle_Weapon2,		UseEndurance	=	FALSE,		SwingAnim	=	Rifle,		WeaponWeight	=	2,		DisplayName	=	Homemade Bow,		MinRange	=	0.61,		SwingTime	=	2,		AngleFalloff	=	TRUE,		MultipleHitConditionAffected	=	FALSE,		SwingSound	=	stab1,		SoundRadius	=	5,		MinDamage	=	0.3,		KnockdownMod	=	8,		SplatBloodOnNoDeath	=	FALSE,		Icon	=	Shotgun2,		RunAnim	=	Run_Weapon2,	}
Link to comment
Share on other sites

Please don't just post "resolved" here. Instead post your solution so that people who happen to come across the same issue can find it here.

Alright, apologies.

 

The weapons weren't actually even getting the ammo.. So I created a new .lua, just to keep separate from the distribution file, and added a new function. I looked through all the files looking for some way of getting the PrimaryHandItem. I found it. I also looked through(with some help from Aricane) stormy's reloading code. Hook.Attack.Add. That was the code I used to trigger on attack. So the code I ended up with was...

function checkInvForAmmo(character, chargeDelta)	local weapon = character:getPrimaryHandItem();	local inventory = character:getInventory();	if weapon:getType() == "bow0" then		if inventory:contains("Bolts") then			character:DoAttack(chargeDelta);			inventory:RemoveOneOf("Bolts");			else			character:setPrimaryHandItem(nil);			character:say("I'm out of ammo for that weapon!");		end	endendHook.Attack.Add(checkInvForAmmo);
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...