OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Flauta on 16 Jun 2005, 18:34:41
-
There is a Way tho change the side during gameplay? I mean, not the Resistance "allied whit.." thing, In mi Mission there is a Western pilot, and I want him to turn Easter when a trigger is hit or something.... Could be done???
waiting 4 ideas!
(and forget mi english)
-
no and yes ;)
no, you can't change the side of the same loon.
yes, you could get rid of the pilot, and in the same moment setpos an east pilot who looks the same into his place.
-
wow!
nice IDEA! :D I will be testing it now... but how U will do the script?
-
west pilot, named spy2, grouped with an east colonel whose 'probablility of presence' is 0. this will make 'spy2' east. place them away on an island someplace.
west pilot, named spy, just west, wherever he needs to be. in your trigger to swap them, [] exec "swap_pilots.sqs", as below:
_x = getpos spy1 select 0
_y = getpos spy1 select 1
_dir = getdir spy1
spy1 setpos [0,0,0]
spy2 setdir _dir
spy2 setpos [_x,_y]
exit
you may also wish to make sure that the combat mode of both pilots is the same, and that they have the same weapons.... first thing i did when i rescued the pilot is give him a gun ;)
-
You can just group the west pilot with an east officer and he will change sides .:
westPilot join group easttOfficer
This will do the job.
-
this is my mod of the Bedge's Script... (the Pilot was on the player group)
_x = getpos spy1 select 0
_y = getpos spy1 select 1
_dir = getdir spy1
_wep = weapons spy1
_mag = magazines spy1
_dam = damage spy1
removeallweapons(spy2)
[spy1] joingroup "null"
#mags
? (count _mag) == 0 : goto "wep"
_i = _mag select 0
spy2 addmagazine _i
_mag = _mag - _i
goto "mags"
#wep
? (count _wep) == 0 : goto "done"
_i2 = _wep select 0
spy2 addweapon _i2
_wep = _wep - _i2
goto "wep"
#done
spy2 setdammage (_dam)
spy1 setpos [0,0,0]
spy2 setdir _dir
spy2 setpos [_x,_y]
exit
But it is surely Wrong.. I havn't tested it yet..
there is a Way to delete a element of an array whitout knowing the order? like i have tried to do on the "_mag = _mag - _i" thing... becuase [stringA, stringB,stringC,stringD,stringA] - [stringA,stringC] == [stringB,stringD].. but DK if [stringB,stringD] - stringB == [stringD]..
-
Just use the "join" command its much simpler .....
-
hmmm, instead of taking away from the array, i would do it like this -
_x = getpos spy1 select 0
_y = getpos spy1 select 1
_dir = getdir spy1
_wep = weapons spy1
_numweps = count _wep
_mag = magazines spy1
_totalmags = count _mag
_dam = damage spy1
removeallweapons spy2
[spy1] join grpnull
? _totalmags == 0 : goto "wep"
_i = 0
#mags
spy2 addmagazine (magazines spy1 select _i)
_i = _i + 1
?not (_i>_totalmags):goto "mags"
? _numweps == 0 : goto "done"
_i = 0
#wep
spy2 addweapon (weapons spy1 select _i)
_i = _i + 1
?not (_i>_numweps):goto "wep"
#done
spy2 setdammage _dam
spy1 setpos [0,0,0]
spy2 setpos [_x,_y]
spy2 setdir _dir
spy2 dowatch [_x + (10*sin(_dir)), _y + (10*cos(_dir)), 1.4]
exit
that starts at weapon/magazine 0 and goes through them one after the other adding each to the other spy.
-
Thanks a lot!!!
I`ll be testing it!