Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Get entity speed
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#1
Get entity speed

Hi.
I would really like to know how to get the speed of an object, held by the player.
I read a thread where Palistov said it wasn't possible, but it has been proven wrong, because I played a CS (Which I of course has forgotten the name of), where you had to break a door with a rock.
If you didn't hit hard enough, a message would say, "It needs greater force".

I'm trying to achieve the same thing, and i remember looking at the script when i had the CS, because i was fascinated by that script.

It was pretty advanced, and something with dividing time and something else, to get the speed. You know, pure math.


Either way if you could help me remember the story name, i can tell you what i remember of the story.


A man (The player) and a woman has come to a castle to look at archeology. There is some trembling. The woman takes the lantern and explores the building while the man rests. He wakes up by another trembling through the castle. He starts exploring the different rooms in the main hall, where he fx. has to break a door with a rock. Later on he finds the lady burried in rocks, with only her hand sticking out. Here he obtains the lantern.

That is how much i remember. Does any of you know it? Or know the script?

I hope you do! Smile

Trying is the first step to success.
(This post was last modified: 02-06-2013, 07:47 PM by FlawlessHappiness.)
02-06-2013, 07:46 PM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#2
RE: Get entity speed

That was from The Great Work. Try contacting Damascus. Maybe he can help you?

In Ruins [WIP]
02-06-2013, 09:34 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#3
RE: Get entity speed

I'll see! Thank you very much!

Trying is the first step to success.
02-06-2013, 09:51 PM
Find
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#4
RE: Get entity speed

Paul's right, you cannot check an entities speed in a literal sense, but you can gimmick your way around it. You set up 2 areas to collide with the thrown object. When colliding with the first area (closest to the player), start a timer; when the object collides with the 2nd area (destination), use an if/else statement to check the total time that has elapsed, and whether or not it should be faster.

If it was fast enough (/the time was short enough), then you could trigger the script. If not, you could have the object stop/reset the timer when you next interact with it.

Idk, something like that. Good luck.

I rate it 3 memes.
02-06-2013, 09:57 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#5
RE: Get entity speed

Thank you.

I was more looking for something where you hold the object, and then hit it on the door...

Well, if it's like your described it, then it doesn't sound like any problem at all Wink

Thank you guys!

Trying is the first step to success.
02-06-2013, 10:01 PM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#6
RE: Get entity speed

The only way to, in a general sense, track an object's speed is to track the position of the object at a set interval. Position tracking of objects is a tricky thing - and there are multiple ways to go about it:

  1. Octtree search - This involves having an object hidden off the map to which you attach special block-box entities. You then determine which of the boxes the tracked object is in and subdivide them. You repeatedly do this until you reach the boxes of a small enough resolution, where you can average the coordinates to obtain a reasonable COM for the object. This search has to be done each time you poll the position, and AddAttachedPropToProp is very slow.
  2. Script-area grid - This is like the above approach except you generate (automatically) a huge array of script areas and just add a bunch of collision callbacks. This makes the map editor lag and isn't suitable for large maps.
  3. Trilateration - You need 4 objects placed outside the map. You then attach a bunch of spheres of different radii which let you poll the distance to each of the objects outside the map. Given that you know the distances from your object to the external object, and you know the positions of these objects you can implement trilateration to calculate the position. The downside here is that the maths is tricky!

When you have the position of the object, you can store it and calculate the change in position to get the speed. However, there is a simpler method for the door problem: you can always just set up the toughness & health values on the entities to bypass the whole speed check and let the game handle breaking the door.
(This post was last modified: 02-06-2013, 11:38 PM by Apjjm.)
02-06-2013, 11:36 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#7
RE: Get entity speed

Ah..

I got a little off, when you came to the script about stuff outside the map...
I'll see what they did in The Great Work, i think the timer-thing from AndyRocking is enough Wink


What i want to do is to have the pipe from the Cistern Entrance that breaks, to block a hole in the wall, and you have to smash it with a rock...
I'll figure it out.

Really thank you for the help guys!

Trying is the first step to success.
02-07-2013, 12:18 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#8
RE: Get entity speed

You don't need a script for one object to break another object. If you remember, entities allow you to specify the force required to be applied to the object in order for them to break. It should be no different than breaking glass or plates with a crate. You should be able to have some kind of collision detection mechanism (e.g. with a sticky area that denies all objects) that checks the health of the object to be broken and if the health is not at a broken level, display the message.

Tutorials: From Noob to Pro
(This post was last modified: 02-07-2013, 12:42 AM by Your Computer.)
02-07-2013, 12:41 AM
Website Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#9
RE: Get entity speed

How would the sticky area call any function, if it denies all objects?

Trying is the first step to success.
02-07-2013, 07:53 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#10
RE: Get entity speed

(02-07-2013, 07:53 AM)BeeKayK Wrote: How would the sticky area call any function, if it denies all objects?

By "deny" i meant preventing objects from getting stuck by passing false to SetAllowStickyAreaAttachment.

Tutorials: From Noob to Pro
02-07-2013, 11:01 AM
Website Find




Users browsing this thread: 1 Guest(s)