Page 1 of 1

Making Snails shoot. Poison.

Posted: Sun Jun 29, 2014 11:22 pm
by Chimera005ao
Using other, older threads around here I was able to get my snails to shoot a projectile.
However, the projectile does not seem to trigger an onDealDamage check.
I'm hesitant to use the onProjectileHit hook for the party, as it seems I would have to tie the poison affliction level to the damage of the projectile, which may not really be an issue, but I'd like to have it based on the enemy throwing the projectile instead.

The code in quesiton should just involve these I believe.

Code: Select all

	rangedAttack = "poison_bolt",
	
	defineAnimationEvent{
   animation = "mod_assets/animations/poison_snail/poison_snail_attack.fbx",
   event = "ranged_attack",
   frame = 10,
	},
	
	onDealDamage = function(self, champion, damage)
			--champion:setConditionCumulative("poison", 7)
			print ("hit")
	end,

Re: Making Snails shoot. Poison.

Posted: Mon Jun 30, 2014 1:52 am
by Grimfan
onDealDamage is normally for melee attacks afaik but you could simply create a new spell like a poison_snail_bolt and have the snail shoot that instead. You could then set the damage to whatever you want. I personally haven't looked into ranged attacks for non-ranged monsters though, so perhaps someone else has had a similar problem and found a more innovative fix?

Re: Making Snails shoot. Poison.

Posted: Mon Jun 30, 2014 2:10 am
by Chimera005ao
For the poison_bolt spell it says onCast = "poisonBolt"
The spells have no information for the effects they cause, only information for the spell itself, casting requirements and such.
I suppose that confuses me, especially since I made a spell that has the function defining its effects right there.

*actually, I see that poisonBolt is defined under objects. I shall poke around there.

Re: Making Snails shoot. Poison.

Posted: Mon Jun 30, 2014 2:18 am
by Grimfan
Spells are defined as objects in the asset pack. You can find poison_bolt (and all the other spells) there and create your own poison_bolt with a modified attack power and a different name.

* Beaten to the punch. Ha!

EDIT: I think the only problem you might have is that the game won't recognize your new spell and your ranged snails won't shoot it (even though they will go through the animation). To avoid that you'll need to have the snail spawn the bolt itself with the onRangedAttack function (since you seem well-versed in scripting already this should not be an issue).

Again, I defer to my compatriots on his one. They may have a more elegant and robust solution to your snail problem.

Re: Making Snails shoot. Poison.

Posted: Mon Jun 30, 2014 4:32 am
by Chimera005ao
I got a new projectile, and some more understanding for how these scripts interconnect (made a blue poison_bolt that does 2 damage ; P)

I think I'm going to have to go back toward the original idea. Except instead of being tied to damage, at least it is tied to a new projectile.
Too bad I'll have to add a trigger to every monster if I ever decide to let the player use such spells.

Thanks.