OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Doolittle on 22 Sep 2003, 18:03:59

Title: camCreate Shilka shots?
Post by: Doolittle on 22 Sep 2003, 18:03:59
Just an idea....what if you attached a fired event to a Shilka & every time it shot, you nearestObject grabbed the "bullet" and deleted it, then in its place you camCreate the bullet and send it on its way.  Only one client would of course see this in multiplayer...but if the camCreated bullet hits anything, it will take damage.  Would this reduce lag when a Shilka opens up on enemies??  Or would it require too much processing power?

Thoughts?

Doolittle
Title: Re:camCreate Shilka shots?
Post by: SickSidewinder on 23 Sep 2003, 03:39:48
more lag, cuz instead of just using the bullet tragentory already encoded for the shilka, its now using an external script.  im no expert, but that sounds right to me
Title: Re:camCreate Shilka shots?
Post by: Knut Erik on 23 Sep 2003, 13:34:18
Just wondering  :-\

why the heck do you want to do that ??  ???
What is wrong with the shilka shots that are there allready ??

I doesn't have THAT mush experience with camcreating etc..
But if you explain why you want it, I'll be of as mush help as i can  :D
 :thumbsup:
Title: Re:camCreate Shilka shots?
Post by: Doolittle on 23 Sep 2003, 16:59:56
Well my only thinking is that when the Shilka shoots, the tracer shot flies through the air for a few seconds.  The whole time, its location is being translated to everyone....this makes major lag.  If this "bullet" were turned into a camCreated object...and since camCreated objects are only on the computer that creates them...then this should reduce lag a lot...in theory.

Doolittle
Title: Re:camCreate Shilka shots?
Post by: Knut Erik on 23 Sep 2003, 17:13:36
Oook...  ;)

It should be possible!

Shilka addEventHandler ["Fired","[Shilka] exec "Script.sqs"]

And then

script.sqs

Code: [Select]
_shilka = _this select 0

_bullet = NearestObject [Shilka,"NameOfShilkaBullet"]
_speed = velocity _bullet
_NewBullet = "NameOfShilkaBullet" setPos [getPos _bullet select 0,(getPos _bullet select 1) + 0.1]
_newBullet setVelocity _Speed
DeleteVehicle _bullet
EXIT

I am REALLY unsure about this... Ain't at home now so I can't check...
But... To find out what the name of the shilka bullet is, but this little code in the init field of a shilka
this addEventHandler ["fired", { hint format ["You fired a shot of %1",_this select 4] }]

Tell me if it works  :D
Title: Re:camCreate Shilka shots?
Post by: KTottE on 23 Sep 2003, 17:28:04
I think that depends on the server.

We were playing a mission called West vs East, and at times we had five Shilkas firing at the same time, and no noticable lag because of it.
Title: Re:camCreate Shilka shots??
Post by: Doolittle on 24 Sep 2003, 01:39:13
Knut....cool beans.  I have no way of testing this though....actually I was asking because I dunno if anyone had been thinking about doing that....I would think it would be massive CPU usage on the firing computer.

KTottE....was this over a LAN?  How many people were playing?

Doolittle
Title: Re:camCreate Shilka shots?
Post by: KTottE on 24 Sep 2003, 10:53:41
Doolittle, it was over internet, and we were... hmm, I think we were five or six people.
Title: Re:camCreate Shilka shots?
Post by: Knut Erik on 24 Sep 2003, 11:00:37
Ok.. I got it to work  8)

Check out the attachment  ;)