Home   Help Search Login Register  

Author Topic: Spawn script error for me  (Read 1561 times)

0 Members and 1 Guest are viewing this topic.

Offline Ducatisto

  • Members
  • *
  • I'm a noob at this!
Spawn script error for me
« on: 21 Mar 2004, 18:47:21 »
Firstly I am a complete novice regarding scripting but my love of all things OPF has led me to experiment in creating my own mission. Secondly, for those who will read this post and say "why don't you search for it" I have for hours and the searches have not bourne fruit (or answers!). My problem is that I saw an example test with a brief tutorial regarding a script created by CrashnBurn, it suited what I wanted exactly. The test example went well so I went on to copy exactly to the letter all the units and markers from the test into my map. I placed my player next to the spawn points and all went well except that the crews of the tanks or helos did not appear.  The script is as follows:

Code: [Select]
;createunit script by -CrashnBurn-
;-------------------------------------------------------------
"OfficerE" createunit [getMarkerPos "inf1",east1,"s1=this",1,"LIEUTENANT"]
"SoldierEMG" createunit [getMarkerPos "inf1",east1,"s2=this",0.8,"SERGEANT"]
"SoldierEG" createunit [getMarkerPos "inf1",east1,"s3=this",0.7,"CORPORAL"]
"SoldierEG" createunit [getMarkerPos "inf1",east1,"s4=this",0.7,"CORPORAL"]
"SoldierELAW" createunit [getMarkerPos "inf1",east1,"s5=this",0.6,"PRIVATE"]
"SoldierEMedic" createunit [getMarkerPos "inf1",east1,"s6=this",0.6,"PRIVATE"]
~2
east1 move getmarkerpos "inf1move"
;-------------------------------------------------------------
~1
"OfficerE" createunit [getMarkerPos "inf2",east2,"s7=this",1,"LIEUTENANT"]
"SoldierEMG" createunit [getMarkerPos "inf2",east2,"s8=this",0.8,"SERGEANT"]
"SoldierEG" createunit [getMarkerPos "inf2",east2,"s9=this",0.7,"CORPORAL"]
"SoldierEG" createunit [getMarkerPos "inf2",east2,"s10=this",0.7,"CORPORAL"]
"SoldierELAW" createunit [getMarkerPos "inf2",east2,"s11=this",0.6,"PRIVATE"]
"SoldierEMedic" createunit [getMarkerPos "inf2",east2,"s12=this",0.6,"PRIVATE"]
~2
east2 move getmarkerpos "inf2move"
;----------------------------------------------------------------------------
~1
"OfficerE" createunit [getMarkerPos "inf3",east3,"s13=this",1,"LIEUTENANT"]
"SoldierEMG" createunit [getMarkerPos "inf3",east3,"s14=this",0.8,"SERGEANT"]
"SoldierEG" createunit [getMarkerPos "inf3",east3,"s15=this",0.7,"CORPORAL"]
"SoldierEG" createunit [getMarkerPos "inf3",east3,"s16=this",0.7,"CORPORAL"]
"SoldierELAW" createunit [getMarkerPos "inf3",east3,"s17=this",0.6,"PRIVATE"]
"SoldierEMedic" createunit [getMarkerPos "inf3",east3,"s18=this",0.6,"PRIVATE"]
~2
east3 move getmarkerpos "inf3move"
;----------------------------------------------------------------------------
;End of Soldiers and Beginning of Tanks
;----------------------------------------------------------------------------
_tank1 = "BMP" createvehicle getmarkerpos "tank"
~2
"SoldierECrew" createunit [getmarkerpos "inf1",armor1,"c1=this",0.8,"SERGEANT"]
"SoldierECrew" createunit [getmarkerpos "inf1",armor1,"c2=this",0.8,"CORPORAL"]
"SoldierECrew" createunit [getmarkerpos "inf1",armor1,"c3=this",0.8,"PRIVATE"]
~2
c1 moveincommander _tank1
c2 moveingunner _tank1
c3 moveindriver _tank1
~1
armor1 move getmarkerpos "tankmove"
;-----------------------------------------------------------------------------
~6
_tank2 = "BMP" createvehicle getmarkerpos "tank"
~2
"SoldierECrew" createunit [getmarkerpos "inf1",armor2,"c4=this",0.8,"SERGEANT"]
"SoldierECrew" createunit [getmarkerpos "inf1",armor2,"c5=this",0.8,"CORPORAL"]
"SoldierECrew" createunit [getmarkerpos "inf1",armor2,"c6=this",0.8,"PRIVATE"]
~2
c4 moveincommander _tank2
c5 moveingunner _tank2
c6 moveindriver _tank2
~1
armor2 move getmarkerpos "tankmove"
;-----------------------------------------------------------------------------
~6
_tank3 = "BMP" createvehicle getmarkerpos "tank"
~2
"SoldierECrew" createunit [getmarkerpos "inf1",armor3,"c7=this",0.8,"SERGEANT"]
"SoldierECrew" createunit [getmarkerpos "inf1",armor3,"c8=this",0.8,"CORPORAL"]
"SoldierECrew" createunit [getmarkerpos "inf1",armor3,"c9=this",0.8,"PRIVATE"]
~2
c7 moveincommander _tank3
c8 moveingunner _tank3
c9 moveindriver _tank3
~1
armor3 move getmarkerpos "tankmove"
;-----------------------------------------------------------------------------
~6
_tank4 = "ZSU" createvehicle getmarkerpos "tank"
~2
"SoldierECrew" createunit [getmarkerpos "inf1",armor4,"c10=this",0.8,"SERGEANT"]
"SoldierECrew" createunit [getmarkerpos "inf1",armor4,"c11=this",0.8,"CORPORAL"]
"SoldierECrew" createunit [getmarkerpos "inf1",armor4,"c12=this",0.8,"PRIVATE"]
~2
c10 moveincommander _tank4
c11 moveingunner _tank4
c12 moveindriver _tank4
~1
armor4 move getmarkerpos "tankmove"
;-----------------------------------------------------------------------------
~6
_tank5 = "T72" createvehicle getmarkerpos "tank"
~2
"SoldierECrew" createunit [getmarkerpos "inf1",armor5,"c13=this",0.8,"SERGEANT"]
"SoldierECrew" createunit [getmarkerpos "inf1",armor5,"c14=this",0.8,"CORPORAL"]
"SoldierECrew" createunit [getmarkerpos "inf1",armor5,"c15=this",0.8,"PRIVATE"]
~2
c13 moveincommander _tank5
c14 moveingunner _tank5
c15 moveindriver _tank5
~1
armor5 move getmarkerpos "tankmove"
;-----------------------------------------------------------------------------
;End of tank's, beginning of Chopper(s)
;-----------------------------------------------------------------------------
_chop1 = "Mi24" createvehicle getmarkerpos "chop"
~2
"SoldierEPilot" createunit [getmarkerpos "chopcrew",air1,"p1=this",1,"CAPTAIN"]
"SoldierEPilot" createunit [getmarkerpos "chopcrew",air1,"p2=this",1,"LIEUTENANT"]
~2
p1 moveindriver _chop1
p2 moveingunner _chop1
~1
"OfficerE" createunit [getMarkerPos "chopcargo",east4,"s19=this",1,"LIEUTENANT"]
"SoldierEMG" createunit [getMarkerPos "chopcargo",east4,"s20=this",0.8,"SERGEANT"]
"SoldierEG" createunit [getMarkerPos "chopcargo",east4,"s21=this",0.7,"CORPORAL"]
"SoldierEG" createunit [getMarkerPos "chopcargo",east4,"s22=this",0.7,"CORPORAL"]
"SoldierELAW" createunit [getMarkerPos "chopcargo",east4,"s23=this",0.6,"PRIVATE"]
"SoldierEMedic" createunit [getMarkerPos "chopcargo",east4,"s24=this",0.6,"PRIVATE"]
~3
"_x moveincargo _chop1" foreach units east4
~2
p1 domove getmarkerpos "chopdrop"
_pad1 = "HeliHEmpty" createvehicle getmarkerpos "chopdrop"
;-----------------------------------------------------------------------------
@ Unitready p1
"unassignvehicle _x" foreach units east4
~30
east4 move getmarkerpos "inf1move"
p1 move getmarkerpos "chop"
@ Unitready p1
deletevehicle _chop1
~0.5
deletevehicle p1
deletevehicle p2
;----------------------------------------------------------------------------
exit

