Force names in action

Place to get help with not working mods / modding interface.
Post Reply
KaraUL!
Inserter
Inserter
Posts: 23
Joined: Sat Mar 21, 2015 7:59 pm
Contact:

Force names in action

Post 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.

Lollipop
Burner Inserter
Burner Inserter
Posts: 14
Joined: Sun May 24, 2015 8:57 am
Contact:

Re: Force names in action

Post 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:
untested code
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.

KaraUL!
Inserter
Inserter
Posts: 23
Joined: Sat Mar 21, 2015 7:59 pm
Contact:

Re: Force names in action

Post 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:
untested code
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.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Force names in action

Post 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?).

KaraUL!
Inserter
Inserter
Posts: 23
Joined: Sat Mar 21, 2015 7:59 pm
Contact:

Re: Force names in action

Post 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.

orzelek
Smart Inserter
Smart Inserter
Posts: 3911
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Force names in action

Post 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.

Post Reply

Return to “Modding help”