But to make states, you gots to modify the game via source code.
Forum
Stranded II Scripts Scripting QuestionsBut to make states, you gots to modify the game via source code.
if you need to know a current speed of a unit which has state 54 added you can use the command getstatevalue.
I want to use the buildings you see in the editor (big fence, house, plane...) in random games but I don't know how to add a new combination into the game.
I'm looking for something similar to phyre's mod, only with a regular hammer.
Or if such thing alredy exists, I apreciate a link to download the file.
then you have to go to the buildings.inf file, define your object as a new building and set the needed materials by a line like this (you just have to input the values):
1
req=Item-Type, Amount
I want to remove the recoil of the machine gun, it's more annoying than anything, can someone re-do the script for me?
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
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
### Sub-machine gun id=123 name=Sub-machine gun group=weapon icon=gfx\submachine.bmp model=gfx\submachine.b3d scale=0.335 behaviour=gun range=1000 rate=55 mat=metal weight=2500 info=Ready to crack down on them? damage=0.3 healthchange=0 script=start 	on:attack1 { 	if ($fingers<=3){ 			msg "Shot with $fingers",3; 			msg "fingers?",3; 			skipevent; 			speech "negative";} 	if (playergotitem(29)>0) { 		local $sht; 		$sht++; 		if (gety("unit",1)<-15){ 			skipevent; 			speech "negative"; 			msg "Shoot underwater?",3; 			msg "are you crazzy?",3; 		}elseif ($sht==31){ 	process "reloading"; 	play "crack2.wav",15; 	play "crack1.wav",15; 	freevar "$sht"; 	skipevent; 	}else{ 	if (playergotitem(29)>0) { 	play "thomp.wav",10; 					$pitch=(getpitch("unit",1)-5); 					$yaw=getyaw("unit",1); 					setrot "unit",1,$pitch,$yaw,0;} 		} 	} } 	on:impact { 		$tmp=impact_class(); 		$tmp2=impact_id(); 		//+100 Bonus Damage on Fruit 		if (compare_material($tmp,$tmp2,"fruit")==1){ 			damage $tmp,$tmp2,100; 		//+200 Bonus Damage on Glass 		} elseif (compare_material($tmp,$tmp2,"glass")==1){ 			damage $tmp,$tmp2,200; 		} 		freevar $tmp; 		freevar $tmp2; 	} 	on:inhand { 		play "crack1.wav"; 	} 	on:noammo { 		speech "negative"; 		msg "No ammo!",3; 	} script=end
I honestly don't know what causes the recoil in this script.
I tried replacing some features with the pistol script (since it's a stable gun when shooting) but it just mess with the game.
If you played kidnap mod you probably know how much recoil the machine gun have...
Btw, this is for personal use, I can't add new items in the game so let alone make a mod full of stolen stuff.
And if such thing exists, I'd like a script that makes friendly NPCs attack hostile creatures (kinda like the mobster or the bamboo villagers, except that they shoot at creatures and not at me).
Sorry for all the questions, I just can't understand all these codes and scripts
1
2
3
2
3
$pitch=(getpitch("unit",1)-5); $yaw=getyaw("unit",1); setrot "unit",1,$pitch,$yaw,0;
the second line is rather unimportant here but the first and the third line are of importance.
if you want to have less recoil just write a smaller number where the 5 is writen at the end of the first line.
if you want to have to recoil at all you can simply write a 0 there.
Everyone says scripting and modding in stranded 2 isn't hard, I'll look for a tutorial or something so I can stop asking questions here
------
Now I need to know how I can use the script from the machine gun to make pistols and shotguns reload.
Machine Gun script:
I know the reloading part is probably somewhere near the place where the author wrote "reloading" ( ) but I don't see the magazine size or the reloading time (30 bullets before reloading and 3~6 seconds to reload the machine gun).
I'm looking for a similar script for the shotgun and the pistol that I can modify the magazine size and reloading time myself, if that's possible.
-------------
Scripting question number two:
So I tried messing with this script:
It's the original raptor script but without the "ouch! he dropped me!" feature.
For some reason, when i test this in the editor the debug mode shows some kind of error for every action (hit player, ride, die and loot corpse).
I honestly don't know what I done wrong in the raptor script...
edited 4×, last 22.01.11 02:18:07 am
Try using Vectar666's gun reload script.
And, also try looking closely at the raptor script. You may have deleted too many parentheses.
there always has to be the same number of "{" as "}".
in the reload script there is a variable that is called "$sht".
in the beginning its value is 0 but whenever you shoot enlarged by 1.
and once this value reaches 31 it says "No ammo!". so this means that you can shoot 30 times with one clip.
after this you have to reload which is done by this:
1
process "reloading";
edited 1×, last 22.01.11 07:56:46 pm
My stranded 2 hero, you make scripting sounds easy.
How do I change the reloading time tough?
@pupp3t:
I prefer kidnap's reloading, v666 has a good weapon system tough.
So now I'm trying to make the bad natives with bows shoot arrows at you (their behavior is animal, for some reason they only shoot arrows at you in adventure mode before you find the forest village).
I tried replacing the behavior to predator and put the defense tower script into it:
Debug mode showed no problems with the script, the unit hunts me and attacks me with no problem... Doesn't shoot arrows tough.
I tried giving it a attackrange but it's just makes his melee attack range wider.
I also tried to give the pistol the reload feature, but for some reason I get a memory acess violation when reloading the machine gun:
Did I done something wrong?
edited 1×, last 22.01.11 06:40:27 pm
1
process "reloading", 1000;
for the bowmen problem:
if you want that they shoot the player you have to write a 4 instead of a 6 in the projectile command at the parameter for the mode so they shoot the player instead of the next aggressive unit in range:
1
projectile 53,$x,$y,$z,4,350,15,59;
for the other problem:
I think it is a problem with the amount of the "{" and "}" again or at least with their order.
if you wrote the script yourself I strongly recommend to you to use the tab key to make different levels of script in order to make it much more readable and to be able to see problems more easily.
an example:
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
on:start { 	if($var1==1) { 		if($var2==2) { 			if($var3==3) { 				msg "Hello!"; 			} 		} 	}elseif($var1==2) { 		msg "Test"; 	} }
I think I'll just stick with mapping and adding new objects/units, thank you for your patience hurri04 and anyone else who answered my questions
the scripting language in the game, however, is completely different. in fact, it is more like php style.
in case that you are looking for a scripting tutorial or references of commands you might want to check this site:
http://www.stranded.unrealsoftware.de/s2_mods.php
Example: You're walking in the dark corridors. An enemy spots you. As well as hearing a sound that comes from YOU, there is also a message that says: "You're under watch..".
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
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
on:start { 	timer 0, 1000, 0, "enemyinsight"; } on:enemyinsight { 	//the player sees the raptor 	$playerx=getx("unit", 1); 	$playery=gety("unit", 1); 	$playerz=getz("unit", 1); 	if(count_behaviourinrange("unit", "raptor", 300)>0) { 		loop("units") { 			$raptorx=getx("unit", loop_id()); 			$raptory=gety("unit", loop_id()); 			$raptorz=getz("unit", loop_id()); 			if(viewline($playerx, $playery, $playerz, $raptorx, $raptory, $raptorz)==1) { 				$raptorsinrange++; 			} 		} 		if($raptorclosemode==0) { 			if($raptorsinrange>0) { 				msg "I see a raptor!"; 				$raptorclosemode=1; 				$raptorsinrange=0; 			} 		}elseif($raptorclosemode==1) { 			if($raptorsinrange==0) { 				$raptorclosemode=0; 				$raptorsinrange=0; 			} 		} 		//the raptor has spotted the player 		if(playerspotted()==1) { 			if($spottedmode==0) { 				msg "The raptor has seen me!"; 				$spottedmode=1; 			} 		}elseif(playerspotted()==0) { 			if($spottedmode==1) { 				msg "I think it has let me alone."; 				$spottedmode=0; 			} 		} 	} }
For Alienation I'm making a solar panel building that will catch energy from the sun to recharge batteries... However, I can't figure out how to make a script which will charge 2 batteries on change day...
The idea is, you have a building, that you can put an unlimited amount of batteries in, and every morning 2 of those batteries will be charged...
It should be a fairly simple script... and I would be very grateful for your assistance.
if(really don't know, smth about stored items){
alteritem(loop_id(),chargedbattery_id)
}
}
change chargedbattery_id and battery_id to actual numbers