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 2110 111 112121 122 Next To the start

old Re: Scripting Questions

aimeewilbury
User Off Offline

Quote
I created a unit that has the vehicle behavior. Then I used the script that makes the transport monkey follow you around but instead of transporting things you ride the unit. However the unit stays in one place when you walk around

Is this due to the "vehicle" or did I likely screw up?

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
it's because of the vehicle behaviour, if you use the unit you automatically ride it. just set a different bahaviour which has no such functions.

put this script into the the unit's descripting file between the lines "script=start" and "script=end":
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
on:create {
	timer "self",3000,0;
}

on:start {
	timer "self",3000,0;
}

on:timer {
	if (health("self")>0){
		ai_mode "self","goto","unit","1";
		ai_center;
	}
	if (count_stored("self")>0){
		addstate "self","particles";
	}else{
		freestate "self","particles";
	}
}
this should make the unit follow you around.

old Re: Scripting Questions

Xaeveax
User Off Offline

Quote
Is there a way to make the water transparent? I have seen it in a mod before, but don't know how to do it. Do you need to edit the actual water texture image and make that transparent or is it some sort of script?

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
you can use the command s2 cmd wateralpha to make the water transparent.
when using this command you have to set a value between 1 (not transparent) and 0 (completely transparent). I recommend using a value of 0.75 because this makes the best effect in my opinion.
also you have to use the command on:load because when changing the value of the wateralpha it wont be saved.

so the script for this would be:
1
2
3
on:load{
	wateralpha 0.75;
}
just write it into the global script of the map or into the game.inf file if you want the water to be transparent on all maps.

old Re: Scripting Questions

Xaeveax
User Off Offline

Quote
Alright awesome it works!! Only problem is that for some reason coral (worst part to have thia issue!!) shows up crystal clear from above water, even if the alpha is 0.99. Everything else fades nicely exept this. You know the solution?

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
yes, I know about that problem, I think it is bacause of the stark contrast between the red color of the coral and the blue color of the water.
I don't think that there is any solution to prevent this...

old Re: Scripting Questions

Xaeveax
User Off Offline

Quote
Hmmm ok. I guess I'll just make do. Thanks again!! Oh, And does this sort of code work with objects to? (obviously not wateralpha though.)

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
yes, there is the command s2 cmd alpha.
but there is a problem with it because it is a little bit bugged:
the text in the scripting definition says that it is possible to run this command at certain objects by using the parameters so you could write e.g.
1
alpha 0.75, "object", 1
this should give the object with ID 1 an alpha-value of 0.75.
you could write this script anywhere you like.

but this does not work because it is bugged and you therefore have to write the command into the object itself and trigger it by an s2 cmd event:

write this into the script which triggers that the object becomes transparent (normally into the global map script and on:load):
1
2
3
on:load {
	event "maketransparent", "global";
}
then you have to write this into the object(s) that are supposed to be transparent:
1
2
3
on:maketransparent {
	alpha 0.75;
}

old Re: Scripting Questions

Xaeveax
User Off Offline

Quote
Ok. I tried it and it seems to work. Do you know of any way that I could make it so that objects don't fade away when I walk farther from them? I noticed that several objects from Massive Mod don't fade, and was wondering how to do that.

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
yes, there is a way to edit the range at which the objects fade.

you have to edit the definition of every single object which is supposed to fade at another range than the standard of 500.

write this into the object's definition in its definition file:
1
autofade=500
instead of 500 just write a higher value, because 500 is the default value, as I already said.
if the object already has such a line just edit the value.

More >

old Re: Scripting Questions

Antonhel
User Off Offline

Quote
I have a question, how do I use cameras??? They're quite confusing to me.. I even searched if this question already exists...

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
well, first you should set some infos on the map, you can use some of the flags, there are 4 or 5 colors of them. just set some to the waypoints of the way which the camera is supposed to move.

then the sequence has to start at some event, for instance on:hit of a tree.
so you have to write this into the tree (you might have to adapt this a little if you want to start the sequence at a different event):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
on:hit {
	$flag01=[ID of the first waypoint(flag)];
	$flag02=[ID of the second waypoint];
	$flag03=[ID of the third waypoint];
	$flag04=[ID of the fourth waypoint];
	$flag05=[ID of the fifth waypoint];
	[...]
	$flag[XX]=[ID of waypoint #XX];

	seqstart;
	setcam 0, $flag01;
	movecam 0, 2000, $flag02;
	movecam 2000, 8000, $flag03;
	setcam 8000, $flag04;
	movecam 8000, 10000, $flag05;
	seqend 11000;
}
this is just a little example.
you can add more flags that the 5 I did and then repeat the line where you give the ID of the flag to the variable.

with this script the camera mode starts, then the camera moves from the first flag to the second flag within 2 seconds. next, the camera moves to the third flag within 6 seconds (difference between 2000 and 8000 = 6000 milliseconds).
then, when the camera has reached the third falg it jumps to the fourth flag, for instance to show a whole new area of the map.
then the camera moves to the fifth waypoint and stays there for one more second and then the sequence ends.

you can also try to use the command s2 cmd cammode e.g. to turn the camera sidewards to look at a certain object when it normally would go straight into one direction.

old Re: Scripting Questions

Xaeveax
User Off Offline

Quote
Is there a way to make the texture detail of an object greater or lower? Meaning, change the amount of times the texture is repeated and make it look more detailed? I tried detailtex=blablabla but it didnt do anything...

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
no, there is no such command.
if you want the texture of the water to be repeated more often you have to edit the graphic whic is used as the texture.

you can find the graphic in the gfx folder, its name is "water.jpg".

what you could do is create a new image which is twice as high and twice as wide as the water.jpg and copy the water.jpg 4 times into this new picture.
but I dont know whether this really looks better...

old Re: Scripting Questions

pupp3tStudios
User Off Offline

Quote
On this command: on:start{ freeze [unit Id] }; how do I unfreeze the specific unit? I tried the freeze script on myself, so I froze. But I don't know how to take the freeZe out.

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
1
freeze 1, 0;
this should unfreeze the player.
you can either write this script into the execute-script-box in the cheat-emenu or write it into a script with a fitting event to trigger it.

what makes the player unfreeze is the 0 at the end, to freeze the player you can write a 1 instead but you either can leave this away as you did.

old Re: Scripting Questions

pupp3tStudios
User Off Offline

Quote
Alright thanks. I made a script that works as followed:
An enemy approaches and attacks me. As a result of his attack, I freeze to give the effect that I'm in the ground
Then, using a timer script, I "get out" of the ground. Heh weird
To the start Previous 1 2110 111 112121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview