OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: WimpBastard on 10 Apr 2005, 08:07:13

Title: Script not working after respawn
Post by: WimpBastard on 10 Apr 2005, 08:07:13
I'm making a mission based off the movie Predator, one guy hunts down everyone else with the help of the optical camo.

One of the SF guys is a minigunner and i made a quick script so he could replenish his ammo.
Code: [Select]
minigunner addmagazine "hh_minigun"
minigunner addmagazine "hh_minigun"
minigunner addmagazine "hh_minigun"
minigunner addmagazine "hh_minigun"
minigunner addmagazine "hh_minigun"
minigunner selectweapon "hh_minigun"

and in the init.sqs
Code: [Select]
minigunner addaction ["MORE AMMO!!!!", "moreammo.sqs"]
That works, he can run around, spray bullets everywhere and when he runs out he can hit MORE AMMO!! and he gets a whole new set of minigun mags. If he gets shot though and respawns, the MORE AMMO!!! script doesnt work anymore, it does work on the minigunners corpse though.

How do i make my script apply to the newly respawned minigunner?
Title: Re:Script not working after respawn
Post by: StonedSoldier on 10 Apr 2005, 12:28:56
i guess since your using an addaction the minigunner must be a player so why not
use player instead of minigunner
Title: Re:Script not working after respawn
Post by: Speeder on 20 Apr 2005, 10:29:43
The unit name - Minigunner does no longer exist when the unit dies. You must use the Player variable instead, as it will allways be the same as long as the game is only played by 1 person. When Multiplaying the Player Variable will be different on each machine as all playing humans has an active player variable on their local machine.

otherwise you could use a  trigger to make List over all units on one side, and then for each of those units give him the action More Ammo. But then requires that alle units has the same weapon.