Sorry to paste such a large code but as you can see I wanted to know why just those "crew members" did not spawn and everything else did? I have gone over all the markers again, they are correct, the trigger actions the script ok, but my pilots and crew stubbornly refuse to appear.  ???

Boy will I be happy with a resolution to this.

Oh, I do intend to use this "mission" as MP only so I will appreciate thoughts on this.

Many regards from a complete noob.  ;)

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Spawn script error for me
« Reply #1 on: 21 Mar 2004, 19:07:19 »
Nothing seems to be wrong with the script. Try it like this. If the pilots didn't apear, type in the players init field air1 = group this. What this does is that it makes pilots be created in your own group. (check to make sure that you have less than 10 units in your group already). If the pilots don't apear on your group, then I don't know what the problem is.

The way createunit works is that it needs an already defined group name, before the units can be created. If you haven't defined the crew or pilot groups, the units will simply not be created. Thus, the above is to check that.
Not all is lost.

CrashnBurn

  • Guest
Re:Spawn script error for me
« Reply #2 on: 21 Mar 2004, 19:09:22 »
You MUST have group names in place at mission load in order to create units for them. You can give the group name to a tank thats already on the map, so that when it's destroyed you can recreate the tank and units, or, if you want the tank later in the mission, you can place a single soldier in the editor and give it the group name and delete it using its initialization line. example-
armor1 = group this; deletevehicle this
The soldier is not on the map at mission start because you deleted it, but the group name is valid and can be used to create units at anytime during the mission. If you give this "template" soldier a guard waypoint, all created units for that group will use the waypoint also. Other types of waypoints such as move and getin etc.. are completed at some point and disappear, but guard waypoints never complete and persist throughout the mission and can be very usefull for an ongoing battle.

