Home   Help Search Login Register  

Author Topic: Doolittle or someone here! (Vehicle respawn)  (Read 2501 times)

0 Members and 2 Guests are viewing this topic.

Offline Lykurgos

  • Members
  • *
  • Member of Decapitator
    • My ftp site (contains few mission etc...)
Doolittle or someone here! (Vehicle respawn)
« on: 21 Apr 2003, 13:20:29 »
Well, I believe that you have made some excellent vehicle respawns, but I someway use them wrong or they simply doesnÂ't work with me. In this case I am using the following respawn script:

The vehicle respawn for 1.46 (no smoke, located in the editors depot)

The problems:
-It creates the vehicles in wrong positions
-In multiplayer, it creates 2 vehicles instead of 1 no matter how many players were in the server or was it a dedicated server
-Custom actions in vehicles disappear
-The abandon time is 0 so the vehicle disappears at same time when the crew number is 0

But at least I can make different respawn times to different vehicles.

So I am asking you a very big favor, to make a new vehicle respawn with following features:

-Compatible with OFP v. 1.46
-Different respawn times to vehicles
-Vehicles respawn exactly at same position where they was originally placed and without any copies
-The abandon time for all vehicles is 2 minutes
-I am using custom actions for choppers, named mi17 and blackhawk, so I would like that those actions will stay.
-No AI inside, just empty

I would be very very very appreciated if u could make that script.  ::)

Cheers!  ;D

You are right of course, to go alone would be crazy. You will be my driver.

Tactician

  • Guest
Re:Doolittle or someone here! (Vehicle respawn)
« Reply #1 on: 22 Apr 2003, 12:48:23 »
The custom actions are the hard part in 1.46.  Can you tell us more about what those custom actions do?

Offline Lykurgos

  • Members
  • *
  • Member of Decapitator
    • My ftp site (contains few mission etc...)
Re:Doolittle or someone here! (Vehicle respawn)
« Reply #2 on: 22 Apr 2003, 15:08:34 »
ItÂ's just a simple parachute script for west and east.
You are right of course, to go alone would be crazy. You will be my driver.

Tactician

  • Guest
Re:Doolittle or someone here! (Vehicle respawn)
« Reply #3 on: 22 Apr 2003, 21:40:42 »
That doesn't tell us much.

1) How many choppers per side?  Are the choppers only on one side?
2) They respawn with the parachuting action every time?
3) How is the action added?  Trigger, script, init?
4) Is the action visible to everyone, should it be?

You don't have to give away your script, just some details about how it's used ;)

Offline Lykurgos

  • Members
  • *
  • Member of Decapitator
    • My ftp site (contains few mission etc...)
Re:Doolittle or someone here! (Vehicle respawn)
« Reply #4 on: 23 Apr 2003, 16:05:24 »
Okay then, IÂ'll tell you all.

1. There are one chopper per side; blackhawk (no machinegun, the ordinary) for west and mi17 for the east.
2. ThatÂ's what I am going to do, if I get some tips how to do it.
3. The action is added simply by putting following "text" into blackhawks Init section in the editor.

