Forum

> > Stranded II > Scripts > gates with keys
Forums overviewStranded II overview Scripts overviewLog in to reply

English gates with keys

6 replies
To the start Previous 1 Next To the start

old gates with keys

JustARandomPlayer
User Off Offline

Quote
hi guys
can someone tell me a script for a gate
the gate must open/close just if i have a key with a specific id
pleaseeeee!!!
pleaseeeeee
someone pleaseee help me
edited 2×, last 15.10.11 09:26:41 am

old Re: gates with keys

uyuyuy99
User Off Offline

Quote
Here's a simple script for the gate:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
on:start {
	local $reused=0;
}
on:use {
	if ((playergotitem(4)==0) && ($reused==0)) {
		$reused=1;
		speech "negative";
		msg "You don't have a key!",3;
		event "use";
	}
	elseif ($reused==1) {
		$reused=0;
	}
}

Replace the 4 in "playergotitem(4)" with the ID of the item you need to have in your inventory to use the gate.

old Re: gates with keys

JustARandomPlayer
User Off Offline

Quote
hmmmmm...........
first
you don't teste it because it won't work for me
second
i found myself how to make that script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
on:use {
if(playergotitem(#1)<1) {
                          $state=0;
                          }else{
      if(playergotitem(#1)>0) {
                          if($state==0){
                                    model "gfx/gate.b3d";
}
                                    }else{
                          if($state==1){
                                        model "gfx/gate_close.b3d";
}
}
}
"#1" is the id from the key
for example:if you have a key with the id 4,you put #4
edited 1×, last 19.11.11 12:19:52 pm

old Re: gates with keys

uyuyuy99
User Off Offline

Quote
Actually, I did test it with the original gate object from the game and it worked.

And why do you have your models in the sound effects folder? lol

old Re: gates with keys

JustARandomPlayer
User Off Offline

Quote
ooo
sorry
is gfx folder
and about your srcipt
it works but you just made one mistake
instead of "playergotitem(#4)" you had put "playergotitem(4)"
edited 1×, last 19.11.11 12:31:18 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview