Forum

> > Stranded II > Scripts > Hit_damage script doesn't give the correct value
Forums overviewStranded II overview Scripts overviewLog in to reply

English Hit_damage script doesn't give the correct value

3 replies
To the start Previous 1 Next To the start

old Hit_damage script doesn't give the correct value

Stranded_Guy2910
User Off Offline

Quote
I created a script to verify the damage I give on a certain unit. That script was placed on the unit script:
1
2
3
4
on:hit {
	$damage=hit_damage("self");
	msg "damage:$damage";
}

The code works fine but when I use weapons that give me additional damage just like that:
1
2
3
4
5
on:impact {
		$tmp=impact_class();
		$tmp2=impact_id();
		damage $tmp,$tmp2,10;
}
It gives me the damage without the addition. For example, in that case, if the original weapon has 5 damage I'll get this messenge "damage:5.0" instead of "damage:15.0".

Can anyone help me?

old Re: Hit_damage script doesn't give the correct value

Assassin moder
User Off Offline

Quote
Scripts is working but in unit section that script:
1
msg "damage:$damage";

is getting default item damage var

Here is example:
Arrow have 16 dmg + bow 1 dmg
hits unit - taking 17 hp
added bonus damage by script is 10
script still show you 17 dmg but getting 27 hp from unit

I'ts not possible to set that but I have here another script

Unit:
1
2
3
4
on:hit {
	$hp=health("self");
	msg "Unit have $hp health";
}

I show you an example:

hit unit by arrow + bow + bonus damage(unit have 100hp)
msg - "Unit have 67 health"

Reply if I help
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview