View Single Post
Old 09-25-07, 08:08 PM   #139
Deamon
Commodore
 
Join Date: Apr 2002
Location: Germany
Posts: 642
Downloads: 5
Uploads: 0


Default

Quote:
Originally Posted by CB..
without any doubt at all the scripting can support this sort of stuff...
It would be surprising if it wouldn't since this is the most basic function you can have in a 3D environment. In the engine i use it would be as easy as:

Vector3 ship_position = player_ship_node->getPosition();

If it can be done in SOF scripting too then it must be in a simular way. Ever encountered the term vector in the files ?

I actually have no VB experience whatsoever. I don't know how similar it is to C++. But i guess similar. I have to check my library.

Quote:
this is what turned me on to the uniqueness of the game..normally they take the code and water it down to the bare essentails and then you gets your add -on mission editors etc etc ..but with this game it's all done with sheer raw unadultered code....with very few exceptions ..there are some game specific commands etc..
Yeah, they hit the deadline and had no time anymore to water it down, i guess

Quote:
so that means more or less that if you can code it... the game will run it...almost without restriction...i'm betting you could code a pop up on screen calculator directly into mission script and it would work...haven't tried this but it gives you some idea of what i'm expecting to a greater or lesser degree from the game...
Lol, lets wait and see what it can actually do. Although i understand your excitement.

Quote:
heres the code for the brit sub spawning within torp range here set to occur after a set timer has expired

if
Alive [mysim]
then
GameTime [gt]
ifall
sameint [processed],$0
greater [gt],20
then
CreateServerSimulationObject [u2],"E34"
SimSetName [u2],"E-class"
SimSetPosition [u2],-200,200,200
SimSetStartSpeed [u2],15
AddStateEngine [u2]
AddStateItem [u2],"s:2"
AddStateItem [u2],"a:1,Course:10,20"
AddStateItem [u2],"a:1,Ramm:"
AddStateItem [u2],"a:1,FireAtWill:"
AddStateItem [u2],"c:0,1,EnemyVisible:5000"
AddStateItem [u2],"c:1,0,-EnemyVisible:8000"
setint [processed],$1
endif
endif
Have you figured out already what each of the elements in each statement means ?

What exactly do mysim and sameint stands for ??

What means the a's, the s and c's in the AddStateItem commands ?

Quote:
now the thing is that the location for the spawn

SimSetPosition [u2],-200,200,200

is relative to a setting allocated here

ChangeGeoPivot 10.312,54.554

so it's -200,200,200 form that point (which is lat long)
You told above that you made a surprise attack script that works only at the beginning of a mission. Where the sub attacked 20 minutes after starting the game. But the sub appears then relative to the sub position or relative to ChangeGeoPivot ?

So essentially ChangeGeoPivot is for setting the start location of the mission.

Quote:
in one of the stock single missions (a test mission )

it shows this code

id mysim
int pl
float npos
phase init

ChangeGeoPivot 7,56
CreateSimulationObject [mysim],"u35"
ExtractPlayerID [pl],[mysim]
mul [npos] , [pl] , 100
#SimSetPosition [mysim],[npos],-10,0
SimSetPosition [mysim],-200,-0,100
SimSetDirection [mysim],0,0,0
SimSetStartSpeed [mysim],5
BindToController [mysim]
EveryFrame

endphase
end


where iot appears to my eyes to be storing the player subs location in a float
You cannot store the position in a float value because float is only one value and for the position you need 3 values. So you would need 3 floats to store all coordinates.

In this context the statements appear to my mystery frankly.

Quote:
[npos] i think here and referenceing it as a possible method of then setting the sub into the sim world at that location again in some form of respawn event..

SimSetPosition [mysim],[npos],-10,0
If we would only knew what the mul statement is for.

And why do the

#SimSetPosition [mysim],[npos],-10,0

gives only 2 values to describe the position ? It also appears to me commented out. It is probably an incomplete statement or something. Could be a function that was never completed.

Usually when there is an But this would be quite an awekward way to get the player sub position. SimSetPosition then there should be also a SimGetPosition (if the devs were any sane). And should work maybe something like:

float x
float y
float z

SimGetPosition [mysim], x, y, z

I mean as a trial an error, you can try this code snipped out. Good luck

I am wondering though whether mysim would be the right way to reffer to the players boat.

if
Alive [mysim]

kinda suggest this. But i don't know. Try it out

Quote:
i have absolutely no doubt this is perfectly acceptable to the game engine
Don't be too sure about it. Game engines have sometimes blatant flaws, making you wonder what was going on the heads of the devs.

The question is do the engine needs this function at all ? Actually yes, how else are vehicles supposed to be spawned relative to the players position. Well that is what you should look for. There must be some script lines that do this somewhere. But this could be a hardcoded part. Since it doesn't make sense to let appear an enemy unit magically right next to you, despite far viewing range.

So i am wondering why the devs would want to make it possible to set this via script, since all units appear on the boarder of the visual range. This makes this function in scripts superfluous. So hypothetical this function isn't needed in the scrpts and thus is possible not available.

If the SimGetPosition do not work then it is possible not available, since getPosition and setPosition are the most common functions in all engines.

Quote:
tho with my very basic coding skills and the limited number of stock code examples available i haven't ferreted out the correct scripting method as yet..and i hate trail and erroring code work as it is genuinely hugely irritating and demanding ..dot in wrong place won't work stuff (as you know)
The total lack of comments in the scripts that explain what a codeline actually do is what scared me away to even try it. Because to figure out all of this stuff on your own would be a pain in the a$$

And so many files in SOF are so damn cryptical. They must have been in serious hurry.

Well i will take a look at it again. But i don't want to make any promesses.

Quote:
the issue with hydrophones and the lack of danger is related to the fact that as soon as you dive you become undetectable to the DD's (with scope down etc)..so even if they have seen you and start dropping their DC's you are going to have to walk into the DC's your self as by the time they reach your last known location you are of course gone..

now then this is reason two why i want to hold and store the players location in a float or integrer or some dang thing.lol
For stuff like hydrophones you need to be able to read out not only the position but also things like speed of the boat and maybe also other things like sea state. You need to be able to compute the distance to the sub in order to retrieve the signal to noise ration. Is calculating possible at all in the scripts ? Are statements like a = 2 + 2 possible at all ?

Quote:
the only possible issue i can see right now is that i have not as yet found a direct command to order the DD to drop dcs..and that not all the other stuff would be the problem...the dd can be told to go to the players location under a set of dynamic conditons...simulating the detection with hydrophones...but can it be prompted to attack something which it cannot "see"
there might be the limitation..as this would be a game specific command ..not raw VB code
That is my point. There need an assesment to be done first about what you can actually do with scripts and what not. Don't get too hiped to fast. Check it out first.
Deamon is offline   Reply With Quote