OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Colossos on 01 Jul 2005, 14:37:36
-
We all know how Mikero tests our missions: screw the team , I'll do it myself and than he runs of on his own trying to discover bugs. (No offense Mikero, on the contrary.)
Well, couldnt we all use a script that gives a warning when the player goes too far away from his leader. If he doesnt return in time to formation, the game ends with a cutscene where Mikero gets courtmartialled.
- How do you get the distance between player and leader?
- Can someone pls write such a little script?
Thx,
-
Not to hard, just use one of the distance functions in the editors depot. Set it on a loop every ten seconds and your done.
Like using snYpirs 2D distance function.
#loop
_dis = [getpos leadersname, getpos player] call distancePos
?_dis > 30: goto "end"
~10
goto "loop"
#end
insert cutscene here
This is not tested of course.
Blip :joystick:
-
i just create triggers wich will set the players dammage to 1 so he dies and also make an abident sound of an ak so it apears hes been shot and just do that when the player is present and set several all around the mission area
-
lol 456 , thats also a way to do it :)
blip thx for the replie, i will try it and let you know if it works
-
alternatively, sidestepping the function idea, call the following script -
;stick like glue
dist_warn = false
#loop
? (player distance lead_unit_name >= 100) and (not (dist_warn)): goto "warning"
? (player distance lead_unit_name >= 150) and dist_warn: goto "court_martial"
~0.5
goto "loop"
#warning
player sidechat format ["Hey %1! Get your ass back here or there'll be trouble!",name player]
dist_warn = true
goto "loop"
#court_martial
;all the great stuff in here
exit
just to clarify what it does -
it sets a variable to say whether or not the player has been warned. if the player hasn't been warned and gets over 100 meters away, a warning is issued, and the warning variable is set to true. this ensures that the warning doesn't repeat over and over.
if the player then gets over 150 meters away, the court martial begins.
untested, but i think that should do it.
-
Thx Bedges, that will teach Mikero !! I'll make a courtmartial so tough that he'll be afraid to leave his team ever again. (maybe a LAW rocket right up his *ss)
-
a bit late, but this is easier
just put a trigger with the distance he is allowed to go from the leader, group it to the player and set it to not present. then run a setpos loop for the trigger (you have to name the trigger)
#loop
trigger1 setpos getpos ((group player) select 0)
~2
goto "loop"
and the on activation line would read:
player setdammage 1
you can also add your sound in there if you want
the ((group player) select 0) just insures that if the leader dies it will follow the new leader
-
Or even easier ;)
Put up one trigger, 0/0 size
Condition: player distance leader player > the distance you want
On Act.: player setDamage 1
-
@Collososs
you may, in time, come to regret this patch of yours. Defeating me, is one thing. Child's play. I may pass you up to higher command, General MacGuba. Now *he* does dreadfull things like shoot his own team members to check if author's *really* know their stuff.
I shall shuffle off now under my rock, having put the fear of Mac into you.
-
The longer this thread stays, the easier the "scripts" get :). But I'll use Bedges his because I like the syntax.
@Mikero
Don't misunderstand me! I like the way you test missions and I hope you'll keep it up.
Hmmm, sounds like I'm not ready yet to face MacGuba's fury.
This thread is solved, thx all!