Forum




tutorial for scripting
10 replies



Try to understand other users scripts.
how to make gates open just if i have a specific key
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.
you don't understand me
so....
not a keyboard key
the item key
sorry cuz i don't tell you
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
i get it work
but i made the script by myself

edited 2×, last 21.10.11 07:17:20 pm
You should put your script here because someone can have the same problem than you.
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
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.




