Forum Jump :

Author Message


Posts: 44
Rank:


Level: Member

Country: nz
Location:
Occupation:
Age: 46
In-game name:

 
#1 Posted at 2009-08-07 11:24        
     
I have two different triggers set near a door of a house, it has addaction to load a script vip1
Plays a sound, and then creates a unit which sprawns near you and automatically joins your group.
It works, but for some reason it creates the same unit that the other script created.
eg. If i go to vip2 trigger first and create that unit, then go to vip1 i have two identical "madam5" units. Instead of Sportsman and Madam5. If i go to vip1 trigger first then vip2 its the other way around two itentical "sportswoman" units.
This is for a MP VIP game im making. Why am im getting a clone instead of the unit its suppose to create?

vip1:

playSound "knocking_door";
_group = group player;
vpciv1 = _group createUnit ["sportswoman1", getpos player, [], 0, "form"];

hint "First VIP found.";

vip2:

playSound "knocking_door";
_group = group player;
vpciv2= _group createUnit ["madam5", getpos player, [], 0, "form"];

hint "Second VIP found.";


Author Message


Posts: 20732
Rank:


Level: Super Admin

Country: nl
Location: The Netherlands
Occupation:
Age: 45
In-game name: Foxhound

 
#2 Posted at 2009-08-07 14:31        
     
Maybe I am getting just rusty, but aren't you simply using the createUnit command wrong?

"SoldierWB" createUnit [position player, group player]

Compare that to yours.


Advertisement


Author Message


Posts: 44
Rank:


Level: Member

Country: nz
Location:
Occupation:
Age: 46
In-game name:

 
#3 Posted at 2009-08-07 21:23        
     
Thanks foxhound for your reply.

I changed it accordingly:

playSound "knocking_door";
_group = group player;
//vpciv1 = _group createUnit ["sportswoman1", getpos player, [], 0, "form"];
"Sportswoman1" creatunit [getpos player, _group]
hint "First VIP found.";

Now it doesnt work at all. Unit isnt being created. I dont know why...?

(That other code line i was using i found on another thread somewhere i this forum. Also another reason i wanted to use it was to be able to assign a name to the created unit.)

**Update**

Problem Solved! :D

Using the original line i had:
vpciv1 = _group createUnit ["sportswoman1", getpos player, [], 0, "form"];

Problem was...in both of the addaction triggers i was using identical "text"
..... addaction ["Knock on door","thescriptname.sqf"];

It turns out that the addaction menu text to show player cant be exactly same for another one. So trying different things i stumbled on to the answer by just changing the other text to "Knock" and that did the trick. I think even though trigger2 had a different script to call, the two were being merged and thus creating the same unit.

This post was edited by Daz_kiwi (2009-08-07 22:18, ago)