Home   Help Search Login Register  

Author Topic: I'm Missing something here? But I don't know what.  (Read 1796 times)

0 Members and 2 Guests are viewing this topic.

Offline Landdon

  • Members
  • *
I'm Missing something here? But I don't know what.
« on: 26 Jun 2007, 08:48:57 »
Code: [Select]
[Pilot, Wreck] exec "MovePilot.sqs";
This is the MovePilot.sqs Code

Code: [Select]
;;This Moves the declared Pilot to it's new location,
;; [this] exec "MovePilot.sqs"
;; Requires 30 objects to be placed on the island named (Crashsite1, Crashsite2...Crashsite7)
;; Original Script Written by Strango
;; Only execute on Server, requires gamelogic named server in mission
?!(local Server): exit

;; Variables
_vcl = _this select 1

_man = _this select 0

;; Distance wreck is moved from the Downed Pilot
_Distance = 25

;; Height of Wreck
_Height = 4

;; ***************************************************************************************************
;; Move Downed Pilot
;; ***************************************************************************************************
_randnum = Random 7

;; Hint format ["random is : %1",_randnum]

? (_randnum >= 0) AND (_randnum < 1): goto "R0"
? (_randnum >= 1) AND (_randnum < 2): goto "R1"
? (_randnum >= 2) AND (_randnum < 3): goto "R2"
? (_randnum >= 3) AND (_randnum < 4): goto "R3"
? (_randnum >= 4) AND (_randnum < 5): goto "R4"
? (_randnum >= 5) AND (_randnum < 6): goto "R5"
? (_randnum >= 6) AND (_randnum < 7): goto "R6"


#R0
_vcl SetPos (GetPos Crashsite1); _vcl setdir (Getdir Crashsite1); goto "end";

#R1
_vcl SetPos (GetPos Crashsite2); _vcl setdir (Getdir Crashsite2); goto "end";

#R2
_vcl SetPos (GetPos Crashsite3); _vcl setdir (Getdir Crashsite3); goto "end";

#R3
_vcl SetPos (GetPos Crashsite4); _vcl setdir (Getdir Crashsite4); goto "end";

#R4
_vcl SetPos (GetPos Crashsite5); _vcl setdir (Getdir Crashsite5); goto "end";

#R5
_vcl SetPos (GetPos Crashsite6); _vcl setdir (Getdir Crashsite6); goto "end";

#R6
_vcl SetPos (GetPos Crashsite7); _vcl setdir (Getdir Crashsite7); goto "end";

#end

;; ***************************************************************************************************
;; Move Wreckage
;; ***************************************************************************************************
#B1
;; Get Random Distances of Wreckage from Gamelogic
;; ***************************************************************************************************
;; Get Random Distance Horizontal
_RandX = Random _Distance

;; Get Random Distance Vertical
_RandY = Random _Distance

;; Calculate real distance based on 90 degree angle
_A = _RandX^2 + _RandY^2
_B = sqrt _A

;; If Distance is within 1 meter of Set Distance proceed, if not repeat
? (_B > (_Distance-1)) AND (_B <= _Distance): goto "Mid1"
goto "B1"

;; ***************************************************************************************************
#Mid1
;; Determine Random Bearing of Wreckage to Gamelogic (1 of 4 quadrants)
;; ***************************************************************************************************
_Select = Random 4
? (_Select >= 0) AND (_Select < 1): goto "B1A"
? (_Select >= 1) AND (_Select < 2): goto "B1B"
? (_Select >= 2) AND (_Select < 3): goto "B1C"
? (_Select >= 3) AND (_Select < 4): goto "B1D"
;; ***************************************************************************************************
;; North East Quadrant
#B1A
_vcl setpos[(getpos _vcl select 0)+_RandX,(getpos _vcl select 1)+_RandY,_Height]
goto "B2"

;; ***************************************************************************************************
;; South East Quadrant
#B1B
_vcl setpos[(getpos _vcl select 0)+_RandX,(getpos _vcl select 1)-_RandY,_Height]
goto "B2"

;; ***************************************************************************************************
;; North West Quadrant
#B1C
_vcl setpos[(getpos _vcl select 0)-_RandX,(getpos _vcl select 1)+_RandY,_Height]
goto "B2"

;; ***************************************************************************************************
;; South West Quadrant
#B1D
_vcl setpos[(getpos _vcl select 0)-_RandX,(getpos _vcl select 1)-_RandY,_Height]
goto "B2"


#B2
;;Move Marker Location of Wreck Site to new location
;;"WS" SetMarkerPos (GetPos _vcl)

;;WreckMoved=1; publicvariable "WreckMoved"

;;Remove crewman from present group and put him in Pilot seat, then kill him
[Crewman] join grpNull
Crewman MoveinDriver Wreck
Crewman SetDammage 1

;;Move Pilot into gunners seat
_man MoveInGunner Wreck
Wreck SetDammage .5
Wreck setfuel 0

exit


This is the move Wreck Script.

Code: [Select]
;; This moves the plane wreckage to the newly placed Pilot
;; This function is called at the end of MovePilot.sqs           
;; in the format of [WreckName] exec "MoveWreck.sqs"
;; Orginally written by Strango

