OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Gruntage on 26 Jul 2009, 23:34:40

Title: How do i do this.....
Post by: Gruntage on 26 Jul 2009, 23:34:40
Hey guys

Is it possible to count the number of kills the player has after a mission? and list them in 'titletext' format?  :scratch:

Regards,

Gruntage
Title: Re: How do i do this.....
Post by: bedges on 27 Jul 2009, 00:16:03
In the OFPEC spirit of pointing towards the answers without actually spelling them out (to promote learning), here's the pseudo-method:


That should be enough to activate your Sherlock Holmes mode ;)
Title: Re: How do i do this.....
Post by: Gruntage on 30 Jul 2009, 12:30:16
Hey guys

I cant seem to be able to total up the number of kills the player has at the end of a mission  ???

Code: [Select]
_victima = _this select 0
_teammate = _this select 1

?_teammate != player:exit

kills = kills + 1

hint format ["%1 kill(s)!", kills]

exit

This script is called from an eventhandler in the init field of every enemy soldier. When the player kills an enemy a hint comes up telling the player how many kills he has.

But I cant seem to have the number of kills display at the end of the mission.

Plz can some1 help me  :confused:

Thanx in advance

Gruntage
Title: Re: How do i do this.....
Post by: Walter_E_Kurtz on 31 Jul 2009, 01:56:35
Unless you are desperate for a paddling from bedges, you shouldn't open three threads for the same question. This thread can be merged with your original question (http://www.ofpec.com/forum/index.php?topic=33838.0) and your first solution (http://www.ofpec.com/forum/index.php?topic=33850.0).

Using the search term "kill counter" in the first place would have turned up Kendo's Casualty Reports (http://www.ofpec.com/forum/index.php?topic=32417.0).

To have the number displayed, edit the 'End' trigger for the mission. Give it a timeout of a couple of seconds, eg. 3,3,3 and enter something like the following in the Activation line
Code: [Select]
titletext [format ["%1 kills", west_casualties], "plain", 1]Replace west-casualties with whatever variable you are using for the counting.

As suggested by bedges, you could have found an example of this use of the format (http://www.ofpec.com/COMREF/index.php?action=details&id=141&game=All) command in the COMREF.
Title: Re: How do i do this..... (SOLVED)
Post by: Gruntage on 31 Jul 2009, 11:11:33
Thanx for the help guys  :D