View Single Post
Old 09-14-07, 11:11 AM   #114
CB..
Ace of the Deep
 
Join Date: Apr 2002
Location: UK
Posts: 1,278
Downloads: 0
Uploads: 0
finaly foot gets in the door..

here we go...the fundamental item ONE in any one's mission writing experiments for SOF

the RANDOMISATION function...

took me a while to find it but here it is..no issues here it works fine..

irandom [num],$1,$2
if
sameint [num],$1
then
DefineMissionGoal $0,"StayArea", 10.446, 54.667, 5000, $1
SetMissionGoalText $0,"Go to Target Area 1",$1,"Target Area 1"
else
DefineMissionGoal $0,"StayArea", 10.446, 58.667, 15000, $1
SetMissionGoalText $0,"Go to Target Area 1",$1,"Target Area 1"
endif


the above code randomises which of the two shown objectives the player needs to achieve......

you need to tell the game your going to do this by adding this under the
ID top section of the mission file

int num

you going to use a stored number which you have named "NUM"

that's it......

if it works as with other code randomisation functions there should be no top limit to the number of options possible..ie you could set it to randomly choose between 20 objectives not just two...

depends on how this

irandom [num],$1,$2

actually works...does it need to be written as

irandom [num],$1,$20

to randomly select a number between 1 and 20

or does it need to be written like this..

irandom [num],$1,$2,$3,$4,$5,$6,$7 etc etc etc

anyway

hell of a way to explode the possibilites for SOF missions...

no need for an external mission generator you CAN get each mission file to do the job as it loads automaticaly....very good stuff..can randomise the traderoutes...destroyer and aircraft locations.radio messages (those morse lamp messages if i ever sort the code out properly) weather sea state ambient lighting..time of day....and so on!

whew got my foot in the door...but this one is the lever that moves the world as it were game wise..

experienced mission writers here should recognise the key strengths this shows the campaign engine has hidden under it's belt
i assure you this is nought but a cheap trick compared to what it CAN actualy do...but as tricks go this is the one that virtualy ever other subsim rely upon for theirs so called dynamic campaign engine..in fact..most other game engines can't do anything ELSE but randomise..it's the only trick they have.....SOF has half a million others at it's disposal..

update........

ok been trying to get to grips with the randomisation code//
i was unable to increase the number of random choices above two with the above code but found another method abiet less "nicey" but functional
this method allows unlimited randomisation


int num
irandom [num],$1,$3
if
sameint [num],$1
then
DefineMissionGoal $0,"StayArea", 10.446, 54.667, 5000, $1
SetMissionGoalText $0,"Go to Target Area 1",$1,"Target Area 1"
endif
if
sameint [num],$2
then
DefineMissionGoal $0,"StayArea", 10.446, 58.667, 15000, $1
SetMissionGoalText $0,"Go to Target Area 1",$1,"Target Area 1"
endif
if
sameint [num],$3
then
DefineMissionGoal $0,"StayArea", 10.446, 56.667, 15000, $1
SetMissionGoalText $0,"Go to Target Area 1",$1,"Target Area 1"
endif



////

the

irandom [num],$1,$3

does refer to minimum and maximum number to choose randomly from...1-3 inclusive....could be 1-3 thousand if you can be arsed to write all the possible choices below..lol

then it just choses from the list which objective to load for the player
if the number it randomly chooses is 1 (sameint [num],$1)
then it loads the objective listed under

if
sameint [num],$1
then
DefineMissionGoal $0,"StayArea", 10.446, 54.667, 5000, $1
SetMissionGoalText $0,"Go to Target Area 1",$1,"Target Area 1"
endif

if it randomly chooses the number 2 then

if
sameint [num],$2
then
DefineMissionGoal $0,"StayArea", 10.446, 58.667, 15000, $1
SetMissionGoalText $0,"Go to Target Area 1",$1,"Target Area 1"
endif

and so on...

pouring information into a vacuum ...what the heck it's a subsim this is a subsim forum ...strange days indeed when a subsim such as this arouses such little genuine enthusiasm...me i just LOVE those world war one ship models... every time i see one thru the binocs or thru the periscope i remember why this game is so special...and ironicaly the the very reason why it is so neglected by the harcore realism brigade,,is because it is too realistic..it doesn't go out of it's way to make you feel like the "hero"....there's not a huge amount of immediate danger from the enemy...unless you are careless..hard-core realism just not the ego flattering kind..
and that's sadly..all too often..what the "hardcore" realism stuff is usually all about..i'm know the info will be usefull to those who genuinely like the game..


on the modeling front i do have a british E class sub finished ...which runs well in the game...but am holding back because i am trying to write a specific AI set of instructions for it..a "surprise attack" if you will....surfacing at close range and attacking with both torpedoes and deck gun instantly...the stock commands have it appearing too far away and it is easy meat for your deck gun crew..it's own deck gun crew being woefully innacurate for some reason i have yet to fathom
__________________
the world's tinyiest sh3 supermod-
and other SH3/SH2 stuff

http://www.ebort2.co.uk/


The best lack all conviction, while the worst
Are full of passionate intensity.

W.B.Yeats

Last edited by CB..; 09-14-07 at 03:30 PM.
CB.. is offline   Reply With Quote