Forum

> > Stranded II > Scripts > How do I Make new crops with a new file?
Forums overviewStranded II overview Scripts overviewLog in to reply

English How do I Make new crops with a new file?

5 replies
To the start Previous 1 Next To the start

old How do I Make new crops with a new file?

Qtw
User Off Offline

Quote
I cannot figure out how to make a new type of crop
to plant while using a new txt file.
what i wanted to do was make a new game settings file and
use that to extend the amount of plants in there.

I do not wish to touch the original as there are a limited
amount of lines i can use. after that i have to make another
txt file and add to that.

I know i cannot just use a txt file so i just copy the original,rename it and replace the old text with mine.
please help me. thank you.

old Re: How do I Make new crops with a new file?

Hurri04
Super User Off Offline

Quote
first of all the file extension has to be .inf and not .txt.

next, this here is not true:
Quote
I do not wish to touch the original as there are a limited amount of lines i can use. after that i have to make another txt file and add to that.
you can write as many lines into the definition file as you want. why would there be any limitation to that?!

the file name just has to start with "items_", "objects_", "units_", "infos_" or "game_", followed by some name and the extension:
e.g. "items_myCrops.inf"

if you dont know how to write the definitions themselves just have a look at the already existing ones. you could even copy the one of the original crop as long as you replace the important stuff, most of all the ID which must not be used twice in another definition.

in case you plan to add many objects/items/etc you might want to open the "game.inf" file, find the following lines and change the values to something bigger:
1
2
3
limit_objects=255
limit_units=100
limit_items=255




also a tip when writing forum posts:
you dont need to hit enter whenever you reach the end of the input box because there is an automated line break

old Re: How do I Make new crops with a new file?

Qtw
User Off Offline

Quote
Actually I have to use a new one. I remember trying to make a bone item for a mod one time, and after useing the same .inf file i found that it could not be found in game.

I found I had too many items in it. I eventually found a workaround which allows me to have more which was to make a new inf file.

I also know that i cannot use a txt file since I said I copy the original.

and one more thing. you missed my most of what i was asking and thought i asked something else.

Since you gave me a tip for forum posting...(which I found nice.) I will leave you a tip. I am not trying to sound rude but...try rereading a post or read a little slower.

I am sure you read it fully but possibly read it to fast...
thanks for trying to help anyway.

old Re: How do I Make new crops with a new file?

Hurri04
Super User Off Offline

Quote
I am very certain that there is no limitation to the amount of definitions you can have in one file. my guess would be that you used an ID twice or something.

sorry if I didnt answer the right question. if you want to know how to make the item plantable, here is how it works:

• you create a file for the item (and more crop types if you want) e.g. "items_myCrops.inf" and copy the definition of the original crop item into it:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
### Grain Pile
id=42
name=Grains
group=food
icon=gfx\grainpile.bmp
model=gfx\grainpile.b3d
scale=0.65
mat=dust
weight=50
info=can be grinded with a stone. take them into your hand and use the ground in order to plant them
script=start
	on:use {
		msg "I have to take them into my hand",3;
		msg "and to use the ground!",3;
		speech "negative";
	}
	on:eat {
		process "eating",1000;
		eat 2,5,0,0;
	}
script=end
then you change line 2 to "id=121" (or some bigger number) because 120 is the largest number that is already being used.
also you might want to change lines 1, 3, 5, 6 and 12 to give the new item it's own name, model, icon and description. this is only secondary to the ID part but still important.


• next create a file "objects_myCrops.inf":
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
### Grain
id=121
name=Grain
group=stuff
icon=gfx\grain.bmp
model=gfx\grain.b3d
behaviour=plague_target
fx=16
scale=0.8
swayspeed=2
swaypower=5
col=2
health=45
mat=leaf
growtime=5
script=start
	on:kill {
		$tmp=1;
		$tmp2=spawntimer("self");
		if ($tmp2>-3){$tmp=2;}
		if ($tmp2>=0){$tmp=3;}
		create "item",41,getx("self"),getz("self"),$tmp;
		corona getx("self"),getz("self");
		freevar $tmp,$tmp2;
	}
	on:plant {
		spawntimer "self",-4;
	}
script=end
same as above, change the values as needed.


• then you create another new file e.g. "game_myCrops.inf":
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//Planting
on:useground {
	local $x,$y,$z,$id,$item;
	$x=use_x();
	$y=use_y();
	$z=use_z();
	$item=getplayerweapon();
	
	if (count_stored("unit",1,$item)>0){
	
		//Grain
		if ($item==42){
			if ($y>0){
				if (freespace($x,$y,$z,20,1,0,0,0)){
					freestored "unit",1,42,1;
					$id=create("object",121,$x,$z);
					event "plant","object",$id;
					if (skillvalue("plant")>=400){
						process "planting grain",500;
					}else{
						process "planting grain",2000;
					}
					play "dig.wav";
					play "mat_leaf1.wav";
					event "iskill_plant","global";
				}else{
					speech "negative";
					msg "Here is not enough space!",3;
				}
			}else{
				speech "negative";
				msg "Grain does not grow in water!",3;
			}
		}
	}
}
this is a part of the "game.inf" file. you will need to make some more changes here to match the numbers from the first and second file you created.


• finally, put all these files into the sys folder and if you created new models and icons put them into the gfx folder (if you want to place them into a folder inside the gfx folder for a better overview/more structure then remember to adjust the path in the definition!).


> you will probably need more items than only this one as the normal grains also have the sheaf from which you get the grain pile which is needed for planting. upon planting the object is created and upon killing the object the sheaf item is created.

you can create as many types as you want now, just extend these 3 files and remember to change the numbers correctly.

I hope this helps better this time

old Re: How do I Make new crops with a new file?

Qtw
User Off Offline

Quote
I can't seem to get the dang thing to work...
I tried the game.inf thing and it wont start.
When i add the "script=start" and "script=end" things it causes errors.
But when I don't it makes it not work at all...
I am sorry if i come off annoying...

old Re: How do I Make new crops with a new file?

Hurri04
Super User Off Offline

Quote
oh, yes. sorry about that, I forgot the "script=start" and "script=end" lines at the new game.inf. was getting a little late yesterday

it might help if you could tell me what the error messages are saying.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview