Forum

> > Stranded II > Scripts > Scripting Questions
Forums overviewStranded II overview Scripts overviewLog in to reply

English Scripting Questions

2,429 replies
Page
To the start Previous 1 289 90 91121 122 Next To the start

old Re: Scripting Questions

Vibhor
User Off Offline

Quote
lint35 has written
Can you give me an example?

pirate script
on:use
loadmap {DIRECTORY} 1,1,1,1,1 (stuff to export to different map)

old Re: Scripting Questions

Lion_Hearted
User Off Offline

Quote
I was just looking around and I noticed in the source code for Stranded 2, DC included the exact icon maker I'm wanting... I was wondering if someone who has Blitz 3D could compile it and upload it somewhere... Cause I've made 11 models but no icons...

old Re: Scripting Questions

Vectarrio
User Off Offline

Quote
Can you download b3d viewer(from usS stuff files) and do printscreen , then edit, and resize in some paint.net, or smth else?

old Re: Scripting Questions

Lion_Hearted
User Off Offline

Quote
I have it, and I'm tempted to resort to that... But according to the read me in the Source code folder, all I have to do with that program would be to press enter and I would have a ready made icon...

old Re: Scripting Questions

lint35
User Off Offline

Quote
Hello, I'm back again with another scripting question. Would it be possible to add seasons? I'm thinking like adding a script if the player is on day 31 it starts to snow? Thanks

old Re: Scripting Questions

Psytechnic
User Off Offline

Quote
lint35 has written
Hello, I'm back again with another scripting question. Would it be possible to add seasons? I'm thinking like adding a script if the player is on day 31 it starts to snow? Thanks


Use the search function in this forum. There is already a Seasons Mod. You could use it as an example or, with permission, use some of the models etc...

old Re: Scripting Questions

lint35
User Off Offline

Quote
psytechnic has written
Use the search function in this forum. There is already a Seasons Mod. You could use it as an example

Unfortunately for me the Seasons Mod is in German, as you might be able to clearly tell I do not speak German

old Re: Scripting Questions

Psytechnic
User Off Offline

Quote
lint35 has written
psytechnic has written
Use the search function in this forum. There is already a Seasons Mod. You could use it as an example

Unfortunately for me the Seasons Mod is in German, as you might be able to clearly tell I do not speak German


You could have been multilingual. But yeah, Seasons Survivor mod is the one you want.

old Fishing Scripts

lint35
User Off Offline

Quote
Hello once again, forum! I'm trying to add new catchable fish to my mod but I don't understand how the fishing rod works in order to obtain the fish. I looked at the scripts for a while but none of it made any sense but thats probably because I only know half of the basics of scripting because the rest are in German... So if anyone could help me by giving me an example of one of the scripts or explaining how the fishing rod works I would greatly appreciate it!

Kind regards, lint35

old Re: Scripting Questions

Psytechnic
User Off Offline

Quote
I created an upgrade for the fishing rod so I'll show you the script, but this is gonna take some explaining.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
id=700
name=Luxury Fishing Rod
group=tool
icon=gfx\PsyMod\fishingrod.bmp
model=gfx\PsyMod\fishingrod.b3d
scale=1.5
mat=iron
weight=1200
info=A luxurious fishing rod which allows me to catch bigger fish.
behaviour=fishingrod
damage=3
script=start
	on:attack2 {
		jade 2;
		event "iskill_fish","global";
	}
In this area, I designated the fishing rod with an ID, a name, model and so forth. If you just want to modify the original, don't worry about these. Just open the original "items_tools.inf" and find the fishing rod.

What you should be looking at is the "on:attack2" event. In this section, we tell the game to take 2 off the hunger, thirst and fatigue, which is where the drain from fishing comes from. Then we tell the game to trigger the event adding a fishing skill point.
1
2
3
4
5
6
7
8
9
on:fish_failure {
		$tmp=current_id();
		if (parent_class($tmp)==2){
			if (parent_id($tmp)==1){
				speech "negative";
				msg "I cannot fish here!",3;
			}
		}
	}
This just means, if you're in an area that you can't fish in, tell the user. The next part can look scary.
1
2
3
4
5
6
on:fish_success {
		$tmp=current_id();
		if (parent_class($tmp)==2){
			if (parent_id($tmp)==1){
				//Bait?
				if ((playergotitem(98)+playergotitem(119))==0){
If we are in an area we can fish, check if we have something for bait. In this case, it finds the quantity of the item with ID 98 that the player has and adds it to the quantity of item ID 119, then checks if it is equal to 0. These are worms and insect parts. So If the player has no bait, we do this:
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
$tmp2=skillvalue("fish");
					if ($tmp2>=500){
						$tmp3=random(1,6);
						if ($tmp3==1){
							find 109,random(1,3);
							speech "positive";
						}elseif($tmp3==2){
							find 102,random(1,3);
							speech "positive";
						}elseif($tmp3==3){
							find 103,random(1,2);
							speech "positive";
						}elseif($tmp3==4){
							find 520;
							speech "positive";
						}else{
							find 89,random(1,2);
							speech "positive";
						}
					}elseif($tmp2>=200){
						$tmp3=random(1,6);
						if ($tmp3==1){
							find 109,random(1,2);
							speech "positive";
						}elseif($tmp3==2){
							find 102,random(1,2);
							speech "positive";
						}elseif($tmp3==3){
							find 103;
							speech "positive";
						}elseif($tmp3==4){
							find 520;
							speech "positive";
						}else{
							find 89;
							speech "positive";
						}
					}elseif($tmp2>=100){
						$tmp3=random(1,4);
						if ($tmp3==1){
							find 109;
							speech "positive";
						}elseif($tmp3==2){
							find 102;
							speech "positive";
						}elseif($tmp3==3){
							find 103;
							speech "positive";
						}else{
							find 89;
							speech "positive";
						}				
					}elseif($tmp2>=50){
						$tmp3=random(1,4);
						if ($tmp3==1){
							find 109;
							speech "positive";
						}elseif($tmp3==2){
							find 102;
							speech "positive";
						}elseif($tmp3==3){
							find 103;
							speech "positive";
						}
					}elseif($tmp2>=25){
						$tmp3=random(1,6);
						if ($tmp3==1){
							find 109;
							speech "positive";
						}elseif($tmp3==2){
							find 102;
							speech "positive";
						}elseif($tmp3==3){
							find 103;
							speech "positive";
						}
					}
This is a biggy. First, we get the value of the player's fishing skill and assign it to a variable $tmp2. Then we do recursive checks on the value to decide what to do based on skill points.
If the skill value is above 500, get a random number between one and six, this gives the fishing a random outcome. We set up if statements for each value to decide what to give the player.
find <item ID>,<quantity>; tells you what item is given to the player (if anything). Then we tell the game to play the success sound.
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//Use a Bait
				}else{
					//Worm
					if (playergotitem(119)>0){
						freestored "unit",1,119,1;
						msg "Used worm as bait!",1;
					//Insectparts
					}elseif (playergotitem(98)>0){
						freestored "unit",1,98,1;
						msg "Used insect parts as bait!",1;
					}

					//Get Fish?
					$tmp2=skillvalue("fish");
					if ($tmp2>=500){
						$tmp3=random(1,2);
						if ($tmp3==1){
							find 520,random(1,2);
							speech "positive";
						}else{
							find 89,random(1,3);
							speech "positive";
						}
					}elseif($tmp2>=200){
						$tmp3=random(1,2);
						if ($tmp3==1){
							find 520;
							speech "positive";
						}else{
							find 89,random(1,2);
							speech "positive";
						}
						speech "positive";
					}elseif($tmp2>=50){
						$tmp3=random(1,100);
						if ($tmp3<=80){
							find 89;
							speech "positive";
						}
					}elseif($tmp2>=25){
						$tmp3=random(1,100);
						if ($tmp3<=55){
							find 89;
							speech "positive";
						}						
					}else{
						$tmp3=random(1,100);
						if ($tmp3<=40){
							find 89;
							speech "positive";
						}
					}
				}
			}
		}
	}
script=end
healthchange=0
This is basically the same, but the second half of the original if statement. This is executed if the player has bait. First we check which type of bait the player has with if statements, meaning we can change the order of preference of bait used. Then we run the same check on skill, then a random number, then we give a result.

If you want to add a new fish to the original rod, think about when the player will be able to catch it in terms of skill, then go into those sections and increase the random number count, add a new if statement checking for the new number and then add your fish in the find <item ID>,<quantity>; section.

If you read the above scripts carefully, you will notice that I have added a new fish to this with an item ID of 520, which in my mod is a Big Fish.

old Re: Scripting Questions

lint35
User Off Offline

Quote
Thanks for explaining to me about the fishing rod, Psytechnic. I have yet another scripting question, this time it's about the dialog scripts. Is it possible to have a dialog script attached to a unit and have one of the pages run a script? For example I create a new unit and attach a new dialog.s2s note and I have a list of places you can travel to. Could I make a page that runs a loadmap script?

old Re: Scripting Questions

Psytechnic
User Off Offline

Quote
lint35 has written
Thanks for explaining to me about the fishing rod, Psytechnic. I have yet another scripting question, this time it's about the dialog scripts. Is it possible to have a dialog script attached to a unit and have one of the pages run a script? For example I create a new unit and attach a new dialog.s2s note and I have a list of places you can travel to. Could I make a page that runs a loadmap script?


I think this is possible and I can see where you're going with this. You have to keep in mind the state of the map that you load as well. So If you travel to one location and do things there, you're going to have to use s2 cmd savemap to store the state of the map so you can return to it with the changes you've made.

old Re: Scripting Questions

lint35
User Off Offline

Quote
Psytechnic has written
I think this is possible and I can see where you're going with this. You have to keep in mind the state of the map that you load as well. So If you travel to one location and do things there, you're going to have to use savemap to store the state of the map so you can return to it with the changes you've made.

I got the >loadmap to work... I am having troubles with the >savemap because there is a lot of glitches. The player is able to travel to more than one place but how do I save one map if the player is travelling back from one island to another? For example: the player travels from Island1 to Island2 He leaves Island2 and goes to Island 4 then decides he wants to go back to Island 2 but everything is the same as before he was there. Such as items and objects and even Units that the player has killed earlier. Any suggestions?

old Re: Scripting Questions

Vectarrio
User Off Offline

Quote
lint35 has written
Psytechnic has written
I think this is possible and I can see where you're going with this. You have to keep in mind the state of the map that you load as well. So If you travel to one location and do things there, you're going to have to use savemap to store the state of the map so you can return to it with the changes you've made.

I got the >loadmap to work... I am having troubles with the >savemap because there is a lot of glitches. The player is able to travel to more than one place but how do I save one map if the player is travelling back from one island to another? For example: the player travels from Island1 to Island2 He leaves Island2 and goes to Island 4 then decides he wants to go back to Island 2 but everything is the same as before he was there. Such as items and objects and even Units that the player has killed earlier. Any suggestions?

hmm... s2 cmd autosave , s2 cmd autoload ?

old Re: Scripting Questions

lint35
User Off Offline

Quote
Hmm I might be doing it wrong but with the autosave and autoload it duplicates every item the player has in the inventory.

old Re: Scripting Questions

lint35
User Off Offline

Quote
I am still having the same problem, here is the dialog script I am using:
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
page=travel
title=Travel Index
text=start
Where would you like to travel to?
text=end
script=start
	autosave;
script=end
button=Market,I want to go to the Market.
button=island,I want to go back to my island.
button=Docks, I want to visit the docks.
button=action:close,Nevermind, don't travel.

page=island
script=start 
	play "magic.wav";
	loadmap "maps\Farm_1_Testing.S2",1,1,1,1,1,1;
	quickload;
script=end

page=Market
script=start
	play "magic.wav";
	loadmap "maps\Market_test.S2",1,1,1,1,1,1;
	quickload;
script=end
Basicly the player auto saves when he talks to the transporter guy so the map stays the same. But if you load from a different Island it will still load the island you want only at a different autosave. This is very confusing...
To the start Previous 1 289 90 91121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview