Forum
Stranded II Scripts Scripting Questions Jesterhead37 has written
Anybody know how to get rid of the annoying "second unit" for vehicles. Meaning, all vehicles are always outlines with a lower alpha version of themselves and I have no clue how to get rid of that. Is it possible?
Either turn debug mode off, or you can't because it is hard coded.
i want that the state "tame" is not forever but only some seconds..
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
on:impact { 		process "expelliarmus",1000; 		msg "expelliarmus!",4; 		$tmp=impact_class(); 		$tmp2=impact_id(); 		addstate $tmp,$tmp2,"tame"; 		statevalue $tmp,$tmp2,"tame",18; 		timer"$tmp",$tmp2,2000,1,"timer"; 		} 	on:timer { 		freestate $tmp,$tmp2,"tame"; 		statevalue $tmp,$tmp2,"tame",18; 	}
I have a cube, and I use it. How to know, what side of it was used? I know about use_x e.t.c. but my algorhytm was buggy. So I need your help.
well, actually there is no way in Stranded 2 to know which side of the cube was used by a simple command.
but if I got it right there are 2 different ways to do it:
make all the sides of the cube be different objects. you can also add scripts to the different parts so that e.g. on:edset one of the parts is set in the editor the other parts are automatically created and placed correctly.
when using this method you'd know which side was used pretty easy.
or you make a cube be one single object. but then you have to do some math, calculation of angles and rotations and stuff.
so when using a cube you have to get the players rotation and the rotation of the cube and then you have to add or abstract them. then you have to make a large if-query for all the diffenrent angles from -360° to + 360° in 90° steps so you actually go around one full circle for two times. but the first and the last step have to be 45° steps so you start from -360° to -315° then -315° to -225° then -225° to -135° and so on and you have to give all the 4 different possibilities numbers to which a variable is set so th efront side is 0, the right side is 1, the back side is 2 and the left side is 3.
but by this you wont take the top side and the bottom side into account. to accomplish this you'd have to do the same as before but this time for the vertical angle.
so you see this is MUCH more work and I therefore suggest using the first solution.
Hurri04 has written
or you make a cube be one single object. but then you have to do some math
thats what calculators are for!
I have a question, how do i make a unit with the 'shy' behaviour, shoot projectiles when close enough, and how do i choose its speed, drag, and what the projectiles is?
Quote
I have a question, how do i make a unit with the 'shy' behaviour, shoot projectiles when close enough, and how do i choose its speed, drag, and what the projectiles is?
I may have a solution. I used it for an object though, so it MAY not work with units. I would imagine it will though... Just put it in the script. I don't think that the "shy" behavior will affect it.
Hope that helps!! (Thanks to hurri04 for teaching me)
Edit- I also have two questions.
1. Does anybody know how to make the combination generation a choice of multiple options? So that you can build something and get multiple possible results?
2. Is there a way to edit a savegame map? Meaning, if someone plays and then saves, edit the map with all the stuff they saved? I need to be able to edit the map with all the changes that a player has made to it's original shape (things he built/killed etc...)
edited 1×, last 01.01.11 02:19:23 pm
theres a random generator in the colour game. look look @ the script=]
also, is there a way of ending a game when you use a oblject, e.g. use a boat -game ends
Jesterhead37 has written
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
script=start 	on:start { 		local "$x", "$y", "$z"; 		$x=getx("self"); 		$y=gety("self"); 		$z=getz("self"); 		$y+=28; 		timer "self", 3000, 0; 	} 	on:create { 		local "$x", "$y", "$z"; 		$x=getx("self"); 		$y=gety("self"); 		$z=getz("self"); 		$y+=28; 		timer "self", 3000, 0; 	} 	on:build_finish { 		local "$x", "$y", "$z"; 		$x=getx("self"); 		$y=gety("self"); 		$z=getz("self"); 		$y+=28; 		timer "self", 3000, 0; 	} 	on:timer { 	if(playerdistance("self")<500) { 		projectile 54, $x, $y, $z, 4, 30, 15, 59; 		} 	}
well, as I was the one who wrote this script I think I should give you some hints
this script works fine for objects because they dont move.
but as units move this script wont work correctly anymore.
the "on:building_finish" event has to be changed to "on:spawn" and the commands to get the position of the unit have to be moved to the "on:timer" event.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
script=start 	on:start { 		local "$x", "$y", "$z"; 		timer "self", 3000, 0; 	} 	on:create { 		local "$x", "$y", "$z"; 		timer "self", 3000, 0; 	} 	on:spawn { 		local "$x", "$y", "$z"; 		timer "self", 3000, 0; 	} 	on:timer { 		$x=getx("self"); 		$y=gety("self"); 		$z=getz("self"); 		$y+=28; 		if(playerdistance("self")<500) { 			projectile 54, $x, $y, $z, 4, 30, 15, 59; 		} 	} script=end
-So. Two questions. One, the same one about editing a saved game. Two, is there a way to make fishing rods catch fish deeper? If fish are too deep it doesn't let me catch them.
edited 1×, last 04.01.11 07:05:04 am
2) I hope you know that there dont even need to be fish to catch any with the fishing rod?
all there needs to be is a fishing spot which you can set in the editor. you will find it at the infos.
if you place any fish in the water and then try to catch them it of course wont work like that because when fishing (and succeding) a new fish-item simply is spawned, it has no effect on the fish that are in the water.
2. Yeah I know. I've made it so that you can only catch fish where there are fish, and I've added at least 25 different types of catchable fish (as opposed to the boring green creepy one) so I wanted to know if I could give the rod some sort of range. And actually, it does affect the fish in the water. Just set it that on:fish { free "self"; though, I'm not sure if that is set in the standard game... Anyways, least I know it can't be done now. Thanks!
I have an item, the "Grappler", that I am testing for Pupp3t Mod. ScenArio:
You are surrounded by enemies, and the Grappler is in your hand. You shoot it( with a projectile coming out), the projectile hits a wall in the distance, and you're at the exact same spot where the projectile hit the wall.
How can I do this? Can someone help me?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
script=start on:attack1 { 	$scanrange=[RANGE]; 	$target=scantarget($scanrange); 	$targetx=targetx(); 	$targety=targety(); 	$targetz=targetz(); 	$targetx-=20; 	$targetx+=20; 	$targetz-=20; 	setpos "unit", 1, $targetx, $targety, $targetz; } script=end
I think this should be it.
edited 1×, last 04.01.11 11:51:38 pm
Instead of "attack1", I'll use "Impact".
Thanks tho
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
script=start on:impact { 	$impactx=impact_x(); 	$impacty=impact_y(); 	$impactz=impact_z(); 	$impactx-=20; 	$impacty+=20; 	$impactz-=20; 	setpos "unit", 1, $targetx, $targety, $targetz; } script=end
but as you didnt post your script I cant really tell where you have to write it.