Offline Ducatisto

  • Members
  • *
  • I'm a noob at this!
Re:Spawn script error for me
« Reply #3 on: 21 Mar 2004, 21:30:40 »
You MUST have group names in place at mission load in order to create units for them. You can give the group name to a tank thats already on the map, so that when it's destroyed you can recreate the tank and units, or, if you want the tank later in the mission, you can place a single soldier in the editor and give it the group name and delete it using its initialization line. example-
armor1 = group this; deletevehicle this
The soldier is not on the map at mission start because you deleted it, but the group name is valid and can be used to create units at anytime during the mission. If you give this "template" soldier a guard waypoint, all created units for that group will use the waypoint also. Other types of waypoints such as move and getin etc.. are completed at some point and disappear, but guard waypoints never complete and persist throughout the mission and can be very usefull for an ongoing battle.

Sorry I omitted to say that I followed those instructions as well, that is creating those units with: "whatever" = group this; deletevehicle this  in the init line.
This is why I am stumped. I was particular to recreate all of the details as per your test mission but my pilots and crew failed to appear.  ???
I will continue to beaver away at it and many thanks for your help with your replies.  :-*

Offline WizzyWig

  • Members
  • *
  • Mod Maker
    • Oblivion Promotions
Re:Spawn script error for me
« Reply #4 on: 21 Mar 2004, 22:30:49 »
this is the same problem i have with my tomahawk in multi it works fine in singal player but in multi it wont any help on this matter would be nice thanks

Code: [Select]
;;MAKE AI spawn and usable
_leader = LST1
_group = LST
;? !(local _leader): exit
_leaderpos = getpos _leader
_posX = _leaderpos select 0
_posY = _leaderpos select 1
_posZ = _leaderpos select 2

_rand = (random 20)
_leaderX = _posX+_rand
_leaderY = _posY+_rand

_posfinal = [_leaderX,_leaderY,_posZ]
;brackets



"SoldierWPilot" createunit [_posfinal,_group,"tmhwkpilot = this",1,"Private"]
_tmhwkpilot = tmhwkpilot
[_tmhwkpilot] join grpnull
~0.001
;END OF MAKE AI
_craft = "Tomahawkwiz" createVehicle getMarkerPos "Launch"
_craft setPos [(getPos _craft select 0),(getPos _craft select 1),(getPos _craft select 2)+0]
~0.001

;tmhwkpilot assignAsDriver _craft
_tmhwkpilot moveInDriver _craft

Offline Ducatisto

  • Members
  • *
  • I'm a noob at this!
Re:Spawn script error for me
« Reply #5 on: 21 Mar 2004, 22:32:48 »
SOLVED

Well I managed to kick start the rest by adding "duplicates" of the crews that refused to obey and adding "deletevehicle this" to their init lines. I don't know why the original way refused to operate correctly, but it works.  :D

This may seem cheeky but as I am at it how will I get all the troops and tanks to perform search and destroy once they get to their set markers? Would I have to add combat status to the script for every unit?

Thanks again.  :)