Forum

> > Stranded II > Scripts > Script to spawn objects relative to another object
ForenübersichtStranded II-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Script to spawn objects relative to another object

Keine Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Script to spawn objects relative to another object

blueshift10
User Off Offline

Zitieren
I am trying to make an object spawn another object relative to it's own coordinates. (In this case a jetty spawn next to another jetty).
1
2
3
4
5
6
7
8
9
10
11
12
on:start {

//create local variable for current object id
temp local $locid;

//create local variable for rotation of objects created
temp local $locangle;
$locid=create("object",178);
setpos("object",$locid,getx("self"),gety("self"),getz("self"));
setrot("object",$locid,0,getyaw("self"),0);

}
Whenever I run this script, I get the error: "Memory Access Violation".

Edit: I don't know why the script didn't work but I changed it to this and now it works:

1
2
3
4
5
6
7
8
on:start {
$locx=getx("self");
$locz=getz("self");

//second jetty
$locz-=130;
$id=create("object",178,$locx,$locz);
}

I still can't rotate the objects though, 'setrot' doesn't seem to do affect the object and I can't work out why.

This code doesn't seem to work:
1
2
3
4
5
6
7
8
9
10
on:start {
$rotation=getyaw("self");
$locx=getx("self");
$locz=getz("self");

//second jetty
$locz-=130;
$id=create("object",178,$locx,$locz);
setrot("object",$id,0,$rotation,0);
}
It creates a jetty 130 places further down the z axis relative to the original jetty but the line
1
setrot("object",$id,0,$rotation,0);
doesn't seem to be executed; it still has a rotation of zero.
If anyone knows how to rotate objects that have already been placed, please help.
2× editiert, zuletzt 27.04.13 12:43:54
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtStranded II-ÜbersichtForenübersicht