Home   Help Search Login Register  

Author Topic: Transfering data.  (Read 593 times)

0 Members and 1 Guest are viewing this topic.

Ace Productions

  • Guest
Transfering data.
« on: 12 Sep 2004, 16:45:35 »
Hi people,

FACTS:

I have one east unit called "Target" and one west unit called "Shooter". Shooter activates a "fired" EH which executes "Fired.sqs". Target gets shot and activates a "hit" EH which executes "Hit.sqs"

Fired.sqs

_shooter = _this select 0
_weapon = _this select 1
_bullet = _this select 4
~0

Exit

Hit.sqs

_wounded = _this select 0
~0

Exit

QUESTION:

How can I transfer the data from one script to the other so I end up with:

Data.sqs

_shooter = _this select 0
_weapon = _this select 1
_bullet = _this select 2
_wounded = _this select 3
~0

Exit



 

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Transfering data.
« Reply #1 on: 12 Sep 2004, 21:36:21 »
I've been putting off adding something to my vampires addon that would require just this kind of scripting. So I haven't actually made anything work yet, but I have some ideas on how it could be done.

First off, you can use global variables. Basically, from the fired EH, you add the shooter to a global array. Then in the hit EH, you check the global array to see if the unit was hit by somebody who just fired.
Now you would have to put a time or something in the global array too. So basically one entry in the global array might look like: [shooter, time shot, weapon, bullet]. After a second you remove that entry from the array. Well, thats the rough idea, I'm sure it would have to be changed around a bit.

Another way to do it would take more resources, but would be more likely to work and be accurate. In the fired EH, you make a loop that follows the bullet, constantly checking if anybody is near. If the bullet terminates very close to a unit, then it hit that unit, and you continue with the script.

Well, both ideas are very rough ATM, so I hope you understand the meaning Im trying to convey. I'll try to explain/figure it out more later.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Ace Productions

  • Guest
Re:Transfering data.
« Reply #2 on: 14 Sep 2004, 06:16:26 »
General! Success!  ;D

It works perfectly when assigning the different parameters as global variables! I was running at the same time 3 EHs (each returning their values in a different script) and in a fourth script I used 1 value from each EH returned script. I'm posting later on today the exprimental mission example.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Transfering data.
« Reply #3 on: 14 Sep 2004, 13:19:46 »
Sounds good. I'd be interested to see how you made it work :)
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Ace Productions

  • Guest
Re:Transfering data.
« Reply #4 on: 23 Sep 2004, 21:51:47 »
General sorry for the delayed reply but I was on a bussiness trip.

Check this sample when you feel like it and... please keep an open mind!  ::)


Ace Productions

  • Guest
Re:Transfering data.
« Reply #5 on: 23 Sep 2004, 22:34:27 »
Attachement failed. Check your e-mail.

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Transfering data.
« Reply #6 on: 24 Sep 2004, 19:59:29 »
Nope, not seeing it. How big is it? My inbox is pretty full...
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!