Jump to content
DPM

Change trigger to presence activation

Recommended Posts

I'm trying to change the activation of triggers from number based to presence based. The triggers are spawning in ammo boxes and look like this.....

 

hQKwenB.jpg

 

They use this code from the initserver.sqf for the condition....

(The case numbers are start postions)

 

klGPTTf.jpg

 

...and call this code also from the initserver.sqf to spawn the boxes...

 

LootSpawnRandomizer = {
if (isServer) then {
_LStrigger = _this select 0;
{   
_checkType = typeOf _x;  
_resultPump = _checkType find "_pump";  
_resultKiosk = _checkType find "Land_Kiosk";  
_resultTransformer = _checkType find "Land_spp_Transformer";   
_resultPier = _checkType find "Land_Pier";
_lootPlaces = _x buildingPos -1;   
if (count _lootPlaces > 0) then {   
 
if ((_resultPump != 0) && (_resultKiosk != 0)&&(_resultTransformer != 0) && (_resultPier != 0)) then {  
 
{_amishouldSpawn = floor random (5); if(_amishouldSpawn == 0) then {0 = [_x] call myfuncLS;}}foreach _lootPlaces;   
};  
};  
}foreach (_LStrigger nearObjects ["house", 300]);
};
};

 

Does anybody know how to get it to ignore the LStriggers and just use presence instead? as any changes I make to the LootSPawnRandomizer where they're mentioned just breaks the mechanic, I presume I need to change part of the "on activation" code in the trigger also...

(needs to trigger on anybody including AI, just once)

O7GGhow.jpg

Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites

Should work without changing the on act. You're still using thisTrigger, that's fine for your code. Verify, your area is still defined (size 300,300).
Anybody is a little bit weird, using this condition, because any agent (animal) fires the trigger! HORRIBLE!

Test with any player or:

play with anybody and the condition field:   thisList findIf {driver _x isKindOf "CAManBase"} > -1

Share this post


Link to post
Share on other sites

Thanks for the reply pierremgi, after a ton of testing I realized I was getting some repeatable positive results with what you had suggested. Not great results, but positive, I was possibly getting the same results before but thought it just wasn't working because I was looking elsewhere.

With Any player, the first trigger I entered would often fire and the base trigger (0) and trigger _1 would always fire.
With anybody, it seemed to be just the base trigger and _1.
With civilian (what the payable units and enemy AI are) the base trigger and _1 fired for AI.

It's tricky testing the AI as the mission has a random start so if they don't go into the base and _1 nothing happens.

 

Is there anything in the code that would suggest why the first two triggers are the only triggers that consistently fire as all the other triggers seem to be fine and in order?

Share this post


Link to post
Share on other sites

What do you intend to do exactly? What are the conditions you need for triggers?

Share this post


Link to post
Share on other sites

When a player or AI enters a trigger it runs the Lootspawnrandomizer, which spawns ammo crates in buildings filled with a selection of items from another script. It has to be crates because the AI have their own script to loot from them. It's not my mission, it's a BR style mission for small groups to play that adds in AI to fill out the numbers. The original author made it for SP and 5 player local host coop but has since vanished. I've been adapting it for up to 30 players on dedicated and have been getting away with ''wingin it'' up to this point as my scripting skills consists of whacking it with a hammer until it hopefully works. The loot system works fine, it just needs to run on presence rather than those LStriggers as they're connected to the start point (certain starts only spawn certain LS triggers) so it leaves areas with no loot at all when people spread out or the play area moves away from the start point in later rounds.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×