Arrew
Registered:1393602597 Posts: 2,750
Posted 1409048738
Reply with quote
#1
I need to set a named value to the same number of a named objects position X. Suggestions?
Nighthawk
Registered:1406641081 Posts: 141
Posted 1409057708
Reply with quote
#2
you mean like an array? like, object1, object2, object3 ?
Arrew
Registered:1393602597 Posts: 2,750
Posted 1409059907
Reply with quote
#3
As in the Artemis is at Position X 50000 , Y 0, Z 25000 So I want Value artXpos to equal 50000
Nighthawk
Registered:1406641081 Posts: 141
Posted 1409063023
Reply with quote
#4
so, the question is "Can I make a variable linked to an object's position component ?" I believe the answer it yes... but depends on how you create the variables. you can't link to "object_Artemis.position.x" at run time, but you can create variablePosX, and assign variablePosX to the X part of the position at the object's creation time.
Arrew
Registered:1393602597 Posts: 2,750
Posted 1409066345
Reply with quote
#5
I can set a position to a Veriable. But can I set a Veriable to the same number as a position? Basicly I want a mine to appear on an enemy ship, destroying it, half way through a mission. Because the enemy moves I have no idea of it's exact location at that time in the mission. Suggestions on how I can do that? Can mines be made a named object?
Xavier Wise
Registered:1375817447 Posts: 1,362
Posted 1409074917
Reply with quote
#6
Why do you want to destroy an enemy ship with a mine? Would it not be simpler to just destroy the enemy ship using the destroy command, rather than with a mine. The only reason I can see you wanting that is if you wanted ships nearby to be affected.....hmm actually, I can see this scenario. Basically, you want the ship to blow up and affect the ships around it.... like the blast from a warp core exploding or something... I cannot think of a way to do this off the top of my head. If I think up something, I will give it a try and post on here.
__________________ Fleet Captain Xavier Wise - TSN SabreLink to TSN RP Community Website Want to follow development of the TSN Sandbox? Head here:https://ko-fi.com/xavierwise
cxfAtheus
Registered:1400462879 Posts: 334
Posted 1409076362
Reply with quote
#7
You can do this in a two-step process. First create the object (mine) at some out of the way coordinates (I just use 0,0,0). Then use the set position action and choose to set position relative to object X (the enemy ship). This will relocate the mine to X meters (you decide) away from the ship. Here's the lousy part. You can't actually move a mine since it isn't a named object. You can either create a "ship" in the vesseldata file, or you can create a generic mesh using the mine files...but they won't explode. You'd have to use the destroy action. I wonder, though, if you could create a mine-like object in the vesseldata, then spawn and move it like I mentioned above, and then set all of it's nodes to 100% damage. Would that cause the mine to "detonate"?
Badgeguy
Registered:1375080733 Posts: 316
Posted 1409103430
Reply with quote
#8
I have a binary search routine that will do what you are looking for. I used it as a self destruct sequence. Let me see where I put it. It is not a two line routine though.... Ah... there it is. Hiding in the old forums:http://www.artemis.eochu.com/?page_id=28#/20130606/code-snippet-this-is-how-you-set-an-objects-l-2653921/ I hope this helps. Rusty
Arrew
Registered:1393602597 Posts: 2,750
Posted 1409128948
Reply with quote
#9
Haha... Spot on Captain Wise. Thanks Badgeguy, inspired maths there! I see what you were doing and made it into a 4 step process. Much better than what I was going to do, which would have needed 800,000 Events per ship <LOL>. Thanks for this.
leaola
Registered:1386628133 Posts: 268
Posted 1409148158
Reply with quote
#10
with that code u must reset it to 0 everytime u retrack right? u should be able to expand it be using if =< with the same numbers, but negative, to constantly track if u wanted to with min. steps right?
leaola
Registered:1386628133 Posts: 268
Posted 1409155274
Reply with quote
#11
would this work?
Attached Files
MISS_PeekABooTESTING.txt
(26.83 KB, 112 views)
LawsonThompson
Registered:1375038367 Posts: 827
Posted 1409198451
Reply with quote
#12
Oh, wait, binary search... I think with some clever use of dividing by 2 and multiplying by -1 we could trim the peek-a-boo test code down to 10 lines or less. Off to grind out some code!
__________________ ----https://LTEBridge.com
Arrew
Registered:1393602597 Posts: 2,750
Posted 1409205437
Reply with quote
#13
I got it down to 4 lines of code.