Rotating a spawned Object

Post your scripting questions / solutions here

Moderator: Moderators

HeavenBound
Colour Sergeant
Posts: 85
Joined: Thu Sep 11, 2008 12:55 am

Rotating a spawned Object

Post by HeavenBound »

Hey, I'm making a mod, similar to something like the old James Bond Games....


Here's an example

Code: Select all


//------------Shotgun-----------------------

shotgun:

local.trig = spawn trigger_multiple targetname triggerit 
local.trig.origin = ( -789 2436 -113 )
local.trig setsize ( -10 -10 -10 ) ( 10 10 10 )
local.trig setthread got_shotgun
local.trig wait 2

local.shotgun = spawn script_model targetname shotgun 
local.shotgun model "weapons/shotgun.tik"
local.shotgun.origin = ( -789 2436 -113 )
local.shotgun.scale = 1.0

end
I want the shotty (along with the rest of the weapons) to rotate in the air. I know its done with .angles...but i'm not sure what to put.

Thanks in advance. =)
HeavenBound

I'm new at this :)
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Maybe one of these will do:

Code: Select all

rotateX ( Float avelocity )     
Rotate about the x axis at the specified angular velocity.

rotateY ( Float avelocity )     
Rotate about the y axis at the specified angular velocity. 

rotateZ ( Float avelocity )     
Rotate about the z axis at the specified angular velocity.

Basically, use a float (or integer) to represent to what degree you want the object to rotate. "local.object rotateZ 360.0" will make it turn around (direction of it's Z angle) a full circle.

Cheers!
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
HeavenBound
Colour Sergeant
Posts: 85
Joined: Thu Sep 11, 2008 12:55 am

Post by HeavenBound »

ugh...Most of my weapons are spawning below the map...I raise their .origin (last number) but I get nothing. =\
HeavenBound

I'm new at this :)
Tazz
Second Lieutenant
Posts: 155
Joined: Fri Feb 16, 2007 1:29 pm
Contact:

Post by Tazz »

make sure u r going the right way....u know sometimes when working with - origins u have to actually lower the number to get what u want meaning -113 might have to be -83 instead of -163....or vice versa...try going in both direction
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

That's called basic maths Tazz :) Besides, the engine will do just that if you add "+ ( 0 0 40 )" after the origin you specified.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
HeavenBound
Colour Sergeant
Posts: 85
Joined: Thu Sep 11, 2008 12:55 am

Post by HeavenBound »

Well, I added to the last number (Z) and it ended up spawning the rifle in the Center Building Roof Balcony, when the origin is at Southeast path...It was rotating, but dunno why it spawned there...

I'm assuming X = Lenght, Y = Width, and Z = Height...please correct me if I'm wrong.

Thanks.
HeavenBound

I'm new at this :)
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

And you noted down the coords with "whereami" enabled? Then it should be accurate. Show this origin and I'll see if it's the same on my game.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
HeavenBound
Colour Sergeant
Posts: 85
Joined: Thu Sep 11, 2008 12:55 am

Post by HeavenBound »

wherami 1 does nothing on my game..I just type in coord.


Is there a difference? Something I'm missing lol...

I don't have the coord anymore, I redid them all and now none of them are spawning anywhere visible lol.
HeavenBound

I'm new at this :)
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Oh, an SH/BT user... That's the one of the reason why I never mod on those games. Getting coords is annoying work.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
Aprop
Major
Posts: 291
Joined: Mon Nov 17, 2008 3:40 pm

Post by Aprop »

$oldier Of Ra wrote:Oh, an SH/BT user... That's the one of the reason why I never mod on those games. Getting coords is annoying work.
What? I modding bt since got moh!! But i never had such problems with coords....
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

No problem with the coords, just getting the coords is annoying since I need to type "coord" in the console over and over and over....
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
HeavenBound
Colour Sergeant
Posts: 85
Joined: Thu Sep 11, 2008 12:55 am

Post by HeavenBound »

lol, I'm not a Sh/BT user. Strictly AA....and its not working.

I've tried using coord and viewpos. Nothing is working. My guns aren't showing up!! =(
HeavenBound

I'm new at this :)
Tazz
Second Lieutenant
Posts: 155
Joined: Fri Feb 16, 2007 1:29 pm
Contact:

Post by Tazz »

do like sor said....get a ss of the place or places u want the weapon and we can get u the coords for the place....with the coords in ur post up top that is nowhere ne se path if ur talking about the algiers map....either way take a screenshot of the place and then go from there
HeavenBound
Colour Sergeant
Posts: 85
Joined: Thu Sep 11, 2008 12:55 am

Post by HeavenBound »

I got 1 to show up! But then when I added the rest in, the mod failed lol...I'll go take some SS's.
HeavenBound

I'm new at this :)
$oldier Of Ra
Lieutenant Colonel
Posts: 404
Joined: Sun Oct 16, 2005 7:16 pm
Location: Belgium
Contact:

Post by $oldier Of Ra »

Wait, wait, let me get this straight, you use AA but don't use whereami to get your coordinates?

NO screenshots, show me the script! Let me see what you're doing wrong.
Our official website: http://www.mohaairborne.co.cc
(Still accessible through http://mohaaclantb.tk and http://users.skynet.be/mohaaclantb/)

For all your bot needs!!!!

$oldier Of Ra.
Post Reply