OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Messiah on 11 Jul 2004, 22:40:53
-
1: Having a problem with the following script. Its meant to generate a random number between 0 and 1000... then below it checks what number it came up with and then goes to a certain part of the script according to that number. This causes random palcement of a crashed blackhawk....
unfortunatly its not very random... it favours site 5 ALOT and 1 as well... i've never really had 3 or 4 appear... any ideas?
;#Script by toadlife (toadlife@hotmail.com)
;#Modified to suit by Messiah (messiah@project-ukf.com)
_rnd = random 1000
?_rnd <= 200:goto "move1"
?_rnd <= 400:goto "move2"
?_rnd <= 600:goto "move3"
?_rnd <= 800:goto "move4"
goto "move5"
#move1
[] exec "scripts\move1.sqs"
hint "1"
goto "finish"
#move2
[] exec "scripts\move2.sqs"
hint "2"
goto "finish"
#move3
[] exec "scripts\move3.sqs"
hint "3"
#move4
[] exec "scripts\move4.sqs"
hint "4"
#move5
[] exec "scripts\move5.sqs"
hint "5"
#finish
exit
2:
when the guy finds the crashsite i want a hidden marker to appear at the site.... now, the chopper is called chopdown and i want the marker to move to the chopper, but the command reference only gives the co-ord method...
i've tried:
"marker" getmarkerpos "object"
marker getmarkerpos "object"
"marker" getmarkerpos object
marker getmarkerpos ["object"]
marker getmarkerpos [object]
anyone know how to move the damn marker? also, i'm trying to make an empty marker turn into a objective marker, but it errors saying 'no entry config.bin objective marker' or something... so i got the name wrong i guess.
cheers for any help :D
-
1. Just remember that there is a poor schmuck out there who wants a random number less than 1,000 but, because he is the unluckiest dude in the world, always gets 298.534 just by chance. He's going nuts.
Actually in my limited experience of random things in ofp they tend to be a bit "sticky": if you got 5 last time you are likely to get 5 this time too. Can only suggest a hint so that you can see the _rnd and therefore spot if it is a problem with the script or the generation of the random number.
2. Cut and paste from working script:-
"CSMmarker" setMarkerPos getPos (leader CSM);
"CSMmarker" SetMarkerType "Start"; "CSMmarker" setMarkerColor "ColorGreen"
-
cheers mac :D
-
Since macca allready answerd 2 I'll just do 1.
1) See the differance:
#move1
[] exec "scripts\move1.sqs"
hint "1"
goto "finish"
compared to
#move3
[] exec "scripts\move3.sqs"
hint "3"
There is no 'goto "finish"'. When 3 is launched, scripts 3, 4 and 5 will also be launched, thus causing the chopper to move to location 5 since it was the last launched script. The same error is in the #move4.
:beat: *Gets Shot* :beat:
-
christ... i looked over these scripts so many times, yet still missed that... such a muppet ::)
-
back again, and a new script has the same problems:
;#Script by Messiah (messiah@project-ukf.com)
~3
titlecut ["", "white out", 2]
~2
?(alive hostage_1) : hostage_1 setpos [7135.69,6018.92,0.53]
?(alive hostage_2) : hostage_2 setpos [7118.77,6019.04,0.05]
?(alive hostage_3) : hostage_3 setpos [7102.84,6019.35,0.16]
hostage_1 setcaptive false
hostage_2 setcaptive false
hostage_3 setcaptive false
titlecut ["", "white in", 2]
~3
[hostage_1, hostage_2] join group player
?(alive hostage_3) : [hostage_3] join group player
~2
player sidechat "Hello Zero, this is Alpha. We have the Marines. Requesting extraction.
Over."
~6
? evacsite1 : goto "evac1"
? evacsite2 : goto "evac2"
? evacsite3 : goto "evac3"
"evacmarker" SetMarkerType "Flag1"
"7" ObjStatus "ACTIVE"
#evac1
hq sidechat "Roger that Alpha. Extraction at Golf Delta Five Two, LS Echo. Out."
"evacmarker" setMarkerPos getPos (evac_1)
"lz5" setMarkerSize [100,100]
@ presentevac_1
player sidechat "Hello Zero, this is Alpha. Be advised we are at LS Echo. Waiting for
extraction. Over."
~6
hq sidechat "Roger that Alpha. Extraction is at LS Echo. Out."
chop5 domove (getpos evac_1)
exit
#evac2
hq sidechat "Roger that Alpha. Extraction at Golf Delta Four Six, LS Echo. Out."
"evacmarker" setMarkerPos getPos (evac_2)
"lz6" setMarkerSize [100,100]
@ presentevac_2
player sidechat "Hello Zero, this is Alpha. Be advised we are at LS Echo. Waiting for
extraction. Over."
~6
hq sidechat "Roger that Alpha. Extraction is at LS Echo. Out."
chop5 domove (getpos evac_2)
exit
#evac3
hq sidechat "Roger that Alpha. Extraction at Foxtrot Golf Four Three, LS Echo. Out."
"evacmarker" setMarkerPos getPos (evac_3)
"lz7" setMarkerSize [100,100]
@ presentevac_3
player sidechat "Hello Zero, this is Alpha. Be advised we are at LS Echo. Waiting for
extraction. Over."
~6
hq sidechat "Roger that Alpha. Extraction is at LS Echo. Out."
chop5 domove (getpos evac_3)
exit
basically everything happens correctly minus that evacmarker does not turn into a flag... and i can't work out why not - its the correct name, its the correct synthax (as discussed earlier) so why won't it move? aaargh, i hate ofp sometimes
-
anyone... mac? this is the last thing really holding up my mission :'(
-
Who, where and/or what is evac_1, etc.?
Are you sure the markertype is flag1 and not just flag?
-
You should move the lines
"evacmarker" SetMarkerType "Flag1"
"7" ObjStatus "ACTIVE"
before the lines
? evacsite1 : goto "evac1"
? evacsite2 : goto "evac2"
? evacsite3 : goto "evac3"
And according to all programming rules, you should have some failsafe if none of the evacsiteX variables are true....
Even if that is not possible... It's 'pro', you see... ;D ::)
-
You should move the lines
"evacmarker" SetMarkerType "Flag1"
"7" ObjStatus "ACTIVE"
before the lines
? evacsite1 : goto "evac1"
? evacsite2 : goto "evac2"
? evacsite3 : goto "evac3"
And according to all programming rules, you should have some failsafe if none of the evacsiteX variables are true....
Even if that is not possible... It's 'pro', you see... ;D ::)
you can't imagine how icnredibly silly i feel right now... lol :-[
as for failsafe - the 3 conditions it searched for are created by a random number generating script that is executed by the init.sqs - hence it can't fail ;)
i guess its true what they say, you always miss the obvious things - lol
cheers matey :)