Jump to content
gokitty1199

Dayz standalone Scripting tutorial series

Recommended Posts

In correlation to my Arma 3 scripting series, I now present a Dayz standalone scripting series. This will start from the very beginning to help people just starting to get a feel and understanding on setting up their mission and writing the scripts in general.

 

What has been covered so far:

E1: Very beginner introduction covering data types, arrays and such along with classes.
E2: Introduction to actually scripting in enfusion and how to make your script run with more in depth examples of classes and methods.
E2: How to spawn a weapon on your character and add attachments to that weapon in your hands.
E3: How to spawn a car and add various vehicle components to the vehicle such as wheels and needed fluids for it to run.
E4: How to override the TickScheduler function and setup our code properly inside of it.
E4: What are and how to use static variables as a control variable so we can make our script only run every X amount of seconds when we want.

 

The introduction is a little bit scattered as I was in a bit of a rush, but it should be easy enough to follow along with.

DayZ Standalone Scripting Tutorial Playlist:

 

Latest Video:

 

Edited by gokitty1199
  • Like 4
  • Thanks 4
  • Beans 3

Share this post


Link to post
Share on other sites

I haven't found the time to dive into modding yet, but this is definitely going to be a big help, thank you!

Couple suggestions though:

  1. Edit out unnecessary bits, like waiting for the game to boot.
  2. Plan what you're going to show throughout your tutorial beforehand, and record yourself doing it in smaller sections. There's lots of benefits for your audience from doing this:
    1. No "uhs" and "ahms"
    2. Less time spent on typos and "oh wait, damn it." (Showing small code mistakes like the weapon attachment part can be useful sometimes, though.)
    3. You won't be rambling or distracted by irrelevant things, like the contextual auto-suggest thing.
    4. Better structured tutorials, and it'll be easier for you to redo a part if you feel like you want to.
Edited by Dancing.Russian.Man
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
20 minutes ago, Dancing.Russian.Man said:

I haven't found the time to dive into modding yet, but this is definitely going to be a big help, thank you!

Couple suggestions though:

  1. Edit out unnecessary bits, like waiting for the game to boot.
  2. Plan what you're going to show throughout your tutorial beforehand, and record yourself doing it in smaller sections. There's lots of benefits for your audience from doing this:
    1. No "uhs" and "ahms"
    2. Less time spent on typos and "oh wait, damn it." (Showing small code mistakes like the weapon attachment part can be useful sometimes, though.)
    3. You won't be rambling or distracted by irrelevant things, like the contextual auto-suggest thing.
    4. Better structured tutorials, and it'll be easier for you to redo a part if you feel like you want to.

Thank you for the feedback. I will probably end up remaking this video just for the reasons you mentioned. I recorded it in about 6 different parts and sniped out various portions as i made no preparation and just kind of wung it as you can probably tell lol. When I was making other(not going to say as it would be very frowned upon here lol) tutorials i made a little notepad about the topics that would be covered, the steps needed to take to achieve our goal, and bits of pseudocode in some more difficult areas as a way to visualize it. Maybe that should start being done at the start of these as well. Thank you for the feedback again, it was quite helpful!

  • Like 1

Share this post


Link to post
Share on other sites

It's very different from SQF Scripting for me coming from A3. Saying that it reminds me a lot of C#.

Share this post


Link to post
Share on other sites
21 minutes ago, Heisen99 said:

It's very different from SQF Scripting for me coming from A3. Saying that it reminds me a lot of C#.

very very similar yes, but so far i prefer it over sqf. i did feel arma 3 scripting was more beginner friendly but very limited where as this feels like you have complete freedom. next tutorial is being uploaded now btw.

10 hours ago, Dancing.Russian.Man said:

I haven't found the time to dive into modding yet, but this is definitely going to be a big help, thank you!

Couple suggestions though:

  1. Edit out unnecessary bits, like waiting for the game to boot.
  2. Plan what you're going to show throughout your tutorial beforehand, and record yourself doing it in smaller sections. There's lots of benefits for your audience from doing this:
    1. No "uhs" and "ahms"
    2. Less time spent on typos and "oh wait, damn it." (Showing small code mistakes like the weapon attachment part can be useful sometimes, though.)
    3. You won't be rambling or distracted by irrelevant things, like the contextual auto-suggest thing.
    4. Better structured tutorials, and it'll be easier for you to redo a part if you feel like you want to.

