Forum

> > Stranded II > Scripts > Scripting Questions
ForenübersichtStranded II-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Scripting Questions

2.429 Antworten
Seite
Zum Anfang Vorherige 1 216 17 18121 122 Nächste Zum Anfang

alt Re: Scripting Questions

E_net4
User Off Offline

Zitieren
bizzl hat geschrieben
E_net4 hat geschrieben
Huh, yes? That just tells me the syntax of an event.

Beneath the Heading "Ereignisse" there is a full listing of all system events
And where the freak is that?

alt Re: Scripting Questions

bizzl
User Off Offline

Zitieren
Alphawar hat geschrieben
ok i just want to know.
is the tree house done with scripts??
if so would you beable to make it that you could build an expansion onto a building using a simular script??

Nope, the tree house isn't done by script. If you would have looked into the buildings.inf, you would have noticed the following lines:
1
2
buildspace=at object
atobject=[i]some ID, don't have the files here, sry[/i]
they're responsible for the attaching

E_net4 hat geschrieben
bizzl hat geschrieben
E_net4 hat geschrieben
Huh, yes? That just tells me the syntax of an event.

Beneath the Heading "Ereignisse" there is a full listing of all system events
And where the freak is that?

omfg the list is written using bold text for the event names
But here, extra for you (translated by google, but should be sufficient):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
[b]start[/b] - at the start of the map (except when loading a game booth)
[b]load[/b] - loading the map (whether starting or playing status)
[b]presave[/b] - before saving a game booth
[b]postsave[/b] - after saving a game booth
[b]create[/b] - when creating (only during the game, not at the shop)
[b]use[/b] - Use the Modify button / Items on the use inventory
[b]hit[/b] - for damage caused by the player
[b]kill[/b] - for destruction / murder
[b]collect[/b] - when picked up an item with the Use button
[b]drop[/b] - while away a Items
[b]trigger[/b] - if the conditions of a trigger info met
[b]changeday[/b] - at the daily exchange at 00:00 pm
[b]sleep[/b] - sleep when
[b]dig[/b] - will use a groundbreak (= behaviour spade) for all nearby objects triggered
[b]fish[/b] - will use an Angel (= fishingrod behaviour) for all nearby objects triggered
[b]useground[/b] - Use of Soil
[b]usesea[/b] - Use of Water
[b]impact[/b] - at the meeting with a weapon (used in weapons and ammunition triggered)
[b]timer[/b] - at the end a timer
[b]getoff[/b] - at the downswing (of vehicles / mounts)
[b]attack1[/b] - Use Items as a tool / weapon with the left mouse button
[b]attack2[/b] - Use Items as a tool / weapon with the right mouse button
[b]ai_attack[/b] - if the player from a unit is attacked
[b]ai_idle1[/b] - when playing the animation Idle 1 (at Units)
[b]ai_idle2[/b] - when playing the animation Idle 2 (in units)
[b]ai_idle3[/b] - when playing the animation Idle 3 (in units)
[b]nodeXXXX[/b] - if a unit, which follows a path that information with ID XXXX in the path reached (at the unit executed)
[b]reach[/b] - if one unit, which follows a path, a path reached in Vienna (Vienna when executed)
[b]selectplace[/b] - click on the terrain placement mode
[b]cracklock_success[/b] - the successful cracking of a lock
[b]cracklock_failure[/b] - in a failed attempt Schlossknack
[b]build_setup[/b] - when choosing a building in the building list
[b]build_start[/b] - while creating a construction site
[b]build_finish[/b] - in a building Finish
[b]keyhitXX[/b] - when you press a script Keys (game.inf only in the script)
[b]keydownXX[/b] - beim Gedrückthalten eines Scriptkeys (nur im game.inf-Script)
[b]keydownXX[/b] - while holding down a script Keys (game.inf only in the script)
[b]keyreleaseXX[/b] - when you release a script Keys (game.inf only in the script)
[b]spawn[/b] - at Spawnen on a spawn Control
[b]addstate[/b] - adding a States
[b]freestate[/b] - removing a States
[b]separate[/b] - at a meeting attached Items
[b]edset[/b] - when an object is placed in the editor
[b]inhand[/b] - when an item in the hand is taken (by the Item)
[b]noammo[/b] - at the shooting without ammunition (for the weapons-Item)

alt Re: Scripting Questions

Alphawar
User Off Offline

Zitieren
even with the buildings being objects would you be able to script another buildings placement or something so that you would need it to be connected???


also slightly off topic

i was wanting to make a countdown timer till a window closed on my first c++ script is there a way to make it that it goes automaticly but like goes down one every second or so that i just hit enter cause atm i have to hit a number then hit enter and if a letter get in then it closes straight away heres the code from that area if it helps

the spaces means they are on another line just to make it easyer to read

cout << "\nplease type a number between 13-8 : ";

cin >> n;

if (n>13) n=13; //keeps number low

if (n<8) n=10; //number isnt to low

k=n;

