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 232 33 34121 122 Next To the start

old Re: Scripting Questions

MrCowThing
User Off Offline

Quote
Raven Shadow has written
Using attack2 would give much greater control over
what is found and how much.

That code was just for one tool in the Swiss Army Knife, you still used right click to switch tools and to switch what you get more of.

EDIT:
Ok, I've gotten the shield working now. I added
1
on:ai_attack{event "player_hurt","global";}
to all the units that hurt you, then used on:player_hurt for the shield.
edited 1×, last 15.06.08 05:29:43 pm

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
Question: This dosn't work. Why? I've tried everything
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
script=start
	on:use {
		if ($Helmet()==0) {
			maxhealth "unit",1[,15];
			$Helmet+=1;
		}else{
			msg "I already have a helmet on!";
			skipevent;
		}
	}
	on:drop {
		if ($Helmet()==1) {$Helmet-=1;}
			
	}
script=end

old Re: Scripting Questions

dragoana
User Off Offline

Quote
you should remove some brackets:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
script=start 
	on:use { 
		if ($Helmet==0) { 
			maxhealth "unit",1,15; 
			$Helmet+=1; 
		}else{ 
			msg "I already have a helmet on!"; 
			skipevent; 
		} 
	} 
	on:drop { 
		if ($Helmet==1) {$Helmet-=1;} 
                
	} 
script=end

old Re: Scripting Questions

Builder2-0
User Off Offline

Quote
EDIT: Nvm.

Someone needs to fix the English scripting commands page. Or we need to make it a wiki. The German page has A LOT more explanation to it, and even when translated into bad English by Google translater it is still a thousand times more helpful.

-Builder
edited 1×, last 23.06.08 12:44:22 am

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
Is there anyway to stop the player from saving?
And how do you change islands while keeping the player's items?

old Re: Scripting Questions

ESKARN
User Off Offline

Quote
DC has written
loadmap "Map" [,Skills][,Items][,Variables][,Diary][,States][,Buildlocks]

replace everything you want to keep with a 1 and everything you don't want to keep with a 0. you can omit everything after your last 1 since its automatically 0 if you do not enter it. the "[" and "]" just show that the embraced parameter can be omitted so do not write these brackets in your code!

keeping just the items would be this code:
1
loadmap "yourmap",0,1;
or (it's the same):
1
loadmap "yourmap",0,1,0,0,0,0;

Quote
and is there anyway you can build something on a map and go to a different map then come back and it still be there

yes. thats possible but not very easy. you have to save each map somewhere with s2 cmd savemap (which has the same parameters like loadmap) before you load the next one. when going back to this map you load the map you saved. you might also use s2 cmd loadmaptakeover right after loading a map. its 1 if you got stuff from the previous map (map loaded with loadmap and at least one parameter 1) and 0 if not.





thats the way to keep player items

eg

on:use {
savemap "maps\my maps\savemaps\prison2.s2",1,1,1,1,1,1;
loadmap "maps\my maps\savemaps\thedocs.s2",1,1,1,1,1,1;


on:use {
savemap "maps\my maps\savemaps\thedocs.s2",1,1,1,1,1,1;
loadmap "maps\my maps\savemaps\prison2.s2",1,1,1,1,1,1;
edited 1×, last 30.06.08 08:15:42 am

old Re: Scripting Questions

DC
Admin Off Offline

Quote
you do not understand the sense of loadmaptakeover! loadmaptakeover just returns a value. thats all it does! it returns 1 if the current map has been loaded with loadmap and stuff like items or vars or whatever of the last map has been transported to the new map. if nothing from the previous map has been transported to the new map it will return 0.

so writing a script like
1
loadmaptakeover;
makes NO sense. the command does nothing in this script. you just use it to get the return value and to do something with this value. for example:
1
2
3
if (loadmaptakeover()==1){
	msg "there's stuff from the previous map!";
}

old Re: Scripting Questions

garfield751
User Off Offline

Quote
@brandon
Try the fresh water thing in the info section and remember to set a radius

Anyways... does anyone know the script to make something stand still when X happens?

old Iron Eagle

Guest

Quote
Is it possiple to make aircraft turn more realisticly other than just turning on a flat radius please post a script for air craft behaviour if some geniouse can thanks i am planning on makeing a Captain Cook Mod On his travels to the Pacific

old Re: Scripting Questions

NP_Beta
COMMUNITY BANNED Off Offline

Quote
garfield751 has written
Anyways... does anyone know the script to make something stand still when X happens?


yes, its possible

1
2
3
4
on:use
{
freeze [1] [1];
}

the first parameter is for the unit id.in our case its the id of the player (set 0 you will freeze all units) the second isn't important for you

old Re: Scripting Questions

Builder2-0
User Off Offline

Quote
The key to reading broken English is to understand the logic behind the sillyness. In this case there was none and I was just as baffled as you. However, I managed to decipher it (I think). I'm sure DC or someone else will correct me if I'm wrong though, so here goes nothing...

selectplace is the command for replicating the "build" view. To use it you do like so:

selectplace "text",height

Text is what appears for the player, ie; "Build", or whatever. Height is the camera's height above the ground. So, you use selectplace along with selectplace_x\y\z to detect where the player is clicking, and therefore you can use it to do things OTHER than building.

You could for example use it to allow the player a way to setup smoke signals. Or other cool shit. Which I am already thinking of ways to use in Massive Mod.

-Builder
To the start Previous 1 232 33 34121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview