OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Commando on 08 Mar 2005, 18:53:57
-
Hi all i wonder how do i do if i want to have a scoring system for players that gives them a point after every penguin they drive over? ;D
-
well, first of all i'm reporting you to the Penguin Protection Squad.
secondly, i would suggest doing it thus:
use getin and getout event handlers on whichever vehicles are likely to be used for this appalling escapade. set a global variable called in_vehicle. set this variable to true on getin, false on getout.
secondly, create a script which loops around all the poor defenceless little penguins and checks both if the distance between player and penguin is less than... ooh 2 metres would do it, and also that in_vehicle is true.
if both of those are the case for any of the picked-upon penguins, then call some other script which deals with the demise of these innocent and cuddly animals, and then adds a paltry and wholly undeserved point to the player, with a player addrating 1 command.
i'm telling the polar bears on you.... :P
-
Does penguinman know about this??
Planck
-
i'm telling the polar bears on you....
But Polar Bears have never seen a penguin
-
all the more reason why they should be told, don't you think?
-
Lol
-
Pah! What a pathetic mission! Any fool can drive over a penguin.... Now if it was driving over polar bears, then I'd be impressed. ;D ;D ;D
bedges' answer sounds about right.
PS - if you were to introduce a polar bear to a penguin, I've got 50p that says the polar bear eats him before you can say "chocolate biscuit".
-
;D thx for all the happy replies, is there any easier way? becaus ei don't know squat about writing a script from scratch :-[
haha lol my non ofp playing friend wants me to do a race mission in gta style where you drive over penguins and the race track is all walled in ::)
i said to him i will give it a go but this seems more difficult than putting togheter a coop :P
-
create a group of penguins. in the init line of the lead penguin put
penguins = group this
create a vehicle and call it car_name.
open up notepad and copy/paste the following:
;check penguins
stop_checking = false
#start
_units = units penguins
_imax = count _units
_i = 0
#loop
?(_units select _i) distance player <4:[_units select _i] exec "splat.sqs"
_i=_i+1
?not (_i >= _imax):goto "loop"
~1
?not (stop_checking):goto "start"
exit
save that as "check_penguins.sqs"
open up a fresh notepad and copy/paste the following:
;splat
_whosplat = _this select 0
_whosplat switchmove "FXDismay"
_whosplat setdamage 1
_b="shell" camcreate getpos _whosplat
[_whosplat] join grpnull
player addrating 1
hint "Be kind to all animals, virtual or otherwise"
exit
save that as "splat.sqs"
in the init.sqs file, copy and paste the following:
car_name AddEventHandler ["getin",{[] exec "check_penguins.sqs"}]
car_name AddEventHandler ["getout",{stop_checking = true}]
save and preview.
-
thx for the script! I tried writing car_car1 but it didn't work but then it worked when i had car_name as you had written it ;D ( i thought that the _name could be any name i could think of because it was in italics ;D )
very nice script great thx :) i think the thread is solved now 8)
btw liked the little explosion effect that came with it too , that was more than i wanted to have but hey it was very cool :D