Jump to content
Sign in to follow this  
Doolittle

Fix your tk script!

Recommended Posts

I was just playing this mission when my BMP blew up & it said I killed myself (Friendly Fire). Well then I get this message that I killed a teammate & it's a black screen & it says I can't play for 5 minutes.

First of all, THAT IS SO LAME! Secondly, and most important, I couldn't even ESC out to disconnect! I had to ALT-F4 to get away from that screen. I guess they were doing a camera view or something.

The reason I am posting this here is, if you write code, DON'T EVER TAKE AWAY A USERS ABILITY TO ESC! This is like an ethical/moral issue, scripters. Have you no decency??

Doolittle

(This is a serious post.)

Share this post


Link to post
Share on other sites

Yeah, that Tk script is quite broken.

I made a better one with event handlers, which detects ONLy your killing of someone in a specific group (IE, the 12 enemy players).

But the issue you raise with the "fade out" is a big one. In my mod there are fade ins/outs used as transitions, and if a computer is running very slow, in my multiplayer mod, every 1/1000 times or so the player's computer may fade otu and never back in again. I tried to fix that with random instantaneous fade ins during missions, but even so.

Plus, ca everyone PLEASE start using event handlers for Tk scripts? They don't punish you for killing yourself...

Share this post


Link to post
Share on other sites

This post is best viewed in 1600x1200 resolution wink.gif

Using rating to check for TK seems pretty stupid to me, the eventhandlers are great since U can also check for respawnkilling and for only injuring teammates.

Not being able to play for 5 minutes seems a bit too much for just one TK (ofcourse TKs are worse on some maps then others).

The eventhandlers needs to be added every time you respawn though I think. I just made a looping trigger that removes your eventhandlers and then adds them to make sure everyone has an eventhandler all the time.

First the variable Event is set to true as soon as the missions begins then I have a trigger that looks like this:

Condition: Event

On Activation: "_X removeAllEventHandlers ""Hit""" foreach thislist;"_X addeventhandler [""Hit"",{Stackare=_this select 0;Elaking=_this select 1;StackareS=side Stackare;ElakingS=side Elaking;this exec ""AntiTK.sqs""}]" foreach thislist;Event=false

On Deactivation: Event=true

I havent tested this script with several people yet but I think it should work OK.

The antiTK.sqs looks like this:

_Stackare=Stackare

_Elaking=Elaking

_ElakingS=ElakingS

_StackareS=StackareS

#Next

?T==1 : exit   <---this keep spamming messages away

T=1            <---for example if someone grenades a bunch of teammates thy would all yell at him causing a spam

~0.1

T=0

?_Stackare==_Elaking : exit     <---if the person killed himself the script will exit

?((_ElakingS)!=East) and ((_ElakingS)!=west) : goto "Renegade"        <---if you kill several teammates Ur a renegade and get punnished harder

?!((_ElakingS)==(_StackareS)) : goto "Enemy"           <---if you shot an enemy the script checks for other things then if you shot a teammate

#Friendly

?(Alive _Stackare):_Stackare sidechat format ["Watch you´re fire %1 !!",name _Elaking];exit   <---if you shoot a teammate he yells at U if he is still alive

Hint format ["%1 killed a teammate",name _Elaking]   <---if you teamkill an AI it wount say in the chat so here it says in the hint

removeallweapons _Elaking        <---removes the badguys weapons so he cant do any more harm

~1

_Elaking globalchat "Oh my god! That was so lame I must kill myself..."  <---the badguy feels so bad so he kills himself

~1

_Elaking setdammage 1  <---the badguy gets killed

exit

#Enemy   <---this is where the script starts to check for stuff if you shot an enemy

?(_ElakingS==West) and (_Stackare distance Respawn_East >200) : exit   <---Respawn_East is a game logic in the middle of the east safezone

?(_ElakingS==East) and (_Stackare distance Respawn_West >200) : exit   <---if the guy who got killed is over 200 meters from his safezone the script will exit

?Alive _Stackare : _Stackare globalchat format ["%1, don´t shoot me in the safezone you lame fuck!",name _Elaking]  <---this part is optional wink.gif

titletext [format ["%1 shot %2 in the safezone",name _Elaking,name _Stackare],"Plain"]     <---shows everyone what the lamer did

Hint format ["The gods noticed the injustice and decided to punnish %1",name _Elaking]     <---I just add these kinda stuff cuz I think its funny

removeallweapons _Elaking    <---removes all the weapons from the badguys so he cant do any more harm

?(_ElakingS==West) : _Elaking setpos [getmarkerpos "Respawn_East" select 0,getmarkerpos "Respawn_East" select 1,500]   <---makes sure the badguy falls

?(_ElakingS==East) : _Elaking setpos [getmarkerpos "Respawn_West" select 0,getmarkerpos "Respawn_West" select 1,500]   <---into the enemy safezone

~2

?!Alive _Elaking : exit   <---we dont want a yelling deadguy

_Elaking globalchat "Somebody catch meeeeeeeeee...................!"

@!alive _Elaking    <---the script continues when the badguy is dead

hint format ["%1 hit the ground hard",name _Elaking]

exit

#Renegade

hint format ["%1 killed several teammates and now has to feel the wrath of the gods",name _Elaking]

removeallweapons _Elaking   <---again, removes all the weapons from the badguy so he cant do any more harm

_Elaking setpos [5000,5000,10000]   <---takes about 2 minutes before the badguy hits the ground

~2

_Elaking globalchat "Wow, I can see Everon from up here!"     <---the map where I use this script is on Nogova

@!alive _Elaking   <---the script continues when the badguy is dead

hint format ["%1 left a small crater",name _Elaking]    <---what do you expect from 10000 meters ? tounge.gif

Share this post


Link to post
Share on other sites

Lmao, Inq, your script is wonderful!! biggrin.gif

You gotta upload it somewhere! I can host it for you.

Had a great time reading the script, lol smile.gif

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">hint format ["%1 left a small crater",name _Elaking]<span id='postcolor'>

So America's Army wink.gif

Share this post


Link to post
Share on other sites

Very nice InqWiper!  Where did you get your variable names from?  Elaking?  Stackare?  Heh, you really put a lot of thought into this, to get every situation.  Hmm, on some servers I know, this'll make people falling from the sky all the time.

Yeah that addEventHandler to a player confuses me...it seems you start the map as TWO objects that are in the same space, then after the first death you become this second object and the first one is left behind as a body.  I think that's how it works.  So on death is the player object "recreated" so that it loses all settings on it?  Which is why the addEventHandler goes away?  I don't really even know how to explain the problem, just that adding an event to a player doesn't seem to stick with 'em after they respawn.

Doolittle

Share this post


Link to post
Share on other sites
Guest

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (Doolittle @ Oct. 31 2002,03:19)</td></tr><tr><td id="QUOTE">Very nice InqWiper!  Where did you get your variable names from?  Elaking?  Stackare?  Heh, you really put a lot of thought into this, to get every situation.  Hmm, on some servers I know, this'll make people falling from the sky all the time.<span id='postcolor'>

Elaking = bad guy

Stackare = poor guy

in Swedish smile.gif

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (InqWiper @ Oct. 30 2002,19:31)</td></tr><tr><td id="QUOTE">_Elaking setpos [5000,5000,10000] <---takes about 2 minutes before the badguy hits the ground<span id='postcolor'>

Funny script, I see you enjoyed yourself. smile.gif

Some small tip: use ~ instead of the @... for performance issues

Share this post


Link to post
Share on other sites

bn880, I used to use ~ until condition and keep looping, but I switched some of my scripts over to @ because it seemed to give better preformance. Am I just plain wrong?

~x updates every tiem you loop, while I heard @ updates every frame...

Share this post


Link to post
Share on other sites