;; Only execute on Server, requires gamelogic named server in mission
?!(local Server): exit


;;Variables
;; Name of Downed Pilot
_vcl = Pilot;

;; Wreck's Name as read in from function param
_Wreck = _this select 0

;; Distance wreck is moved from the Downed Pilot
_Distance = 25

;; Height of Wreck
_Height = 4



;; ***************************************************************************************************
;; Move Wreckage
;; ***************************************************************************************************
#B1
;; Get Random Distances of Wreckage from Downed Pilot
;; ***************************************************************************************************
;; Get Random Distance Horizontal
_RandX = Random _Distance

;; Get Random Distance Vertical
_RandY = Random _Distance

;; Calculate real distance based on 90 degree angle
_A = _RandX^2 + _RandY^2
_B = sqrt _A

;; If Distance is within 1 meter of Set Distance proceed, if not repeat
? (_B > (_Distance-1)) AND (_B <= _Distance): goto "Mid1"
goto "B1"

;; ***************************************************************************************************
#Mid1
;; Determine Random Bearing of Wreckage to Downed Pilot (1 of 4 quadrants)
;; ***************************************************************************************************
_Select = Random 4
? (_Select >= 0) AND (_Select < 1): goto "B1A"
? (_Select >= 1) AND (_Select < 2): goto "B1B"
? (_Select >= 2) AND (_Select < 3): goto "B1C"
? (_Select >= 3) AND (_Select < 4): goto "B1D"
;; ***************************************************************************************************
;; North East Quadrant
#B1A
_Wreck setpos[(getpos _vcl select 0)+_RandX,(getpos _vcl select 1)+_RandY,_Height]
goto "B2"

;; ***************************************************************************************************
;; South East Quadrant
#B1B
_Wreck setpos[(getpos _vcl select 0)+_RandX,(getpos _vcl select 1)-_RandY,_Height]
goto "B2"

;; ***************************************************************************************************
;; North West Quadrant
#B1C
_Wreck setpos[(getpos _vcl select 0)-_RandX,(getpos _vcl select 1)+_RandY,_Height]
goto "B2"

;; ***************************************************************************************************
;; South West Quadrant
#B1D
_Wreck setpos[(getpos _vcl select 0)-_RandX,(getpos _vcl select 1)-_RandY,_Height]
goto "B2"

;; (getpos _vcl select 2)+_Height
#B2
;; Move Marker Location of Wreck Site to new location
"WS" SetMarkerPos (GetPos _Wreck)
WreckMoved=1; publicvariable "WreckMoved"


;;Function Call to give orders to Enemy Squad assigned to secure Wreck Site
[_Wreck] exec "MoveSquad-Wreck.sqs"

;;Function Call to give orders to Enemy Squad(s) assigned to patrol the wreck site
;;[E_PS1, _Wreck, 500] exec "PatrolSquad-Wreck.sqs"
;;[E_PS2, _Wreck, 1000] exec "PatrolSquad-Wreck.sqs"



[Crewman] join grpNull
Crewman MoveinDriver Wreck
crewman action ["Engine On",Wreck]
Wreck flyinheight 1

Pilot MoveInGunner Wreck
_Wreck setpos[(getpos _Wreck select 0),(getpos _Wreck select 1),(getpos _vcl select 2)-_Height]
@(GetDammage Wreck)>0
Crewman SetDammage 1
Wreck SetDammage .5
Wreck setfuel 0
exit



What did I do wrong?  Did I overlook something simple, or is it all wrong?  Why does it work for me, but not for someone else?  I need to get it to work on a regular dedicated server, any suggestions?  As always any assistance will be greatly appreciated. 

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: I'm Missing something here? But I don't know what.
« Reply #1 on: 26 Jun 2007, 15:31:11 »
Put [Pilot, Wreck] exec "MovePilot.sqs" in your init.sqs instead of a unit init field.
urp!

Offline Landdon

  • Members
  • *
Re: I'm Missing something here? But I don't know what.
« Reply #2 on: 26 Jun 2007, 19:42:26 »
It is in the Ini.sqs file. :confused: I have attached the files below.  Could it be in conflict with another script?  ???  This makes my head hurt, please tell it will get better!!! :weeping:  I don't have any hair left! LOL
« Last Edit: 20 Aug 2009, 17:22:08 by hoz »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: I'm Missing something here? But I don't know what.
« Reply #3 on: 26 Jun 2007, 23:35:01 »
Your init.sqf is a weird mixture  :D

Seems you did a copy/paste of mando_remote.intro init.sqs there, so you have SQF code and SQS code in an SQF script.

To add there that AFAIK, setPos of static objects (downed chopper) needs to be executed in every client, setPos only populates the position if you use it with vehicles.

Offline ViperMaul

  • Members
  • *
    • Theatre Of War (Team PvP Campaign)
Re: I'm Missing something here? But I don't know what.
« Reply #4 on: 03 Jul 2007, 20:38:54 »
Landdon,

As of 1.08 there has been a change in setPos for static objects.
Feel free to read Suma's comments. It should work globally now for MP with static objects.
0002166: setPos doesn't work with static objects in MP
ViperMaul
Theatre of War (Co-Lead Dev)
ACE (Jr Project Manager)