Forum

> > Stranded II > Scripts > gates with keys
ForenübersichtStranded II-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch gates with keys

6 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt gates with keys

JustARandomPlayer
User Off Offline

Zitieren
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
2× editiert, zuletzt 15.10.11 09:26:41

alt Re: gates with keys

uyuyuy99
User Off Offline

Zitieren
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.

alt Re: gates with keys

JustARandomPlayer
User Off Offline

Zitieren
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
1× editiert, zuletzt 19.11.11 12:19:52

alt Re: gates with keys

uyuyuy99
User Off Offline

Zitieren
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

alt Re: gates with keys

JustARandomPlayer
User Off Offline

Zitieren
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)"
1× editiert, zuletzt 19.11.11 12:31:18
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtStranded II-ÜbersichtForenübersicht