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 226 27 28121 122 Next To the start

old Re: Scripting Questions

MrCowThing
User Off Offline

Quote
Thanks MC Leaf, the code worked.
I guess I'm just trying to hard and start to over complicate things.

Also I would like to help with s2ext mod instead of making my own new mod just to add things. But I don't know any German at all so I'll help once an english version is released, maybe a english forum to.

old Re: Scripting Questions

garfield751
User Off Offline

Quote
is there a way to script a timed bomb with a timer on it

no need to post the script here i just want to know if its possable

old Re: Scripting Questions

ohaz
User Off Offline

Quote
you could make it with a timer, that starts when you use something, and if this timer ends, there is an explosion and the item disappears. should be possible

old Re: Scripting Questions

Maenardil
User Off Offline

Quote
How to identify which vehicle player is riding? "riding" function returns different results each time I run a game (one time it was 102, another time 105)

old Re: Scripting Questions

DC
Admin Off Offline

Quote
riding should return the ID (not the type!) of the unit the player is currently riding.

old Re: Scripting Questions

Maenardil
User Off Offline

Quote
DC has written
riding should return the ID (not the type!) of the unit the player is currently riding.


You're right. Solution (how to identify vehicle):

1
2
3
4
5
6
$ride_id=riding();
$ride_type=type("unit",$ride_id);
//msg "I'm using $ride_type";
if($ride_type==[unit id as defined in building.inf]){ 
[instructions]
}

old Re: Scripting Questions

Maenardil
User Off Offline

Quote
I don't know German, so you have to test the following, it might not work exactly as I think!

Depends on what you want to do. If you want to alter one item you have to check if this item is in the storage, remove it, and put different item instead. If you want to alter all objects, you have to do it whitin a loop that loops until none of items of type to be change are stored. You need following commands, in brackets optional arguments:

> getstored "object type", "object id"[,"item type"]

If no items of specific type are present, 0 is returned.

> freestored "object type", "object id", "item type" [,"quantity"]

Remove item of specific type from the storge. If quantity is omitted, all items are removed.

> store "item id", "object type", "object id"["mode"]

mode: 0 - store inside, 1 - store outside on the top, 2 - store outside depending on the object (i.e. how fruits hung)

Hope that helps, I assume you know how to use loops and variables.

old Re: Scripting Questions

Guest

Quote
I made a sugar cane object and sugar. I enterned the script ingame and spawned a sugar cane, and destroyed it and it made sugar, like I wanted. But, when I try to plant the sugar nothing happens. Here is the script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
###Sugar
id=969
name=Sugar
icon=gfx\salt.bmo
model=gfx\grain.b3d
scale=0.2
mat=dust
weight=25
info=Sugar from a sugar cane. Makes foods tastier.
script start
	on:eat {
		process "eating",500;
		play "eat.wav";
		eat,5,10,0,10;
		}
	
script=end

And the plant
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
### sugar Cane
id=223
name=Sugar Cane
group=stuff
icon=gfx\grain.bmp
model=gfx\grain.b3d
fx=16
scale=0.8
swayspeed=2
swaypower=5
col=2
health=45
mat=leaf
growtime=5
script=start
	on:kill {
		$tmp=1;
		$tmp2=spawntimer("self");
		if ($tmp2>-3){$tmp=2;}
		if ($tmp2>=0){$tmp=3;}
		create "item",969,getx("self"),getz("self"),$tmp;
		corona getx("self"),getz("self");
		freevar $tmp,$tmp2;
	}
	on:plant {
		spawntimer "self",-4;
	}
script=end

old Re: Scripting Questions

HudaJan
Super User Off Offline

Quote
You'll have to examine game.inf, scripts starting on:start and the patr marked as Planting

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
(Registered)

I tried that, but it still didn't work. I copied the one above it, changed all object id's to 223, and all item id's to 969. When I run s2 and try to plant, nothing happens, not even a german message.

old BIIG scripting ahead.

Guest

Quote
HE he... 1 hour of lisening to music (Queen, The Darknes, NFS soundtracks) AND I GOT IT! What i have? I was searching for an idea to do new extend stranded mod. So there will be: some combinations of food, so there will be some dishes avabile, some tools to do these dishes, and FINALY!: buildings which culd be extend-able (eg. i want to build hut: so i need to do foundations, then wals etc.).
> Is this possible? If it does, which command i need? i was thinking about somethink like bulding treehut (which can be only builded on threes (walls can be builded only on foundations :P) but there is another problem: supplements about i'm thinking can be easly rotated, so it will be quite deformated (think, that for one building, there will be many supplements! BRRR !!).
>How to disable the rotating of building?

P.S.: Sorry for my bad english

old Sorry for double shot (post :P)

Guest

Quote
Sorry for double post, but i found one mistake in source code presented 2\3 posts ago.

1
icon=gfx\salt.bmo

I think there must be "bmp" or somethink, sorry if its mine mistake.

old Re: Scripting Questions

MrCowThing
User Off Offline

Quote
Well I'm not sure if this should be here but, how would I make a .exe file to execute my mod? I've never used .exe files, or know how to use/make them. I'm using a batch file right now.

old Re: Scripting Questions

bezmolvie
User Off Offline

Quote
Miner has written
Sorry for double post, but i found one mistake in source code presented 2\3 posts ago.

1
icon=gfx\salt.bmo

I think there must be "bmp" or somethink, sorry if its mine mistake.


I fixed that, it's not the problom. But heres a quickie fix...

script=start
     on:attack2{
          $xx=getx"unit",1;
          $yy=gety"unit",1;
          $zz=getz"unit",1;
          }
     on:use {
          process "Casting Wand",1000;
          msg "You suddenley find yourself in another place";
          setpos"unit"1,$xx,$yy,$zz;
          }
script=end

I think you get the idea...

old Re: Scripting Questions

DC
Admin Off Offline

Quote
MrCowThing has written
Well I'm not sure if this should be here but, how would I make a .exe file to execute my mod? I've never used .exe files, or know how to use/make them. I'm using a batch file right now.


you don't need to make an exe file for your mod. just use the StrandedII.exe and give it the right parameters. you can use start->run, a bat-file etc. to do this.
1
StrandedII.exe -mod YourModName

old Re: Scripting Questions

Gregg
User Off Offline

Quote
Hi, I have another newbie question.
I can now add diary entries ( ), but I need to know how to add them on an item, e.g.

When I collect the banana I want it say:

     add "";
     add "Yummy!";
     add "I have found a banana palm, and now I have a food source.";
     diary "Bananas";

Is this possible.

Thanks in advance, Gregg.

P.S. How do I do it so when I build an object it makes a diary entry.

old Re: Scripting Questions

Maenardil
User Off Offline

Quote
DC has written
you don't need to make an exe file for your mod. just use the StrandedII.exe and give it the right parameters. you can use start->run, a bat-file etc. to do this.
[code]StrandedII.exe -mod YourModName


I know I don't need. I'm just curious how it was done. I wonder if this is some external method or some esoteric Stranded moding knowledge?
To the start Previous 1 226 27 28121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview