Home   Help Search Login Register  

Author Topic: need a Script!  (Read 1177 times)

0 Members and 1 Guest are viewing this topic.

Offline Flauta

  • Members
  • *
  • There is no knownledge, that is no power
    • Chek mi FLog
need a Script!
« on: 13 Jan 2005, 06:45:59 »
hi there! I need a scrpit that checs how many kills you'r doing when the script is running... maybe using the kill eventhandler??? does anyone knows how to make it? srry im noob on this...
 What I need is to put an Global Value whit the kills in the period of the Scrpit is running... and change it to 0 when ends...

I think it could be done...

Thanks Anyway
« Last Edit: 13 Jan 2005, 06:47:38 by Flauta »

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:need a Script!
« Reply #1 on: 13 Jan 2005, 17:53:28 »
I've tried too do this myself however had no such luck.

I could not figure out anyway to check WHO killed the person or if the person killed himself.

I think it can be done as well because the game keeps score it self on multi-player, I just cant figure out how.

So, if you get a script, I'd like to see it too.
I like your approach, lets see your departure.
Download the New Flashlight Script!

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Plenty of reviewed ArmA missions for you to play

Offline Flauta

  • Members
  • *
  • There is no knownledge, that is no power
    • Chek mi FLog
Re:need a Script!
« Reply #3 on: 13 Jan 2005, 23:37:43 »
maybe using this...?

group1 AddEventHandler ["killed", {Kills = kills+1}]

something like that... right sorry no idea...
I will read the Eventhandler tute tonight...

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:need a Script!
« Reply #4 on: 14 Jan 2005, 00:05:35 »
put a trigger that covers the map that selects the side that you want to have kills counted for.   Set condition = true
Call it trigAllWest (say)

Shortly after the start of the mission run a script that has the following code

Code: [Select]
Kills  = 0
_vehListW = list trigAllWest
_i = 0
#loopWest
_veh = _vehListW select _i
{_x AddEventHandler [{killed}, {kills = kills + 1}]} forEach (crew _veh)
i = _i + 1
if (_i < count _vehListW) then {goto"loopWest"}
exit
I have not tested this but it, or something close, should do what you want.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:need a Script!
« Reply #5 on: 14 Jan 2005, 00:12:13 »
this can also do what you want, but THobsons solution will work better if you want to keep track of the kills of more than one unit.  But THobsons doesn't look like it will do what you want... you would have to change it a little
{_x addeventhandler ["fired",{?_this select 1 = player(or the name of the person you want to keep track of):kills = kills + 1}]} foreach

basically mine only adds to the kill count if it is a certain person who kills them, whereas THobson's will add to it for every kill
« Last Edit: 14 Jan 2005, 00:15:40 by Triggerhappy »

Offline Flauta

  • Members
  • *
  • There is no knownledge, that is no power
    • Chek mi FLog
Re:need a Script!
« Reply #6 on: 14 Jan 2005, 02:18:44 »
But it tells your total kills... what im tryng to do, its to reduce the time (timeAcc) when you kill somebody, but u Disbalde it whit an action... Like Max Payne! I have Read the EventHandler tute... but I still Asking how you can make thoes Scripts! they'r Basic Chinise for me...

Maybe This will work?Using MaxPayne.sqs Script for example (no time to test it)

Kills  = 0
_vehListW = list trigAllWest
_i = 0
? (accTime != 1): goto "coolDown"
Hint "Payn! Storming Your Barin! U feel everything goes slower"
setAccTime 0.9
#loopWest
_veh = _vehListW select _i
{_x addeventhandler ["fired",{?_this select 1 = Player):kills = kills + 1}]} foreach
(crew _veh)
i = _i + 1
TimeAcc (0.9 - i)
if (_i < count _vehListW) : {goto"loopWest"}
exit
#coolDown
hint "Your Brain Suddenly stops, you feel normal"
setAccTime 1

#ByeBye
« Last Edit: 14 Jan 2005, 02:22:04 by Flauta »

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:need a Script!
« Reply #7 on: 14 Jan 2005, 04:28:33 »
wow, to that i'm afraid  all i can say is...NO

here:
make a trigger covering the map
activated by your enemies present
on activation:nomore = false; {_x addeventhandler ["killed",{[_this select 1,player(or name of unit)] exec "MaxPayne.sqs"}]}; player(same one as in EH) addaction ["Don't slo-mo no more!!! AAAHHHH!!!!!","nomoreLSDforyou.sqs"]

MaxPayne.sqs
--------------------------
_killer = _this select 0
_unit = _this select 1

?nomore:exit
?(!_killer == _unit):exit
;obviously change the hints to what you want
hint "What a rush! LSD is slowing everyone down....."
_acc = .99
#loop-de-doo
?_acc <= 0:goto "coolit"
setAccTime _acc
_acc = _acc - .01
~.03
goto "loop-de-doo"

#coolit
~.5
_acc = .01
#loop-de-loop
?_acc >= 1:hint "All over, you gotta kill again to move slow some more";exit
setAccTime _acc
_acc = _acc + .01
~.015
goto "loop-de-loop"
-------------------------------------------


nomoreLSDforyou.sqs
-----------------------------------------
_unit = _this select 0
_action = _this select 2

removeaction _action
_unit addaction ["Gimme doze pills man! I wanna move slow!","LSDforme.sqs"]
nomore = true
exit
-------------------------------------------


LSDforme.sqs
---------------------------------------------
_unit = _this select 0
_action = _this select 2

removeaction _action
_unit addaction ["Don't slo-mo no more!!! AAAAHHHH!!!!!","nomoreLSDforyou.sqs"]
nomore = false
exit
-----------------------------------------------


that should do it. save each of these(except the trigger (duh)) as the script i called them (else you'll have to go back and change them in each script where i added the actions) and fix up the hint as you want them

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:need a Script!
« Reply #8 on: 14 Jan 2005, 13:59:53 »
You are right, I was only counting the number killed on one side and not taking account of who did the killing.

Bye the way should it be:

{_x addeventhandler ["killed",{[_this select 1,player(or name of unit)] exec "MaxPayne.sqs"}]} forEach (crew thislist) ;

or something?
« Last Edit: 14 Jan 2005, 14:05:44 by THobson »

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:need a Script!
« Reply #9 on: 14 Jan 2005, 14:11:54 »
To answer my own quesion.  No.  I think it might not work.

What should work though is:

{_x addeventhandler ["killed",{[_this select 1,player(or name of unit)] exec "MaxPayne.sqs"}]} forEach thislist ;

BUT:  It would not put an EH on units that are inside vehicles, only on the vehicle themselves.

That is why I used a script that cycled through the units listed by the trigger and applied the EH to all crew of each vehicle.  That way each living being gets an EH, even if they are inside a vehicle.

I have not tried nesting forEach.  I just presumed that something like:

{{_x addeventhandler ["killed",{[_this select 1,player(or name of unit)] exec "MaxPayne.sqs"}]} forEach (crew _x) } forEach thislist ;

would not work.  

Anyway it would be hard to read and de-bug.

« Last Edit: 14 Jan 2005, 14:47:58 by THobson »

Offline Flauta

  • Members
  • *
  • There is no knownledge, that is no power
    • Chek mi FLog
Re:need a Script!
« Reply #10 on: 14 Jan 2005, 18:25:06 »
Nice Work To all!! Im going out to Hollydays 1 Week.. so maybe I Won't test it...

Thanks a Lot for Helping! and 1 Question more... there is a maybe a Game Bug? 'cause im inside a Vehicle, (I only tested whit an AH-64) the command "Skiptime" Dosn't Work! I called it from an Older "maxPayne.sqs" script, whit the addaction command on me...(the player)

Any Idea? Shoul I Call Another Scrpit whit the Skiptime from "MaxPayne.sqs"?

See ya soon!!

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:need a Script!
« Reply #11 on: 14 Jan 2005, 22:17:50 »
I have never had a problem with skiptime.  You are aware that it does not accelerate time it just resets the time to a new value?

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:need a Script!
« Reply #12 on: 14 Jan 2005, 22:22:26 »
hmm.. in my quick writing of it I missed the foreach

THobson, your last EH will be the best one to use....how funny that you think it won't work  :D

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:need a Script!
« Reply #13 on: 14 Jan 2005, 22:37:55 »
Well how about that.  I just tested it and it works.  I thought the OFP engine might get mixed up about which _x went with which forEach, but it doesn't

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:need a Script!
« Reply #14 on: 15 Jan 2005, 01:18:02 »
its cause of the brackets, the way foreach works is it executes the code inside the string you pass on each element of the array

so it is adding a foreach command to each element inside the main array