Posted: . At: 7:27 AM. This was 7 months ago. Post ID: 18463
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.



Sponsored



How to add a script to an item in the Arma Reforger editor.


Adding a script component to an item in the Arma Reforger world editor is easy.

Give the entity a unique name in the editor. I named it ‘bottle1’.

Naming an entity in the Reforger World Editor.

Then click the + sign on the blue Script option to open the script editor.

Here is the sample script I got.

1
2
3
4
5
6
7
8
9
class bottle1_Class: GenericEntity 
{
	override void EOnInit(IEntity owner)
	{
		/* code here */
 
	}
 
};

There does need to be sample scripts around, it is very hard to learn scripting when you can not find a sample to make an item glow or make it interactive.

But I did find this script, this is a sample modded scoring system.

SCR_ScoringSystemComponent.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
modded class SCR_ScoringSystemComponent : SCR_BaseScoringSystemComponent
{
	override int CalculateScore(SCR_ScoreInfo info)
	{
		// We are replacing there modifiers which would normally provided via parameters 
		// m_iDeathScoreMultiplier is replaced by 10
		// m_iSuicideScoreMultiplier is also replaced by 10
		// That translates into situation where for every death or suicide, you are getting ten shiny points!
		int score = info.m_iKills 		* m_iKillScoreMultiplier +
					info.m_iTeamKills 	* m_iTeamKillScoreMultiplier +
					info.m_iDeaths		* 10 +
					info.m_iSuicides 	* 10 +
					info.m_iObjectives 	* m_iObjectiveScoreMultiplier;
 
		// Original  code from CalculateScore - we are leaving it untouched 
		if (score < 0)
			return 0;
 
		return score;
	}	
}

This is another sample script, this is how to play a sound in-game.

SCR_BaseScoringSystemComponent.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// "modded" keyword lets you modify already existing script classes
modded class SCR_BaseScoringSystemComponent : SCR_BaseGameModeComponent
{
	// Method which is called when someone commits suicide in game
	override void AddSuicide(int playerId, int count = 1)
	{
		// If you only want expand already existing method without modifying already existing logic then you can
		// use "super" keyword to invoke original method
		super.AddSuicide(playerId,count);
 
		// Play additional non spatial sound when someone commits suicide
		AudioSystem.PlaySound("{9BB653FF9E065943}Sounds/Animals/Bos_Taurus/Samples/bawl/bawl_0.wav");
	}
}

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.