Game Development Community

DTS manipulation question

by Spencer Strombotne · in Technical Issues · 05/15/2008 (10:32 am) · 7 replies

I'm new to torquescript and I have two questions.

1. I have an item and it set's rotate = true when it is created. When the player runs over it, I want it to stop rotating. How would I do this?

2. Similar to number 1. I have the same item and I want it to move +5 units on the y-axis every time a player runs over it.

Thank you.

#1
05/15/2008 (11:31 am)
There might be a better way but off the top of my head to answer question 1 is - The rotation value is stored in the item datablock. What you could do is call the item's collision function when the player makes contact with it and replace the item with a new one that uses another datablock with the rotate value set to false. You also might just be able to update that item's datablock with the new one but I'm not sure.

For question 2 you could try in the OnCollision callback.

%position - %item.GetPosition();

%x = Getword(%position, 0);
%y = GetWord(%position, 1);
%z = GetWord(%position, 2);

%y = %y+5;

%position = %x SPC %y SPC %z;

%item.SetTransform(%position);
#2
05/15/2008 (12:34 pm)
Thank you for your help. I have question 2 working. I could use that method for question 1 but I was wondering if there was a way to change the items rotation after it had already been created without replacing it.
#3
05/15/2008 (12:38 pm)
Hm,
the source for Item suggests that the "rotate" flag belongs to the item itself, not the datablock,
so just %item.rotate = false might work.
#4
05/15/2008 (1:41 pm)
Well,
it looks like that won't quite work.
that field isn't being ghosted to the clients.
if it were, that would be the ticket.

i guess you could delete the item and replace with a clone that's the same in every respect except for the rotate bit, but that's pretty kludgey.

if there were a way to set the InitialUpdateMask of an existing object, that would do it too. i don't know of any way to do that, though.
#5
05/15/2008 (1:42 pm)
Fwiw,
this would be v. easy to fix as an SDK owner.
#6
05/15/2008 (2:01 pm)
I am an SDK owner. It's just registered under another account name.