Hello All
This is a general query about a subject that is starting to really bug me.
I am working on a number of missions that use some complex scripting - no probs there, but some of the commands just simply aren't being actioned when they're supposed to.
The most annoying example is my player respawn script. I have set respawn to Group and have a script running on the character that does the following -
; Equip player with standard weapons and equipment
# spawnRoutine
removeallweapons _player
_player addmagazine "RevolverMag"
_player addmagazine "RevolverMag"
_player addmagazine "RevolverMag"
_player addweapon "Revolver"
_player addweapon "Binocular"
_player addweapon "NVGoggles"
; Wait until player is dead
@!alive _player
; Reduce casualty limit. If casualty limit reached then show lives remaining
casualtyLimit = casualtyLimit - 1
publicVariable "casualtyLimit"
? casualtyLimit < 1 : titleText ["The last remaining black ops have been rounded up and shot by the occupying forces", "Plain"], endTrigger setpos (getpos _player)
; Create new group member at first base, equip with standard weapons and equipment
_newMan = "SoldierWSaboteurPipe" createUnit [getPos player, group _this]
removeallweapons _newMan
_newMan addmagazine "RevolverMag"
_newMan addmagazine "RevolverMag"
_newMan addmagazine "RevolverMag"
_newMan addweapon "Revolver"
_newMan addweapon "Binocular"
_newMan addweapon "NVGoggles"
; Notify number of lives remaining, wait for respawn
hint format ["There are now only %1 other black ops left on the island", casualtyLimit]
@alive _player
goto "spawnRoutine"
The problem is that the new character is not being re-armed - he keeps starting with the equipment that he is listed to start with ! Why isn't the re-arm bit being actioned ?
My guess is that it's because the assignment "_newman = . . . " is not being actioned, which makes the rest useless. To confirm this i changed the createUnit to a camCreate and a join - when I did that the re-arm part worked but for some reason the join command didn't, no matter what syntax I use (eg [_newMan] join _this, [newMan] join group _this, [newMan] join leader group _this etc.
I tried testing this using a short test mission with another unit called "kenneth" whose init field contained the command "[kenneth] join captain" and it worked no problems. BTW - Captain is the leader of the group with the player in it.
One last example - I have written an RDF script - it basically uses radio calls Alpha to Foxtrot to give the player find the bearing and rough distance to the nearest unt of a specified type (eg friendly black ops, enemy chopper, enemy officer etc).
Again - the script is failing because a key command is not being actioned (in this case - "_nearestTarget = nearestObject [_caller, _targetObject]"). I know that this is the key bit that fails because I have dissected it a million ways and have isolated this one part. Simpy put - this part fails, which makes _nearestTarget a null object, which screws the rest.
Has anyone seen this before or know why this is happening ? I am using version 1.96 with all intermediate patches installed, using a commercially purchased original of both OFP and OFP-R. The mission sqm is pretty big - it' now up to 96k, but I have tried out the subscripts on another small test mission and got the same results.
All up I have about a dozen scripts running in the mission using around 20-30 variables - nothing too flash and AFAIK not too tough a load for my 2 gig laptop with 708mB of RAM and onboard graphics.
Anyone ?
Thanking all in advance . . .
Roni