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 2115 116 117121 122 Next To the start

old Re: Scripting Questions

Xaeveax
User Off Offline

Quote
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?

old Re: Scripting Questions

Dr Zhark
User Off Offline

Quote
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.

old Re: Scripting Questions

amstel bier9
User Off Offline

Quote
can someone fix this?
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
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;
	}
already thanks

old Re: Scripting Questions

Xaeveax
User Off Offline

Quote
Just set it up so that when ever the thing is tamed, it sets off a timer. When the timer is finished, set it so the tame goes away.

old Re: Scripting Questions

Vectarrio
User Off Offline

Quote
Ok, people, I have a question:
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.

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
working on a minecraft mod?

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.

old Re: Scripting Questions

UnIdEnTiFiEd
User Off Offline

Quote
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?

old Re: Scripting Questions

Xaeveax
User Off Offline

Quote
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.
Spoiler >

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

old Re: Scripting Questions

dsm1891
User Off Offline

Quote
to ^,


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

old Re: Scripting Questions

Xaeveax
User Off Offline

Quote
Thanks for the help, but I already knew that one. I was looking for one that works with combinations, when you build things. Thanks for trying though!

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
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
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
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 this now is the complete definition script for that unit.

old Re: Scripting Questions

Xaeveax
User Off Offline

Quote
Ah right. Thanks! Well, now he's got the right script.

-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

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
1) no you apparently cant open a save file in the editor. I just tested it. (btw you simply could have found that out by testing it yourself )

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.

old Re: Scripting Questions

Xaeveax
User Off Offline

Quote
1. Yeah, I was just seeing if there were any sort of funky converter things out there, but guess not.

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!

old Re: Scripting Questions

pupp3tStudios
User Off Offline

Quote
I gots a question:
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?

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
1
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

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
well, if you are using a projectile you can also use this script:
1
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
I think this script might be better when using a projectile because the pojectile has some drag and stuff so it goes down after a distance and this script here supports this other than the script I postet before which was good if there was no projectile so it would teleport you to the place where the crosshair was pointing unless that wasnt within the radius you had to enter in the script.

old Map Marking Script?

Dr Zhark
User Off Offline

Quote
I can't figure out how to make another Unit activate an unactivated marking on the map. Any help? If you could, I give you lots and lots of cookies.

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
I'm not exactly sure what you mean but I guess you are looking for this command: s2 cmd showindicator.
but as you didnt post your script I cant really tell where you have to write it.
To the start Previous 1 2115 116 117121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview