Forum

> > Stranded II > Scripts > Script to spawn objects relative to another object
Forums overviewStranded II overview Scripts overviewLog in to reply

English Script to spawn objects relative to another object

No replies
To the start Previous 1 Next To the start

old Script to spawn objects relative to another object

blueshift10
User Off Offline

Quote
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.
edited 2×, last 27.04.13 12:43:54 pm
To the start Previous 1 Next To the start
Log in to reply Scripts overviewStranded II overviewForums overview