Page 1 of 1
Force names in action
Posted: Fri May 15, 2015 9:40 pm
by KaraUL!
Hi, i m trying to create custom projectile and using the following code (that works great):
Code: Select all
action =
{
{
type = "line",
range = 35,
width = 2.0,
force = "enemy",
...
But when i change the FORCE name from "enemy" to "neutral" or "player" - the game throws "unknown error" on starting. What are the reasons for this? Are there correct names for other forces? The purpose is to deal damage only to enemies and trees/rocks/etc., but not for player creations.
Re: Force names in action
Posted: Mon Jun 01, 2015 10:28 am
by Lollipop
I think you can hack your way around this one
I haven't tested it, but the command "setammodamagemodifier" should be able to help you.
I take it you use a modified railgun, in which case the ammo category should be "railgun". If you use another one, then use that one instead.
Then you would need a script on game.oninit, which sets the modifier for the force "player" to 0.
something along these lines:
As said, I haven't tested it, so the parameters might be called slightly different names, but it was all I could guess out of the wiki.
Re: Force names in action
Posted: Sat Jun 06, 2015 2:17 pm
by KaraUL!
Lollipop wrote:I think you can hack your way around this one
I haven't tested it, but the command "setammodamagemodifier" should be able to help you.
I take it you use a modified railgun, in which case the ammo category should be "railgun". If you use another one, then use that one instead.
Then you would need a script on game.oninit, which sets the modifier for the force "player" to 0.
something along these lines:
As said, I haven't tested it, so the parameters might be called slightly different names, but it was all I could guess out of the wiki.
Thanks for idea! Need to say that correct syntax of setammodamagemodifier is
Code: Select all
game.player.force.setammodamagemodifier("rocket", 0.5)
and in game.oninit event no players are created, so this code must be placed to onplayercreated event. HOWEVER it doesnot solve my problem) Setting damage modifier to 0 generates no changes in game, cause i think setammodamagemodifier affects on source( guns, turrets), but not on targets, like trees, biters or player creations.
Re: Force names in action
Posted: Sat Jun 06, 2015 2:27 pm
by orzelek
I had some tricks to do when adding new upgrade techs that affected currently existing turrets. I can confirm that damage modifiers are most likely attached to the prototype somehow. At least thats how it seems after playing around with techs that modify it.
If you change it in running game there might be no effect on already existing entities. But setting it to 0 at start should make given ammo do 0 damage (unless 0 is not accepted there?).
Re: Force names in action
Posted: Sat Jun 06, 2015 2:34 pm
by KaraUL!
But in this case given ammo will make 0 damage to targets of all types of game forces, right?? If that, i think the only way is to create new ammo-category and set resistance to this new category to 100% in all player entities.
Re: Force names in action
Posted: Sat Jun 06, 2015 5:04 pm
by orzelek
KaraUL! wrote:But in this case given ammo will make 0 damage to targets of all types of game forces, right?? If that, i think the only way is to create new ammo-category and set resistance to this new category to 100% in all player entities.
Ahh you meant to differ damage per force. Thats not possible - multiplier is for all damage.
Resistance trick might be better.