Quote:
Originally Posted by Hitman
That sounds incredible
However, I don't get the concept completely....isn't the game supposed to have some preprogrammed commands (F.e. "Patrol x,y,z", "Go x,y,z", "Destroy unit X".....) for the available actions? I take it there must be a list of available actions/commands that can be called by the VB script, so they can be readed by the game :hmm: Where is that list? You posted before this:
Quote:
ApplyStateEngine $0,"PassByZigZag#Scharnhorst#2.081,56.309,500000, 1 #18"
|
so as I understand it those are some of the commands. Now, how many of those have you identified already?
I guess we would need to study this and make a list with all possible commands and their effect
BTW considering the size and style of the game creator, it could be worth it sending a mail asking for details/internal tutorials documents given to the mission scripters. Since they left the engine more or less "open" it is obvious that they wanted poeople to tinker with it
|
there are two ways to write missions file entrys...
the shorthand way using those commands i've already shown and others
and there are no limitations to these
because you can simply write your own commands
add them to the StateEngineTemplates.txt then use them in missions as per the stock commands..
and
the long hand way which is full code work.... you can write VB code directly into the mission file itself..
there is no list of long hand commands...there are no limitations at all...
it's some form of direct VISUAL BASIC code..it's as if you could turn each mission file into it's own dynamic game engine.....
i'll post a snippet below..it won't display correctly but it should illustrate the point to any-one familiar with VB code
label [pstart]
gametime [lasttime]
if
!setcondition [morsetime]
then
sub [timediff],[lasttime],[startime]
if
greater [timediff], 20
SetCondition [u2freund]
then
SimSendMorseMessage [u2],[u2freund],"Gute Jagd."
Setint [morsetime] ,$1
endif
endif
this is straight out of a stock mission file....
it uses
DIMS
INTS
FLOATS
labels
ands#
ifs#
elses#
endifs#
all the usual suspects..
lol your gonna have to check it out yourself to begin to see the possibilities..i can't explain it here..you wouldn't believe me lol
but for a thought to start with..it's as if you could take all the code from say ..rossbachs campaign generator and place it into an SOF mission file....there by rendering each single mission in SOF it's own little campaign engine....
or let m put it another way....each individual mission file in SOF could contain the equivilent code from the entirety of KRIEGSTANZ DEVELOPER..and be equaly as fluent and dynamic and complex..gawd knows what you can do with it.. Floater would know what i'm talking about here...
here's another snippet..again the forum software isn't set up to show VB code correctly so it's all bent out of shape..but what can you do?
this is my attempt to code the morselamp message so it happens when i reach the AI sub..not when i'm miles away..
EveryFrame
if
CheckGoal $0
then
setint [morse] ,$0
endif
permanent
label [pstart]
if
!setcondition [morse]
then
if
CheckGoal $0
then
SimSendMorseMessage [u2],[mysim],"Go to Target Area, 10.446, 54.667"
Setint [morse] ,$1
endif
endif
goto [pstart]
there is a MUCH better way to do this..i'm crap at VB code..but i am learning...and what a great way to learn...writing missions for a game you enjoy..can't think of a better way to learn!
but it's VB code...you can do anything with it..
i love this little example from a stocker..
EveryFrame
CompleteOnGoal "Schulungsmission beendet.",$4
if
CheckGoal $1
then
SimSetSpeed [ship1],$a
endif
Endphase
this code changes the speed of one specified vessel when you reach the patrol zone..or complete objective 1 in the missions paremeters....in the stock mission it is used to start a ship moving out of port and into the minefield you have just layed
(objective 1 was to lay the mine field)
LOL cute as hell..a tiny single event..but it's one of those small details that explode into a world of possibilities when used in a mission file ..and it's truly dynamic..not just random- jury rigged or "bluffed" ...but actualy DYNAMIC
i could use this code to have that AI Uboot that is pateintly waiting at my patrol zone to morselamp me my patrol orders..
move off on it's own patrol once it has sent the morse message...lol...so no detail needs to be left out or "bluffed" you can do the whole trip..the whole nine yards
you could write late war hydrophone sensors into the missions files for the DD's
by directly controling the AI behaviuor and response to the player via VB code work in the mission file
and all the above is just tinkering..messing about ...not serious code at all...(with the exception of course of the KD reference!)
i've been practicing on the morselamp code...
and have managed to set it up so the morselamps message is transmitted when the player gets within close range of the AI sub sending the message..and just the once (whew..was struggling with that issue!).this is by far the better way to do this..
tho here i see the morselamp blik out the message..but strangley it doesn't get translated into the task bar...this may be a matter of range or something..code work isn't terribly forgiving of minor ommissions i'm afraid..but once the penny drops it is pretty logical
best i can do for the forum post is to show a picture of the mission file...so folks can see the code
it's obviuos why i believe this to be some form of Visual Basic code and not specific to the SOF game engine but in fact proper developer code usedby visual basic programs everywhere..which is why the missions in SOF have unlimited capacity
what this boils down to is this...the mission files use code work that is more commonly only found in full scale game creation software...think about that for minute and you can see where it explodes into a new universe for mission writing..and might in fact be completely unique..in a sense each mission file can become a new game in it's own right ..a game which you play via the SOF interface etc !lol
for something to do let me try to walk thru the above code as best i can and with my current level of know how anyhuw..
first you tell the game what names you are going to use for the objects functions etc
label pstart
id mysim
id u2
int morsetime
then you tell the game that the code starts here
phase init
then you give it general information about the game world
SetDescriptionMapTexture "ordermap_nordsee.jpg"
SetTimeLimit $0
StartTime 22.0,0.0
StartDate 1914,5,5
ChangeGeoPivot 10.312,54.554
Weather "sunrise"
EnableTutorial
SetTutorialString "test mission."
then you start adding the game objects
CreateServerSimulationObject [u2],"u35"
SimSetName [u2],"U-66"
SetPositionGeo [u2],10.446,54.667,0
SimSetStartSpeed [u2],0
CreateSimulationObject [mysim],"u35"
SetPositionGeo [mysim],10.312,54.554,0
BindToController [mysim]
notice how the names of the two Objects are the same as the names declared in the first section
ie [u2] and [mysim] mysim is the player uboot ...u2 is the AI uboot...u35 is the actual vessel model file details used etc
SetPositionGeo is lat long position
then you tell the game what objectives the player has to achieve
DefineMissionGoal $0,"StayArea", 10.446, 54.667, 700, $1
SetMissionGoalText $0,"Go to Target Area 1",$1,"Target Area 1"
DefineMissionGoal $1,"StayArea", 10.557, 54.538, 5000, $1
SetMissionGoalText $1,"Go To Target Area 2",$1,"Target Area 2"
DefineMissionGoal $2,"StayArea", 10.266, 54.485, 5000, $1,$3
SetMissionGoalText $2,"Go To Home Port",$1,"Home Port"
then you set the mission events code up
EveryFrame
permanent
setint [morsetime] ,$0
SimGetfreund [mysim],[u2],$e1
setint[morsetime] tells the game you want to set this number to zero (it then remembers the number)
SimGetFreund i think IS unique to the SOF engine..here it sets a range between mysim (the player)...and [u2] (the AI boot..)
$e1 is a number to represent the desired range at which range "something" happens..
it tells the game to check the two game objects for their distance apart from each other and instigate some code it they should get within the set range..
the you tell it what code you want to run repeatedly thru the mission to beactivated on certain conditions
this code is bracketed by the LABEL [pstart] again mentioned at the beginning of the mission file
label [pstart]
if
!setcondition [morsetime]
then
if
SetCondition [mysim]
then
SimSendMorseMessage [u2],[mysim],"Go to Target Area, 10.446, 54.667"
Setint [morsetime] ,$1
endif
endif
goto [pstart]
then it "asks" questions
if
!setcondition [morsetime]
then
setcondition [morsetime] i THINK is telling the game to check that number you just asked it to remember
here
setint [morsetime] ,$0
and if that number is still "zero"
do the following things
if
SetCondition [mysim]
then
SimSendMorseMessage [u2],[mysim],"Go to Target Area, 10.446, 54.667"
Setint [morsetime] ,$1
endif
and here again i'm slightly out of my depth but..
setCondition[mysim] asks the game to check wether the player vessel (called [mysim] is in the game and wether it is within range of the ai uboot
if it is the do this
SimSendMorseMessage [u2],[mysim],"Go to Target Area, 10.446, 54.667"
this sends the morselamp message from [u2] (ai uboot) to [mysim] (player uboot)
then to prevent the whole thing from edlessly repeating itchanges that number you asked it to remember..
Setint [morsetime] ,$1 this number is now "one" instead of "zero" and it remembers that number
it then tells the game to keep doing this to ensure the code is active right thru out the mission..
goto [pstart]
it then tells the game that when the player has completed the final objective (return to base)
end the mission
CompleteOnGoal "Tutorial Mission ended.",$4
and fiinaly it says that's the end of the code
Endphase
end
best i can do at the moment...if i have got anything wrong please speak up!!
i could do with the info!