I did try to do some more pre planning and removed some unessasary parts of the video, left in 2 mistakes that i thought made a decent point. Do you think this is an improvement over the first video?

 

 

Edited by gokitty1199
  • Like 1
  • Thanks 2
  • Beans 1

Share this post


Link to post
Share on other sites

Hi,

many thanks for your videos. A nice introduction to modify the servers.

Hopefully you plan to create more videos about this topic? :) 

 

best regards

Share this post


Link to post
Share on other sites

Really enjoying these  , you are leaving just enough out to get me thinking on my own which is great :)

 

  ( talking about adding coolant and hood etc  and finding class names etc )

Share this post


Link to post
Share on other sites

For me the most challenging at the moment is to find the right workflow. I think a tutorial to add a custom object that is usable in the game can show how things work together. 

 

Share this post


Link to post
Share on other sites
7 hours ago, gokitty1199 said:

very very similar yes, but so far i prefer it over sqf. i did feel arma 3 scripting was more beginner friendly but very limited where as this feels like you have complete freedom. next tutorial is being uploaded now btw.

I did try to do some more pre planning and removed some unessasary parts of the video, left in 2 mistakes that i thought made a decent point. Do you think this is an improvement over the first video?

 

 

I've done some C# however I got to the point where I was really confident with SQF; saying that; Enforce Script is not as restricted and I believe we truly have an open space for modding coming to light.

  • Like 1

Share this post


Link to post
Share on other sites
5 hours ago, gloser said:

For me the most challenging at the moment is to find the right workflow. I think a tutorial to add a custom object that is usable in the game can show how things work together. 

 

we could create a random container, add a random category of items to it, then add a random assortment of those items? something like that?

Share this post


Link to post
Share on other sites

Why not do this instead.

foreach (string part : hatchbackCompoments)
{
	vehicle.GetInventory().CreateAttachment(part);
}

// not tested ^

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, Heisen99 said:

Why not do this instead.


foreach (string part : hatchbackCompoments)
{
	vehicle.GetInventory().CreateAttachment(part);
}

// not tested ^

with alot of the stuff i do outside of video games, ive used a forEach loop literally once and that was when i was learning c# and reading through the processes running on the users machine. your right though, a foreach like you posted would be better and a little easier to read for someone starting

  • Like 1

Share this post


Link to post
Share on other sites
9 hours ago, gokitty1199 said:

with alot of the stuff i do outside of video games, ive used a forEach loop literally once and that was when i was learning c# and reading through the processes running on the users machine. your right though, a foreach like you posted would be better and a little easier to read for someone starting

Indeed, however, the following as you presented in your video can be more useful in other instances so it's good you touched on it.

for (int i = 0; i < 5; i++ ) 
{
// code
}

 

Share this post


Link to post
Share on other sites
On 15-11-2018 at 10:16 AM, gokitty1199 said:

I did try to do some more pre planning and removed some unessasary parts of the video, left in 2 mistakes that i thought made a decent point. Do you think this is an improvement over the first video?

making mistakes are not bad, as long as you explain what went wrong.
people learn from mistakes.

the same counts for the foreach / for loop situation.
explain why one is better then the other.

I will watch these all (several times:P)

 

cheers!

Edited by kaspar rave
  • Like 1

Share this post


Link to post
Share on other sites

Whilst it maybe tempting to go for the most ergonomic  /better  /someone else options  on how you approach this ,  i believe the way you are doing it  is best for "Telling the story"   and thus for teaching . 

 people could post here about the  bits  that can be added like the car parts missing   like oil, brake fluid , radiator etc .  but  your videos are best being  concise and linear like they are so far .

cheers much appreciated

 

 

Share this post


Link to post
Share on other sites

Hi gokitty1199 , I followed the first tutorial on weapons and everything went well, then I created a weapon but the problem is that the scope does not appear, you have an idea?

Share this post


Link to post
Share on other sites
3 hours ago, cashgrany said:

Hi gokitty1199 , I followed the first tutorial on weapons and everything went well, then I created a weapon but the problem is that the scope does not appear, you have an idea?

