Forum

> > Stranded II > Scripts > tutorial for scripting
Forums overviewStranded II overview Scripts overviewLog in to reply

English tutorial for scripting

10 replies
To the start Previous 1 Next To the start

old Re: tutorial for scripting

Stranded_Guy2910
User Off Offline

Quote
It's what TimeQuesT said the best way to learn script is analyzing scripts from mods and trying make your own scripts, you can also ask people in the site about specific scripts, and reading other questions from users. This is the best way in my oppinion.

old Re: tutorial for scripting

Stranded_Guy2910
User Off Offline

Quote
You can try a script to make the gate open by using a position script (this one is harder), or just use a script to load a new model, just like:

on:use {
      model "model folder";
}

to use a specifc key you must edit the file "game.ini" and add a new key to the game:

scriptkey=xx,"name of the function"

on:keyhitxx {
           "script";
}

Instead of "keyhitxx" you can use "keydownxx" (if you want to keep the key pressed to use your function) and "keyreleasexx" (to stop the "keydownxx" script, it also need a script too).

Obs.:In the "xx" you must specify a number just like:
scriptkey=01
on:keyhit05

Remembering that the number must be the same for the same function.

old Re: tutorial for scripting

Stranded_Guy2910
User Off Offline

Quote
Oh, sorry.
Try this:

To put on the gate:
on:start {
      if ($gate_open==1) {
                     model "gate open texture folder";
}
}

To put on the item:
on:use {
      $gate_open=1;
}

If not work contact me.
And for have answers for your questions, remember to mark the thread as new/unread.
edited 1×, last 19.10.11 08:12:32 pm

old Re: tutorial for scripting

JustARandomPlayer
User Off Offline

Quote
on:use {
if(playergotitem(#1)<1) {
                          $state=0;
                          }else{
      if(playergotitem(#1)>0) {
                          if($state==0){
                                    model "sfx/gate.b3d";
}
                                    }else{
                          if($state==1){
                                        model "sfx/gate_close.b3d";
}
}
}


"#1" is the id from the key
for example:if you have a key with the id 4,you put #4

old Re: tutorial for scripting

Stranded_Guy2910
User Off Offline

Quote
Man, you was talking about use a item on the gate to open it?

I thought you was talking about use the key separetely and make the gate open.
I use this script in my mod, but it's very more complex.

Sorry for my stupidy.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview