Jump to content
Sign in to follow this  
Col Saint

Help, in scripting!

Recommended Posts

Hello, thank u guys for such good help, you´re the best!

I am working on a big coop and hav some ideas.

I need help on a script. well actually 2 scripts.

1. i use for now a trigger with condition "not (alive BMP1) exec bang.sqs".

But i have a few more vehicles which i have inserted in the map. How can i ask in the script if a UNIT is destroyed/Dead.

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

[[2,2,0], [2,4,1], 3000, 2, _blastT1] exec "blaster.sqs"<span id='postcolor'>

that is the script i use for the one Vehicle.

That wasn´t so hard but now how to make it in script to ask if he is alive do nothing and if he got destroyed start blaster.sqs. So i dont have to use 10 scripts and 10 triggers!

Another script i need, you know how to make a trigger, like around a fireplace and if u to close u get hurt just a bit.

So to say "set dammage 0.1" but not all the time only if u longer than 10 sec in it e.g. ?

Maybe this for scripting for a moving Vehicle so if u get close to a destroyed vehicle, a soldier is gettind dammage = 0.1

Would be a great help.

Is there a good tutorial where i can learn that scripting easy?

Thank you, hope you guys can help me!

smile.gif

Share this post


Link to post
Share on other sites

Just detect if the vehicles have been destroyed with the get dammage command for example:

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

#loop

?(getdammage bmp1) == 0: _blastT1 = bmp1; goto "blast"

?(getdammage bmp2) == 0: _blastT1 = bmp2; goto "blast"

?(getdammage bmp3) == 0: _blastT1 = bmp3; goto "blast"

~1

goto "loop"

#blast

[[2,2,0], [2,4,1], 3000, 2, _blastT1] exec "blaster.sqs"

<span id='postcolor'>

For your second question have a script like:

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

#start

_timer1 = 0

?(player distance fire1) =< 2:goto "loop1"

~1

goto "start"

#loop1

_timer1 = _timer1 + 1

~1

?_timer1 == 10: player setdammage 0.1; goto "start"

?(player distance fire1) =< 2:goto "loop1"

<span id='postcolor'>

I haven't tested them so you will have to.

RED

Share this post


Link to post
Share on other sites

Ty Red will do so right away and thanks for the fast reply I just getting started with scripting and well I hope my idea of this script will be usefull when finished.

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 (RED @ Sep. 30 2002,18:07)</td></tr><tr><td id="QUOTE">Just detect if the vehicles have been destroyed with the get dammage command for example:

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

#loop

?(getdammage bmp1) == 0: _blastT1 = bmp1; goto "blast"

?(getdammage bmp2) == 0: _blastT1 = bmp2; goto "blast"

?(getdammage bmp3) == 0: _blastT1 = bmp3; goto "blast"

~1

goto "loop"

#blast

[[2,2,0], [2,4,1], 3000, 2, _blastT1] exec "blaster.sqs"

<span id='postcolor'>

For your second question have a script like:

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

#start

_timer1 = 0

?(player distance fire1) =< 2:goto "loop1"

~1

goto "start"

#loop1

_timer1 = _timer1 + 1

~1

?_timer1 == 10: player setdammage 0.1; goto "start"

?(player distance fire1) =< 2:goto "loop1"

<span id='postcolor'>

I haven't tested them so you will have to.

RED<span id='postcolor'>

k the first didn´t work out, because it creates lag for it loops allthe time when the bmp´s get hurt. I had to change the damage to == 1 than the script was working. So i need to make a script for each vehicle seperate. I tried to make diffrent loops in there so it don´t ask for the allready destroyed vehicle again. Maybe, if i use the count option, it will do it ....?

No I think this won´t work, it must be I guess a much more complex script, which I can´t program in the moment because I have not the knollage yet.

To the second script, I get an error on the player:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(player distance fire1) =< 2:goto "loop1"<span id='postcolor'>

It must be a syntax that all AI and Players can be hurt at that fire/object.

Is there no way to have a tutorial in scripting somewhere?

confused.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>Code Sample </td></tr><tr><td id="CODE">?(player distance fire1) <= 2:goto "loop1"<span id='postcolor'>

It should have been that.

Sorry I made a few mistakes I was in a rush, it won't be hard to stop it working on the same vehicle more than once for example use:

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

b1 = 0

b2 = 0

b3 = 0

#loop

?(getdammage bmp1) == 1 && b1 == 0: _blastT1 = bmp1; b1 = 1 goto "blast"

?(getdammage bmp2) == 1 && b2 == 0: _blastT1 = bmp2; b2 = 1; goto "blast"

?(getdammage bmp3) == 1 && b3 == 0: _blastT1 = bmp3; b3 = 1 goto "blast"

~1

goto "loop"

#blast

[[2,2,0], [2,4,1], 3000, 2, _blastT1] exec "blaster.sqs"

<span id='postcolor'>

You should be able to work out what that does, go to http://www.ofpec.com/ that has tutorials you may find useful.

RED

Share this post


Link to post
Share on other sites

thank you red I will do a try on that right away, it great that you help me alot with this, if this works I will send u link of this mission and see what i have build.

k, I checked it out, the one for the player hurt it worked, but the trouble is I want you to die if u stay to close.

So I need to add the damage points. If i set Dammage 1 you get killed, straight away, but I want them to die very slow, lol.

And another idea, sorry.

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">player getdammage .8; goto "hurt"<span id='postcolor'>

Is this the right code to ask in script to ask for the damage of the soldier. But this must be only for soldiers next to the fire1 where he gets hurt not outside the circle. I guess I need a "AND" but than for each object right?

Share this post


Link to post
Share on other sites

smile.gif hmm, I think:

?(getDammage Player >= 0.8):goto "hurt"

Share this post


Link to post
Share on other sites

K the first script i made is working perfect now to this I bet there are many mistakes in there but would be great if you can help me in this out aswell:

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

_burnT1 = bmp1

_burnT2 = bmp2

_burnT3 = bmp3

_timer1 = 0

_damage1 = 1

#start

?(getdammage player)

?(getdammage _burnT1) == 1; goto "hurt1"

?(getdammage _burnT2) == 1; goto "hurt2"

?(getdammage _burnT3) == 1; goto "hurt3"

goto "start"

#hurt1

_timer1 = 0

?(player distance _burnT1) <= 6; goto "hit1"

~1

goto "start"

#hit1

_timer1 = _timer1 + 1

_damage1 = ?(getdammage player)

~1

?(player distance _burnT1) <= 6; goto "start"

?_timer1 == 1: _damage1 + 0,2; goto "hit1"<span id='postcolor'>

So if u close to the damaged BMP you should get in a certain amount of time some inguries. I didn´t put in yet if you reach a ingury of 0.8 (e.g.) a script is activated. I guess that i have to do in form of bn880, thank you for your reply!  biggrin.gif

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(getDammage Player >= 0.8); exec another.sqs<span id='postcolor'>

But my first part didn´t work out! I hope I don´t get on ya nerves! Thanks for ya all help!

wink.gif  Saint

Share this post


Link to post
Share on other sites

Use this:

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

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">?_timer1 == 1: _damage1 + 0,2; goto "hit1"<span id='postcolor'>

Replace this with:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">?_timer1  == 1: _damage1 = _damage1 + 0,2; player setdammage _damage1; goto "hit1"<span id='postcolor'>

What is the point of using a timer as everytime it loops it gets set to one again, so including that is doing nothing, but if you want to do it you can smile.gif

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(player distance _burnT1) <= 6; goto "start"<span id='postcolor'>

I guess you want this to stop the player getting hurt when he is over 6 meters away from the BMP? if so you need to use >= that means greater than or equal to. Look at the command referance (on the main part of the site under editing)

Hope that helped you.

RED

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 (RED @ Oct. 02 2002,11:19)</td></tr><tr><td id="QUOTE">Replace this with:

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">?_timer1 == 1: _damage1 = _damage1 + 0,2; player setdammage _damage1; goto "hit1"<span id='postcolor'><span id='postcolor'>

Good, just watch the 0,2 I think it has to be 0.2 in OFP scripts.

Share this post


Link to post
Share on other sites

Ty ya both red and bn880.

Red I just started editing the scripts, only used Editor to make Maps, and tried now the way of scripting.

I must admit it´s fun, when it works. The trouble is if you don´t know commands or the basic it´s hard.

Yes understand the timer is useless of course.

Another thing a problem to make this script perfect.

Because its ready and working i can tell what it does.

The first script is for vehicles which gets destroyed not just to smoke, they burn out. The second one is for the Players when standing to close to get hurt till death.

Now, if the timer is 0 (fire off) than the script should notice it and the player is save in range of the destroyed vehicle. I will try to sort it out but hell, i am ´still to bad in scripting to get it to work.

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">[[0,1,-2], [2,4,1], 3000(timer), 2, _blastT1] exec "blaster.sqs"

[[0.2,0,-1], [2,1,3], 3000(timer), 5, _blastT1] exec "blaster.sqs"

[[0,0,-1], [2,1,0], 3000(timer), 3, _blastT1] exec "blaster.sqs" <span id='postcolor'>

*timer if timer is to 0, no harm is done to the Soldiers.

For my new Map I had an idea, too.

Is there a way to have as Player no Compass (this works I know in the desciption.ext) but if u are at a certain position, you can get it back on? Same with the GPS signal, you don´t show up in map like in veteran mode, but still in Cadett Mode, and use a command that you now are able to show up in the Map? Well, if I make maps I wanna make it special.

 wow.gif  Saint

And thanks alot for the help hope to do so later aswell and help others!

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  

×