while (k>0) {

cout << "\n enter any number and hit enter !!!" << k <<"!!!\n";

cin >> n;

if (n!=100) k=k-1;

alt Re: Scripting Questions

bizzl
User Off Offline

Zitieren
Alphawar hat geschrieben
even with the buildings being objects would you be able to script another buildings placement or something so that you would need it to be connected???

You're able to create a working building via scripting, yes.

Alphawar hat geschrieben
also slightly off topic

i was wanting to make a countdown timer till a window closed on my first c++ script is there a way to make it that it goes automaticly but like goes down one every second or so that i just hit enter cause atm i have to hit a number then hit enter and if a letter get in then it closes straight away heres the code from that area if it helps

the spaces means they are on another line just to make it easyer to read

cout << "\nplease type a number between 13-8 : ";
cin >> n;
if (n>13) n=13; //keeps number low
if (n<8) n=10; //number isnt to low
k=n;
while (k>0) {
cout << "\n enter any number and hit enter !!!" << k <<"!!!\n";
cin >> n;
if (n!=100) k=k-1;

Even though this is not a scripting questions (since C++ is a compiled language), lets "solve" your problem:
When you enter a letter instead of a number, your program simply crashes, because you try to fit a non-integer value into an integer variable. Try to buffer the input into a string and then check it before converting it to integer.

alt Re: Scripting Questions

Alphawar
User Off Offline

Zitieren
thanks for the help

that does help

but my question was really am i able to make it that the counter goes down every second rather than instantly???

also for the lions what did you want to do in the script cause there are different ways you could do it really depends on what you wanted to do

alt Spawn Scripts?

lint35
User Off Offline

Zitieren
How would I make a spawn like... If you die on a map then you respawn where you placed it in the Editor.

alt Re: Scripting Questions

Brandon
User Off Offline

Zitieren
on:kill {
revive;
}

oh...I don't know... may be you should use something like treehouse script...

alt Re: Scripting Questions

lint35
User Off Offline

Zitieren
Umm I tried it with debug on but it says "expecting semicolon" here is the script: on:kill {
          revive "human"1,-5903,1208,-6107; }
          $rnd=random(1,3);
          if ($rnd==1){ play "human_die1.wav"; }
          if ($rnd==2){ play "human_die2.wav"; }
          if ($rnd==3){ play "human_die3.wav"; }
          if (currentid()!=1){
               event "iskill_hunt","global";
          }
          freevar $rnd;
     }

alt Re: Scripting Questions

jeepohahyo
User Off Offline

Zitieren
1st point, code cleanup
1
2
3
4
5
6
7
8
9
10
11
on:kill {
       revive "human"1,-5903,1208,-6107; }
       $rnd=random(1,3);
       if ($rnd==1){ play "human_die1.wav"; }
       if ($rnd==2){ play "human_die2.wav"; }
       if ($rnd==3){ play "human_die3.wav"; }
       if (currentid()!=1){
           event "iskill_hunt","global";
      }
      freevar $rnd;
}

And we see in line 2:
Too many arguments. s2 cmd revive takes exactly ONE argument. I don't have an idea what you wanted to do with the other numbers

And by the way: The curly brace after line 2 is too much

1
2
3
4
5
6
7
8
9
10
11
12
on:kill {
       revive 1;
       s2:setpos "unit", 1, YOUR_X, YOUR_Y, YOUR_Z
       $rnd=random(1,3);
       if ($rnd==1){ play "human_die1.wav"; }
       if ($rnd==2){ play "human_die2.wav"; }
       if ($rnd==3){ play "human_die3.wav"; }
       if (currentid()!=1){
           event "iskill_hunt","global";
      }
      freevar $rnd;
}
1× editiert, zuletzt 27.02.08 21:58:18

alt Re: Scripting Questions

bizzl
User Off Offline

Zitieren
lint35 hat geschrieben
on:kill { revive "human"1,-5903,1208,-6107; }

1. There is no class "human" (the correct class would be "unit")
2. You forgot a comma between the class and the id parameters
3. There is no need for the class parameter and any of the last third parameters anyway, since s2 cmd revive takes only one argument: the id of the unit to be revived.

Your code should be something like this:
1
2
3
4
5
6
on:kill {
	if (currentid()==1) {
		revive 1;
		setpos "self",-5903,1208,-6107;
	}
}

alt Re: Scripting Questions

HudaJan
Super User Off Offline

Zitieren
Phew, I really don't understand, what's wrong... The script ai_mode
1
2
3
4
on:start {
$id=currentid();
ai_mode $id,"flee";
}
It just does'nt work....

alt Re: Scripting Questions

HudaJan
Super User Off Offline

Zitieren
Flying Lizard hat geschrieben
it doesn't work with some behavours, on wich unit do you use it?

Behaviour predator...
Err... Is there different way how to change behaviour raptor onto some other...?
1× editiert, zuletzt 29.02.08 20:40:40

alt Re: Scripting Questions

bizzl
User Off Offline

Zitieren
HudaJan hat geschrieben
Flying Lizard hat geschrieben
it doesn't work with some behavours, on wich unit do you use it?

Behaviour predator...
Err... Is there different way how to change behaviour raptor onto some other...?

predator = raptor.
And there is btw no way to change the behaviour
Zum Anfang Vorherige 1 216 17 18121 122 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtStranded II-ÜbersichtForenübersicht