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 2118 119 120 121 122 Next To the start

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
this is the definition script for the solar panel building:
1
2
3
4
5
6
7
8
9
10
11
12
13
script=start
on:use {
	exchange "self", 1, [TYPE-Number of empty Batteries], [TYPE-Number of charged Batteries];
}

on:changeday {
	if(getstored("self", [TYPE-Number of empty Batteries])>=2) {
		alteritem 2, [TYPE-Number of empty Batteries], 2, [TYPE-Number of charged Batteries];
	}elseif(getstored("self", [TYPE-Number of empty Batteries])==1) {
		alteritem 1, [TYPE-Number of empty Batteries], 1, [TYPE-Number of charged Batteries];
	}
}
script=end

old Re: Scripting Questions

Lion_Hearted
User Off Offline

Quote
Um... this is your script after I modified it...


1
2
3
4
5
6
7
8
9
10
11
12
13
script=start
on:use {
     exchange "self",1,6,17;
}

on:changeday {
     if(getstored("self",6)>=2) {
          alteritem 2,6,2,17;
     }elseif(getstored("self",6)==1) {
          alteritem 1,6,1,17;
     }
}
script=end

However, it didn't work...

Did I do something wrong?

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
so, which part of the script doesnt work?

cant you open the exchange menu by using the building?
is it the batteries that arent charged?

and is there any error message (in the console or somewhere else)?
or does simply nothing happen at all?

as you just put the type-numbers in there I guess there isnt much that you could do wrong in this script. maybe there is a problem with another script somewhere...?

old Re: Scripting Questions

lucas is stranded
User Off Offline

Quote
Idk if this question fits in here or newbie help but how do I raise/lower terrain in the editor?


I tried everything, but I simply forgot how to do it.


The raise terrain button doesn't change anything... it keeps painting the ground.

old Re: Scripting Questions

Lion_Hearted
User Off Offline

Quote
I think the alteritem command doesn't work Hurri04, cause I can stick batteries in there, however it doesn't change them overnight...

old Re: Scripting Questions

Vectarrio
User Off Offline

Quote
lucas is stranded has written
Idk if this question fits in here or newbie help but how do I raise/lower terrain in the editor?


I tried everything, but I simply forgot how to do it.


The raise terrain button doesn't change anything... it keeps painting the ground.

use mousewheels instead of mousebuttons

old Re: Scripting Questions

lucas is stranded
User Off Offline

Quote
Vectar666 has written
lucas is stranded has written
Idk if this question fits in here or newbie help but how do I raise/lower terrain in the editor?


I tried everything, but I simply forgot how to do it.


The raise terrain button doesn't change anything... it keeps painting the ground.

use mousewheels instead of mousebuttons


I'm using a laptop.


And I'm pretty sure I lost my mouse.... Somewhere...

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
@lucas is stranded:
I doubt that there is another way than doing it with the mousewheel.
so I guess you have to buy a new mouse if you cant find your old one. the cheap ones start at 10€ and then the prize goes upwards...


@Lion_Hearted:
well, if the command doesnt work you'll have to do it the oldschool way
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
script=start
on:use {
	exchange "self", 1, [TYPE-Number of empty Batteries], [TYPE-Number of charged Batteries];
}

on:changeday {
	if(getstored("self", [TYPE-Number of empty Batteries])>=2) {
		freestored "self", [TYPE-Number of empty Batteries], 2;
		loop("count", 2) {
			$batteries_id=create("item", [TYPE-Number of charged Batteries]);
			store $batteries_id, "self";
		}
	}elseif(getstored("self", [TYPE-Number of empty Batteries])==1) {
		freestored "self", [TYPE-Number of empty Batteries], 1;
		$batteries_id=create("item", [TYPE-Number of charged Batteries]);
		store $batteries_id, "self";
	}
}
script=end
I think this should work now...

old Re: Scripting Questions

Vectarrio
User Off Offline

Quote
@lucas is stranded:
Try changing mwheels to smth else in options. I'm not sure if this works, but, just try it!

old Re: Scripting Questions

lucas is stranded
User Off Offline

Quote
I remembered how I used to raise/lower terrain...


I had this laptop cleaned up and the guy switched my touchpad driver for a crappy one with no rollbar.


Finally I can work on my map again!

old Re: Scripting Questions

Lion_Hearted
User Off Offline

Quote
Ok, probably the most complicated script I'm gonna ask you guys to think up...


I want a script, that will check the players "y" level. and if the y is (-20 to 0) it will change the player's jump factor and jump time, and it will make the player jump...


Sorta like salmon jumping out of the stream...

it could even be a key that when you press it, you'll jump out of the water if your at -20 to 0 y...

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
sorry, you cant jump while being in the water.
you cant even make the player jump by a script when he is out of the water.

the only thing you could do is use a script button, then start an event when this button is pressed and then start a timer on this event which repeats a couple of times in small intervals and whenever this timer is triggered you can set the player a little bit higher with the s2 cmd setpos command.

but there is also the fact that the player starts falling once he gets out of the water and unless the timer interval is very small the player would jump a bit higher, fall down, jump higher, fall down... so it would look very unrealistic.

old Re: Scripting Questions

Lion_Hearted
User Off Offline

Quote
I want to make a new key...


several items in my mod, are going to have multiple single key purposes...

You'll be able to eat them, use them, and modify them... How to I make a key that can be called upon... such as use is "e" eat is "r" and both of them have their own event command... I want something like...

"f" is ingest... so that any item I come to, I can write this command

on:ingest {

I tried the script key approach in the game.inf, and to say the least, it wasn't impressive... instead of just acting on the item in my hand, it acted upon all others too... and it had to be in my hand, it couldn't be in the combinations menu...

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
so you already implemented script keys in your mod?

well, from that point all you have to do is to check on:ingest which item you have in your hand using the command s2 cmd getplayerweapon and several s2 cmd if -requests so when pressing the button you have different commands for each item.

old Re: Scripting Questions

Lion_Hearted
User Off Offline

Quote
So...


Since theres going to be literally over 50 items in my mod using this third command... it would be easier to find an alternate way or modify the original stranded 2 core...

Correct?

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
I dont think so...
however, if they all have to do the same thing when you press the button it's basically just copy'n'pasting the same script over and over.
and in case that several of these items are in the same ID-range you can even use ">", "<" and "&&" to check whether the item is within that ID-range so e.g. if there are like 10 items which IDs go on straight you dont have to copy&paste the script 10 times but only 1 time.

old Re: Scripting Questions

UnIdEnTiFiEd
User Off Offline

Quote
how do i make it that if i pick something up, it will create 100 of something, and will change from what i picked up to something else?

old Re: Scripting Questions

Hurri04
Super User Off Offline

Quote
1
2
3
4
5
6
on:collect {
	skipevent;
	$id=currentid();
	free "item", $id;
	find [new item type], 100;	
}

old Re: Scripting Questions

lucas is stranded
User Off Offline

Quote
What did I done wrong on this NPC script?

Spoiler >


It says "Invalid DIALOG TRADE property 'trade' " when I click the "I'm hungry" option.

old Re: Scripting Questions

Kirschkaffee
User Off Offline

Quote
Quote
### Coin -> Fish
trade=start
sell=132,8
buy=90,1
### Coin -> Small Meat
trade=start
sell=132,8
buy=11,1


You forget trade=end twice, maybe thats the problem here. cant see anything else, that could be wrong.
To the start Previous 1 2118 119 120 121 122 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview