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 2111 112 113121 122 Next To the start

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
yeah, using a timer is a good choice for an event to trigger the command to unfreeze the player in this case.

I just wonder what kind of enemy could make you being stuck in the ground... maybe a mole...?

old Re: Scripting Questions

Xaeveax
User Off Offline

Quote
I am trying to make it so that when I hit a drum model, it plays a drum sound. The script I have is..

script=start
     on:use {
          play "sfx/drumlow.mp3";
     }
script=end

Shouldn't that work? Or do I need something else?

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
I'm not sure but maybe you have to remove the "sfx/" because the sommand automatically starts in the sfx folder. though it might work the way you wrote it, I'm not sure, some commands require a path, some dont.

but if you want the script to let the sound play when you hit the drum you should write "on:hit" instead of "on:use". you maybe write some more lines to prevent the drum from getting destoryed.
1
2
3
4
5
6
7
8
9
10
11
12
on:start {
	local "$health";
	$health=health("self");
}

on:hit {
	$glob_health=health("self");
	$diff=$health-$glob_health;
	if($diff!=0) {
		heal "self", $diff;
	}
}

this should always repair the drum automatically when it is hit.

old Re: Scripting Questions

Volshebnyi
User Off Offline

Quote
Can someone explain how to use var=?
For example:


1
2
3
4
5
6
var=my_var,Example,80,0;
script=start
on:hit{
	msg "My var: $my_var";
}
script=end

Message wiil be "My var: 0" instead of "My var: 80". But $my_var is now local variable.

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
I think you have to write this instead of the first line because normally variables start with a $ in S2:
1
var=$myvar, Example, 80, 0;

so with this command the object that has this script in its definition will have a box in the editor where you can set a variable to a certain value which normally is 80 (when not editing it). the text to the left of the box will be "Expample" (without the quotation marks) and it is a local variable because of the 0 at the end.

old Re: Scripting Questions

Volshebnyi
User Off Offline

Quote
Hurri04, thanks! I was confused because MassiveMod var declarations are without "$".
1
var=water,Water,0,0

old Re: Scripting Questions

Vicrry
User Off Offline

Quote
Is is possible to create an object with randomcreate() and drop a map marker at the spot the game found? I'd like to make a map that has similar features but is still different whenever it is generated.

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
on:start {
	$m_id=randomcreate("object", [TYPE OF THE OBJECT]);
	$m_x=getx("object", $m_id);
	$m_z=getz("object", $m_id);

	$marker_id=create("info", 36, $m_x, $m_z);
	showindicator $marker_id;
	setindicatorlook $marker_id, [VALUE BETWEEN 1 AND 4];
	setindicatorinfo $marker_id, "[TITLE OF THE INDICATOR ON THE MAP]";
}
this should do the job.

old Re: Scripting Questions

Xaeveax
User Off Offline

Quote
I guess this is sort of (not really) related, but is there a script or something in the game.inf for the randomly placing objects in map editor? Can you pick which things are placed and how frequently?

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
I'm not sure but I think the game takes some values of how many of which objects in which hight shall be created from the files of the random islands:
random_01_endless_e.inf
random_02_endless_n.inf
random_03_endless_h.inf

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
write this into the definition script of the bottle of water:
1
2
3
4
5
on:eat {
		process "Drinking",1000;
		drink 5,0,50,0;
		find [TYPE OF EMPTY BOTTLE];
	}
in fact, the first and the second command line already are in the definition script of the bottle of water so all you need to do is to add the line with the s2 cmd find command.
you can get the type-number by hovering the mouse over the icon of the empty bottle in the editor.

old Re: Scripting Questions

pupp3tStudios
User Off Offline

Quote
Is there a way to change the time of day fast?
For example, through a trigger or something, can i make it turn to nighttime even when it's during the day?

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
you could set the ingame hour to an other value using the commands s2 cmd hour and s2 cmd sethour and also the commands s2 cmd minute and s2 cmd setminute and, if necessary s2 cmd day and s2 cmd setday.

you could start a map where you just stand there for a while, like 10 minutes real-time which you clock on your watch or something and then you open the character menu to have a look at the day, open the inventory and use a watch to get the hours and minutes.
then you have to figure out how long one minute ingame is in real-time.
(I recommend to clock a very accurate value and use a map that you created in the editor, with an arcade-info on it so you wont get hungry/thirsty/tired while you wait, and you can also give yourself a watch to clock the hour and minute!)

next you can use the command s2 cmd timer and trigger an event every few seconds (the amount of seconds one ingame minute takes minus a certain factor to make the ingame minutes have less seconds which the player cant prove because he cant check the seconds ingame).

using this you can skip an ingame minute from 60 ingame-seconds (which are less than 60 real-time-seconds!) to a lower amount, just set the current minute +1, or if the current minute is 59 set it to 0 and set the current hour +1 (same with days).

so if you'd skip half of the minutes a day also would last half as long. the sun should automatically rise faster because it is connected to the current time that is.

at least I think that is how it should work, havent tested it myself yet but I'm pretty sure it will work

old Uhhh?

jessetheduck
User Off Offline

Quote
I wrote my own script's but they will only work on random island with the people I make. I go to list click on the native and paste this script in is something wrong? I'll paste it here. I haven't completed it ive just tried to test it.
page=start
title=Grandpa
text=start
Hey you. How's it going?
text=end
button=trade,I want to trade.
button=action:close,Don't bother me!
button=info,Could you tell me something?

page=trade
title=Trade with grandpa
### Hempleaf -> Cookie
trade=start
sell=83,5
buy=66,1
trade=end
### Hempleaf -> Trunk
trade=start
sell=83,10
buy=7,1
trade=end
### Hempleaf -> Grapes
trade=start
sell=83,15
buy=45,3
trade=end
### Hempleaf -> Grain Pile
trade=start
sell=83,15
buy=42,3
trade=end
### Hempleaf -> Plums
trade=start
sell=83,15
buy=116,3
trade=end
### Hempleaf -> Coconut
trade=start
sell=83,20
buy=27,3
trade=end
### Hempleaf -> Banana
trade=start
sell=83,20
buy=14,3
trade=end
### Hempleaf -> Cacao Fruit
trade=start
sell=83,25
buy=67,3
trade=end
### Hempleaf -> Coffee Fruits
trade=start
sell=83,25
buy=70,3
trade=end
button=action:close,Cheers!

Page=info
title=Grandpa
text=I'll spare some info what do you want to know?
text=end
button:weapons
button:action:close, No thanks. Bye!

Page=weapons
title=Grandpa
text=I know a bit about weapons so I'll tell you how to make some good ones.
text=end
button:Spears
button:Bow
button:Ammo
button:action:close, No thanks I'll just experiment.

Page:Spears
title=Grandpa
text=I know two types of spears the normal spear whitch is simply made with a branch+stone and the claw spear which bleads the victim to death made by claws+branch

old Re: Scripting Questions

DannyDeth
User Off Offline

Quote
"Page:Spears" is really wrong. it is suposed to be
1
page=Spears

Otherwise eveyrhint looks cool

EDIT: A whole lotta that code is wrong actually.

Replace all the ":"'s with "="'s otherwise your code wont work correctly!

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
there is another problem:
this is the code you have to use for dialogues, you cant simply write it into the normal scriptbox of a unit.

the code you wrote there goes into a text container (which you can find at the infos) and then you have to look up and remember the ID of that text container (click on the text container again, you can find it at the top) because you will need it in the script that actually goes into the scriptbox of the unit:
1
2
3
on:use {
	dialogue "start", "[WRITE THE ID OF THE TEXT CONTAINER HERE, WITHOUT THE BRACKETS]";
}

old Re: Scripting Questions

Xaeveax
User Off Offline

Quote
This is probably an easy one, but what would be the definition for the rate at which a unit attacks. I have a unit that attacks at a rate that is way faster than i want it to. Is there a definition to make it slower? I tried rate (like the item one) but it doesn't work on units.

Edit- Also, is there a way to make it that when I use attack2, it uses a different kind of behavior? for example, using a melee attack with a pistol?
edited 1×, last 22.11.10 09:50:36 am

old Re: Scripting Questions

amstel bier9
User Off Offline

Quote
can someone help me?
i want that if i drop item X that you get a timer and when the time is over Item X dissapear.
thanks already
To the start Previous 1 2111 112 113121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview