But it'll kill the player when it explodes, which is crappy if the basis of your custom map is the player escaping a plane crash and it explodes before you can do anything. So how do you make it, either through the map editor or the object script, that the player is not killed?
Forum
Stranded II Scripts Set an object to explode without killing player.Set an object to explode without killing player.
6 replies 1
But it'll kill the player when it explodes, which is crappy if the basis of your custom map is the player escaping a plane crash and it explodes before you can do anything. So how do you make it, either through the map editor or the object script, that the player is not killed?
you could make the timer trigger in 1 millisecond steps so it would just take 3 milliseconds in total and the player wouldnt even notice that he had the invincible state on him.
but this only works when you kill the plane first via kill and then let the explosion happen with the command explosion.
Heres the script:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
### Crashed Plane id=298 name=Crashed Plane group=vehicle model=gfx\plane_wreck.b3d icon=gfx\icons\plane_wreck.bmp health=20 script=start 	on:kill { 		timer "self",$timer,1; 	} 	on:timer { 		$x1=(addstate "unit","invulnerability") 		$x2=(explosion $x,$y,$z,50,300) 		$x3=(freestate "unit","invulnerability") 		$x4=(free "self") 	} script=end
I'm sure I just missed something somewhere, any suggestions?
aimeewilbury has written
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
### Crashed Plane id=298 name=Crashed Plane group=vehicle model=gfx\plane_wreck.b3d icon=gfx\icons\plane_wreck.bmp health=20 script=start 	on:kill { 		timer "self",$timer,1; 	} 	on:timer { 		$x1=(addstate "unit","invulnerability") 		$x2=(explosion $x,$y,$z,50,300) 		$x3=(freestate "unit","invulnerability") 		$x4=(free "self") 	} script=end
the stuff you wrote into the on:timer script is totally wrong:
dunno which scripting language you mixed this up with but the brackets have to be set different in S2, also you forgot all the semicolons at the end of the lines.
further the timer command line should look a little different since I told you to run the timer 3 times and have an event at the end.
about the error in the picture you posted:
yeah, I think there has to be an extra event where you save the ID of the object into a local variable first.
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
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
### Crashed Plane id=298 name=Crashed Plane group=vehicle model=gfx\plane_wreck.b3d icon=gfx\icons\plane_wreck.bmp health=20 script=start on:start { 	local "$own_id"; 	$own_id=currentid(); 	$plane_x=getx("self"); 	$plane_y=gety("self"); 	$plane_z=getz("self"); } on:kill { 	timer "unit", $own_id, 3, 1, "plane_explode"; } on:plane_explode { 	if($plane_explode_step==0) { 		addstate "unit", 1, "invulnerability"; 		$plane_explode_step++; 	}elseif($plane_explode_step==1) { 		explosion $plane_x, $plane_y, $plane_z, 50, 300; 		$plane_explode_step++; 	}elseif($plane_explode_step==2) { 		freestate "unit", 1; 	} } script=end
try this script, as you can see I changed quiete a few things.
edited 1×, last 27.07.11 01:31:44 am
1