Post deleted.  Just FYI I found that 5-minute-timeout-and-no-escape-key script.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">Lmao, Inq, your script is wonderful!!

You gotta upload it somewhere! I can host it for you.

Had a great time reading the script, lol  

Quote  

hint format ["%1 left a small crater",name _Elaking]

So America's Army  

<span id='postcolor'>

The script is now uploaded as a .txt here. You might wanna stay away from some other files that are also uploaded there, especially the .vbs-files wink.gif

I havent played AA so much and when I have its been mostly mountain ambush so I havent gotten a chance to leave a small crater yet wink.gif

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">Funny script, I see you enjoyed yourself.  

Some small tip: use ~ instead of the @... for performance issues

<span id='postcolor'>

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">bn880, I used to use ~ until condition and keep looping, but I switched some of my scripts over to @ because it seemed to give better preformance. Am I just plain wrong?

~x updates every tiem you loop, while I heard @ updates every frame...<span id='postcolor'>

I think Im gonna hold the changes til you guys agree on the best solution wink.gif

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (The_Captain @ Oct. 31 2002,00:39)</td></tr><tr><td id="QUOTE">bn880, I used to use ~ until condition and keep looping, but I switched some of my scripts over to @ because it seemed to give better preformance. Am I just plain wrong?

~x updates every tiem you loop, while I heard @ updates every frame...<span id='postcolor'>

I did that once too actually, Suma verified that ~0.1 will be less CPU intensive then @. If you go as low as ~0.001, probably no difference but ~ should be put in all loops to prevent script from hogging processor.

I have yet to update my TWMN to 1.85 status and ~s instead of @s, I think it will run 50% better.

Share this post


Link to post
Share on other sites

So instead of:

@!alive _Elaking

I should use:

#Loop1

~1

?!alive _Elaking : goto "Next1"

goto "Loop1"

?

Share this post


Link to post
Share on other sites

er.....actually...

this part whouldnt be in teh script:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">_P=0

#Loop

_Elaking removeaction _P

_P=_P+1

?!alive _Stackare : _Stackare removeaction _P

?_P>100 : goto "Next"

goto "Loop"

<span id='postcolor'>

thats for my map because I have an action that I dont like on the corpses.

-Edit

That part is now removed from both mine and neos link.

Share this post


Link to post
Share on other sites

What action?

Oh, and tested your script last night in two of my infantry missions. It worked pretty well.

Some elustrious players on our server worked out that if you run over your teammates in a car or run over enemy at their spawn they don't get punished.

However due to the way OFP treats such incidents I am not surprised.

I will put a trigger that kills any player entering enemy area to compensate for that.

Also they didn't go 10,000 in the area, maybe like 150meters. Not sure why..

Excellent work though, all in all smile.gif

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (InqWiper @ Oct. 31 2002,16:33)</td></tr><tr><td id="QUOTE">So instead of:

@!alive _Elaking

I should use:

#Loop1

~1

?!alive _Elaking : goto "Next1"

goto "Loop1"

?<span id='postcolor'>

Yea, that would be great for performance...

Share this post


Link to post
Share on other sites

Ya what the heck does this have to do with a virus alert?

Share this post


Link to post
Share on other sites

You only get placed 10000 meters in the air if U manage to kill several teammates at once, like trowing a grenade killing 3 teammates. If you shoot an enemy in theire respawn you will be placed 500 meters in the air over theire respawn. I think thats enough cuz its not worth running 5 minutes across the map just to kill one guy in the respawn when U can kill 5 in the combatzone.

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">Quote (InqWiper @ Oct. 31 2002,16:33)

So instead of:

@!alive _Elaking

I should use:

#Loop1

~1

?!alive _Elaking : goto "Next1"

goto "Loop1"

?

Yea, that would be great for performance...<span id='postcolor'>

Okie.

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">Ya what the heck does this have to do with a virus alert?<span id='postcolor'>

This post is infected with a virus, check your HDD tounge.gif

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  

×