Jump to content
Sign in to follow this  
Dorian Gray

returning several variables for death message script and converting UT2004 code

Recommended Posts

First of all it's 6 AM and I haven't been to bed yet, but I'll try to be clear.

Trying to make a custom death message script with the killed EH. Testing it in a placed unit for now. I know some of what I need to do, and would like to to do. Starting with the need, naturally:

this addEventHandler ["killed", "hint format['%1 was killed by %2 with a %3',this name,player name,current weapon player]"]

That's only theoretical code; I already know that some of that code works, some of it probably doesn't, and that example isn't the right syntax (I have been having horrible problems figuring out advanced BIS syntax, even with research), because I get errors. I can't remember for sure, but I think that the editor lets me place that code in the unit without a problem, but I get errors with it in game since I have -showscripterrors on. I think I remember something about "missing ]" I also bet that using "player name" and "current weapon player" isn't going to be accurate. currentweapon player also only gives the class name. I saw in another thread a method for adding paa files to hints, and it'd be great to do that in a death message. I know that DoD: Source and other games have "player1 (insert weapon picture here, like a machinegun) player2" instead of "player1 was killed by player2's machinegun". I know it's possible to use parsed formatted hints to getText for object display names and pictures. I'll ask again (asked the first time in another thread I started) if a script or addon already exists (made by someone who is actually advanced, so that I can give up) for what I want to do, and if it is in fact possible to return who killed what player along with the gun and picture in a hint.

On to the UT2004 code:

Multi Kills

Special event awarded to the player for killing other players in a certain time frame. Every time a player scores a kill he has up to 3 seconds to make another kill. So 2 kills in 3 seconds gets you a Double Kill, 3 kills within 3 seconds apart from another a Multi Kill and so on:

- Double Kill = 2 kills

- Multi Kill = 3 kills

- Mega Kill = 4 kills

- Ultra Kill = 5 kills

- Monster Kill = 6 kills

- ...

Killing Sprees

Special event: If you manage to kill 5 or more opponents without dying yourself, you will be on a killing spree. If you kill more than 10 opponents, you are on a rampage, etc.:

- Killing Spree! 5 kills

- Rampage! 10 kills

- Dominating! 15 kills

- Unstoppable! 20 kills

- God Like! 25 kills

- ...

I already know how to get sounds into the game no problem, but I don't entirely know yet how I would implement that with code.

Anyway /end ramble and taking a break to enjoy some Just Cause 2.

Share this post


Link to post
Share on other sites

i can see it have been a long night :)

this addEventHandler ["killed", "hint format['%1 was killed by %2 with a %3',_this select 0,_this select 1,currentWeapon (_this select 1)]"]

tested and working. look at it with a clear head and compare to the nights example.

victim is _this select 0, killer is select 1

http://community.bistudio.com/wiki/ArmA_2:_Event_Handlers#Killed

Killed Event Handler

Triggered when the unit is killed.

Passed array: [unit, killer]

* unit: Object - Object the event handler is assigned to

* killer: Object - Object that killed the unit

Contains the unit itself in case of collisions.

Share this post


Link to post
Share on other sites

Thanks for the correction. I had studied event handlers (without fully understanding them), so I have seen the "killed" one's description. It wasn't enough to just see the description though, as I'm a beginner :) Coding will never be my forte (I'm a guitar player for about 15 years now), but I like to experiment with it.

What I really meant by syntax was the correct placement of characters such as ( and [ or when to use " or "" or ' around words once things get extremely nested.

The currentweapon name will still be a class name instead of a display name right? look here. If it's not possible to return the picture of the gun, then like I said I won't pursue this.

Again about the UT2004 code, I do know that I need to use condition statements, but I'm not sure how to get started.

Share this post


Link to post
Share on other sites

Check GunGame by GossamerSolid.

It has the system already in along with the sounds.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×