this addaction ["Parachute group","West Eject.sqs]

So when the west leader, the human player (notice, this mission is recommended to 2 players, one on each side) enters the chopper as a pilot and the team is in the cargo he can make this action and the team jumps from the chopper. BIG NOTICE! I am not asking you to determine is the player a pilot and is the team in the cargo, just make me this addaction along with the vehicle respawn script.

For east, I made almost the same, so I put the following text into the mi17`s init field:

this addaction ["Parachute group","East Eject.sqs"]

I should also tell you the parachute script entirely:

soldierw1 action ["EJECT", blackhawk]
~1
soldierw2 action ["EJECT", blackhawk]
~1
soldierw3 action ["EJECT", blackhawk]
~1
soldierw4 action ["EJECT", blackhawk]
~1
soldierw5 action ["EJECT", blackhawk]
~1
soldierw6 action ["EJECT", blackhawk]
~1
soldierw7 action ["EJECT", blackhawk]
~1
soldierw8 action ["EJECT", blackhawk]
~1
soldierw9 action ["EJECT", blackhawk]

exit

So thatÂ's the script for west. Okay, it sounds like a beginner script, but it works well, notice that the soldier names are always the same, after they die, but because of the Create object command, the blackhawk losts its name. First, when I didnÂ't know about this, I made a script which activates 65,1 seconds after the blackhawk is destroyed, repeatedly, because the respawn time of blackhawk was 65 seconds and in the on activation section I put the addaction command. Same for the mi17. The east eject script is very similar to the west eject; it has only different names on it.

4. The action is visible to everyone, but only west can use its script and east can use its script, because of the different names like blackhawk and mi17. I am not gonna fix this one.

But  please. LetÂ's focus now on the vehicle respawn script.
You are right of course, to go alone would be crazy. You will be my driver.

Tactician

  • Guest
Re:Doolittle or someone here! (Vehicle respawn)
« Reply #5 on: 23 Apr 2003, 16:38:53 »
Alright.. time to work the magic.

Create a game logic named Server.

DO NOT name the choppers with the "name" field of the object.  Instead, name them from the init field.  For the blackhawk, "blackhawk = this".  For the Mi17, "mi17 = this".  I am assuming throughout the tutorial that your Mi17 is named mi17 and that the east parachute script refers to it as such.

init.sqs snippet:
Code: [Select]
publicChopper = objNull
[] exec "checkchopper.sqs"

In the blackhawk's init field:
[this,"UH60",30] exec "ch_respawn.sqs"; this addaction ["Parachute group","West Eject.sqs"]; blackhawk = this
("30" is where you put the desired respawn delay)

In the Mi17's init field:
[this,"Mi17",30] exec "ch_respawn.sqs"; this addAction ["Parachute group","East Eject.sqs"]; mi17 = this

ch_respawn.sqs:
Code: [Select]
?!(local Server): exit

_chopper = _this select 0
_type = _this select 1
_delay = _this select 2
_pos = getPos _chopper
_dir = getDir _chopper

#start
@("alive _x" count (crew _chopper) > 0 OR !canMove _chopper)
?(!canMove _chopper): goto "respawnit"
@("alive _x" count (crew _chopper) == 0 OR !canMove _chopper)
#respawnit
~(_delay - 1)
?("alive _x" count (crew _chopper) > 0 OR canMove _chopper): goto "start"
deleteVehicle _chopper
~1
_chopper = _type createVehicle _pos
_chopper setPos _pos
_chopper setDir _dir
publicChopper = _chopper; publicVariable "publicChopper"
goto "start"

checkchopper.sqs:
Code: [Select]
~1
#start
publicChopper = objNull
@!isNull publicChopper
_ch = publicChopper
?("UH60" countType [_ch] == 1): blackhawk = _ch; blackhawk addAction ["Parachute group","West Eject.sqs"]
?("Mi17" countType [_ch] == 1): mi17 = _ch; mi17 addAction ["Parachute group","East Eject.sqs"]
goto "start"

Properties:
- Respawns if abandoned, disabled (can't move), or crew is killed
- Respawn cancelled if vehicle is occupied or repaired
- Deletes vehicle 1 second before new one is created

Let me know if it works.
« Last Edit: 29 Apr 2003, 21:13:19 by Tactician »

Offline Lykurgos

  • Members
  • *
  • Member of Decapitator
    • My ftp site (contains few mission etc...)
Re:Doolittle or someone here! (Vehicle respawn)
« Reply #6 on: 23 Apr 2003, 17:07:53 »
Okay, IÂ'll try it tomorrow. I hope it works.  :)

But remember  :-\, there are also some other vehicles. Here is the list with respawn times:

Jeep/Uaz - 5 seconds
Jeep with machinegun/Brdm - 8 seconds
5t truck/Ural - 12 seconds

All the support vehicles (the trucks like fuel, repair and ammo and a ambulance bmp and m113 - 18 seconds

Bmp2/M2A2 - 18 seconds
Shilka/Vulcan - 20 seconds
T-72/M60 - 30 seconds
t-80/M1A1 - 50 seconds
Mi-17/UH-60 - 65 seconds

There are 1 of each.
But anyway, thanks a lot this far.  ;D
You are right of course, to go alone would be crazy. You will be my driver.

Tactician

  • Guest
Re:Doolittle or someone here! (Vehicle respawn)
« Reply #7 on: 23 Apr 2003, 20:59:08 »
Oh.. you'll want a different script for those.

Started in vehicle init field:
[this,"class",30] exec "vrespawn.sqs"
"30" is delay of course, and "class" is classname of vehicle.

vrespawn.sqs:
Code: [Select]
?!(local Server): exit

_veh = _this select 0
_type = _this select 1
_delay = _this select 2
_pos = getPos _veh
_dir = getDir _veh

#start
@("alive _x" count (crew _veh) > 0 OR !canMove _veh)
?(!canMove _veh): goto "respawnit"
@("alive _x" count (crew _veh) == 0 OR !canMove _veh)
#respawnit
~(_delay - 1)
?("alive _x" count (crew _veh) > 0 OR canMove _veh): goto "start"
deleteVehicle _veh
~1
_veh = _type createVehicle _pos
_veh setPos _pos
_veh setDir _dir
goto "start"

As you can see, very similar to ch_respawn.sqs.  I'm sure there's a list of vehicle classnames in the Ed Depot if you need it ;)
« Last Edit: 25 Apr 2003, 13:29:38 by Tactician »

Offline Lykurgos

  • Members
  • *
  • Member of Decapitator
    • My ftp site (contains few mission etc...)
Re:Doolittle or someone here! (Vehicle respawn)
« Reply #8 on: 24 Apr 2003, 18:49:41 »
Okay, I got some bad news for ya.  :'(

The vrespawn script doesnÂ't work, it deletes the objects but it doesnÂ't create new ones and nothing happens when the vehicle is abandonned.

The Chopper script deletes the vehicles and creates the vehicles in the right places, but it doesnÂ't add the actions, there is some sort of error message at

?([_ch] countType "Mi17" == 1): String expected
or something like that. By the way, the name of the mi17 wasnÂ't mi17, it was hip, so I changed all the names in your scripts.

Also the abandon thing doesnÂ't work.

Is it somekind of curse, that the vehicle scripts doesnÂ't work with me?!
noooooooooooooooooooooooooooooooooooooooooooooo
But perhaps I should think about making my own vehicle script. Still if you find the mistake in your script, tell me.
You are right of course, to go alone would be crazy. You will be my driver.

Tactician

  • Guest
Re:Doolittle or someone here! (Vehicle respawn)
« Reply #9 on: 25 Apr 2003, 13:26:03 »
Don't give up so easily, scripting is trial and error.

The error in the action addition is due to a syntax mistake.  It should be "Mi17" countType [_ch] and "UH60" countType [_ch].  Updated the above script for this.

I messed up some variable value assignments in vrespawn.sqs.  I updated the above.

Unfortunately my good, working abandon-sensitive vrespawn is on another computer so I was making this one from scratch.  Will update later when I can get my hands on it.
« Last Edit: 25 Apr 2003, 13:30:39 by Tactician »

Offline Lykurgos

  • Members
  • *
  • Member of Decapitator
    • My ftp site (contains few mission etc...)
Re:Doolittle or someone here! (Vehicle respawn)
« Reply #10 on: 27 Apr 2003, 08:56:03 »
Hey, some little progress....

The vrespawn works (except for those abandon things) well. It deletes and creates new vehicles in new places without copies! Wóhoo!

But unfortunately the chopper addaction thing doesnÂ't still work. This time it says "missing array". But thanks anyway.

If you find your abandon script, please try to make the abandon delay to 2 minutes, not just 1 second.

Cheers!  ;D
You are right of course, to go alone would be crazy. You will be my driver.

Offline Lykurgos

  • Members
  • *
  • Member of Decapitator
    • My ftp site (contains few mission etc...)
Re:Doolittle or someone here! (Vehicle respawn)
« Reply #11 on: 29 Apr 2003, 18:36:36 »
Hello? Anybody here?  ???
You are right of course, to go alone would be crazy. You will be my driver.

Tactician

  • Guest
Re:Doolittle or someone here! (Vehicle respawn)
« Reply #12 on: 29 Apr 2003, 21:15:26 »
Typo in checkchopper.sqs, try it now.  For future reference, if it asks for an array, give it an array.. I make mistakes too, and there's nothing wrong with trying to fix my code yourself.  I don't test this stuff, after all.

Abandon script is set to wait an amount of time equal to respawn delay I believe.  Still don't have access to my good one.

Offline Lykurgos

  • Members
  • *
  • Member of Decapitator
    • My ftp site (contains few mission etc...)
Re:Doolittle or someone here! (Vehicle respawn)
« Reply #13 on: 18 May 2003, 12:16:31 »
Okay, I finally tested it and this addaction thing works fine. Only this abandon thing is missing....
You are right of course, to go alone would be crazy. You will be my driver.