are you attaching the rear sight/carrying handle such as in the video or a separate optic? and please post the script

Edited by gokitty1199

Share this post


Link to post
Share on other sites

So is all this just for offline mode? I thought I saw you working in the missions folder and not mpmissions. Tried to follow along but when you loaded the init.c you loaded the one in the missions.

 

I've got cars spawning on my server with all the attachments, but I cant figure out where/how to make them spawn with full fluids. Online community server. 

Share this post


Link to post
Share on other sites
4 hours ago, Meoph said:

So is all this just for offline mode? I thought I saw you working in the missions folder and not mpmissions. Tried to follow along but when you loaded the init.c you loaded the one in the missions.

 

I've got cars spawning on my server with all the attachments, but I cant figure out where/how to make them spawn with full fluids. Online community server. 

i only used offline for testing because its quicker as i can(could) just press restart and it would reload itself instead of restarting the server and rejoining each time. its all essentially the same though. it should be the same as this for example

yourVehicle.Fill(CarFluid.FUEL, 1000);
yourVehicle.Fill(CarFluid.OIL, 1000);

 

Share this post


Link to post
Share on other sites
9 hours ago, Meoph said:

So is all this just for offline mode? I thought I saw you working in the missions folder and not mpmissions. Tried to follow along but when you loaded the init.c you loaded the one in the missions.

 

I've got cars spawning on my server with all the attachments, but I cant figure out where/how to make them spawn with full fluids. Online community server. 

			EntityAI car;
            vector NewPosition;
            vector OldPosition;
            OldPosition = player.GetPosition();
            NewPosition[0] = OldPosition[0] + 2;
            NewPosition[1] = OldPosition[1] + 0.2;
            NewPosition[2] = OldPosition[2] + 2;
            car = GetGame().CreateObject( "OffroadHatchback", NewPosition, false, true, true );                  
            car.GetInventory().CreateAttachment("HatchbackHood");
            car.GetInventory().CreateAttachment("HatchbackTrunk");
            car.GetInventory().CreateAttachment("HatchbackDoors_Driver");
            car.GetInventory().CreateAttachment("HatchbackDoors_CoDriver");
            car.GetInventory().CreateAttachment("HatchbackWheel");
            car.GetInventory().CreateAttachment("HatchbackWheel");
            car.GetInventory().CreateAttachment("HatchbackWheel");
            car.GetInventory().CreateAttachment("HatchbackWheel");
            car.GetInventory().CreateAttachment("HatchbackWheel"); //spare
            car.GetInventory().CreateAttachment("SparkPlug");
            car.GetInventory().CreateAttachment("EngineBelt");
            car.GetInventory().CreateAttachment("CarBattery");
            auto carfluids = Car.Cast( car );
            carfluids.Fill( CarFluid.FUEL, 1000 );
            carfluids.Fill( CarFluid.OIL, 1000 );
            carfluids.Fill( CarFluid.BRAKE, 1000 );
            carfluids.Fill( CarFluid.COOLANT, 1000 );

this is what is use to spawn a hatchback I think it has everything

Edited by kaspar rave

Share this post


Link to post
Share on other sites
class SetUpDefaultPlayerWeapon
{
	private PlayerBase player;
	private EntityAI weapon;
	void SetUpDefaultPlayerWeapon(PlayerBase pIn)
	{
		player = pIn;
		weapon = player.GetHumanInventory().CreateInHands("ksvk");
		addWeaponAttachment();
		addMagazineToPlayer();
	}
	void addWeaponAttachment()
	{
		weapon.GetInventory().CreateAttachment("PSO1Optic");
	}
	void addMagazineToPlayer()
	{
		player.GetInventory().CreateInInventory("magksvk");
	}

};

Sorry for the response time gokitty1199; here is my script.

Share this post


Link to post
Share on other sites
On 11/16/2018 at 6:53 AM, gokitty1199 said:

we could create a random container, add a random category of items to it, then add a random assortment of those items? something like that?

When you say random, do you mean from a list of existing containers? Because I think he is talking about adding a completely new custom item.

Share this post


Link to post
Share on other sites
20 hours ago, kaspar rave said:

@gokitty1199 is there a new one coming or?

yes, sorry i have been busy with school the past few weeks and its getting very close to finals

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×