Jump to content
Eggitheegg

How to spawn a Bomb disabled

Recommended Posts

Hello I've started working on a small mission yesterday, but I've encountered one small thing that I couldn't resolve by myself or find anywhere how to do so. In my mission you get a task to pick up an Explosive Satchel. the problem is it spawns as enabled which means I can't pick it up, and it acts as if it was planted. Thank you for whoever sees this and decides to help.

Share this post


Link to post
Share on other sites

Place a game logic (F5 logic entities objects in editor)

In init field of this logic:

if (isServer) then {
  this spawn {
    private _wh = createVehicle ["weaponHolderSimulated_scripted",getpos _this,[],0,"can_collide"]; 
    _wh addMagazineCargoGlobal ["SatchelCharge_Remote_Mag",1]
  };
};

 

Note: If your player is "explosiveSpecialist" as trait, (player setUnitTrait "explosiveSpecialist") and has a ToolKit, he can dearm, then pick the satchel up.

  • Like 1

Share this post


Link to post
Share on other sites
13 hours ago, pierremgi said:

Place a game logic (F5 logic entities objects in editor)

In init field of this logic:


if (isServer) then {
  this spawn {
    private _wh = createVehicle ["weaponHolderSimulated_scripted",getpos _this,[],0,"can_collide"]; 
    _wh addMagazineCargoGlobal ["SatchelCharge_Remote_Mag",1]
  };
};

 

Note: If your player is "explosiveSpecialist" as trait, (player setUnitTrait "explosiveSpecialist") and has a ToolKit, he can dearm, then pick the satchel up.

Thank you! you're a real life saver! but can I ask one more thing? how do I make it spawn on an object? a Small Camping Table for example?

Share this post


Link to post
Share on other sites

The simplest:

name the camping table: yourTable


 

if (isServer) then {
  yourTable spawn {
    private _wh = createVehicle ["weaponHolderSimulated_scripted",getpos _this vectorAdd [0,0,1],[],0,"can_collide"];
    _wh addMagazineCargoGlobal ["SatchelCharge_Remote_Mag",1]
  };
};

 

 

Share this post


Link to post
Share on other sites
1 hour ago, pierremgi said:

The simplest:

name the camping table: yourTable


 


if (isServer) then {
  yourTable spawn {
    private _wh = createVehicle ["weaponHolderSimulated_scripted",getpos _this vectorAdd [0,0,1],[],0,"can_collide"];
    _wh addMagazineCargoGlobal ["SatchelCharge_Remote_Mag",1]
  };
};

 

 

When it spawns it just falls from the table in weird unnatural way, any idea why? and also can I use the setVehicleVarName command with this?

Share this post


Link to post
Share on other sites

Did you report the name of the table (as shown in example) inside of the script?

SetVehicleVarName??? what for?

 

Test also different values for vectorAdd. [0,0,1] means one meter above the position.

Share this post


Link to post
Share on other sites
42 minutes ago, pierremgi said:

Did you report the name of the table (as shown in example) inside of the script?

SetVehicleVarName??? what for?

 

Test also different values for vectorAdd. [0,0,1] means one meter above the position.

Yep the name of the table is the same it works, it does spawn on the table but it just doesn't stay on the table. and I want to use SetVehicleVarName to give the explosive a name (so I can make a task to pick it up). I'll try changing the values. Also excuse me if I seem a little bit noobish, its the first time I'm doing something like this. and again thanks for your help and patience!

Share this post


Link to post
Share on other sites

Your table is on uneven terrain. Try to make it level and play with the height as I wrote.

You can't really add a name on explosive satchel because it's a magazine (stringed) inside a weaponholder (object). What you can do is checking if a player has this kind of magazine in the inventory.

  • Like 1

Share this post


Link to post
Share on other sites
24 minutes ago, pierremgi said:

Your table is on uneven terrain. Try to make it level and play with the height as I wrote.

You can't really add a name on explosive satchel because it's a magazine (stringed) inside a weaponholder (object). What you can do is checking if a player has this kind of magazine in the inventory.

Oh I can do that? How? 

Share this post


Link to post
Share on other sites

- add a trigger close to the table (I don't know your scenario so I'll script for something working, not on what you could need exactly)

- set a small area like 10m radius

- trigger is anyPlayer present as preset condition, not repeatable

- on condition:   thisList findIf {"SatchelCharge_Remote_Mag" in magazines _x} > -1

- on activation: hint "you've got a satchel charge"

 


There are other solutions, without trigger, just event handler:

player addEventHandler ["take", {
  if (_this #2 isEqualTo "SatchelCharge_Remote_Mag") then {
    hint "you've got a satchel charge";
    player removeEventHandler ["take",_thisEventHandler];
  };
}];

 

 

  • Thanks 1

Share this post


Link to post
Share on other sites
33 minutes ago, pierremgi said:

- add a trigger close to the table (I don't know your scenario so I'll script for something working, not on what you could need exactly)

- set a small area like 10m radius

- trigger is anyPlayer present as preset condition, not repeatable

- on condition:   thisList findIf {"SatchelCharge_Remote_Mag" in magazines _x} > -1

- on activation: hint "you've got a satchel charge"

 


There are other solutions, without trigger, just event handler:


player addEventHandler ["take", {
  if (_this #2 isEqualTo "SatchelCharge_Remote_Mag") then {
    hint "you've got a satchel charge";
    player removeEventHandler ["take",_thisEventHandler];
  };
}];

 

 

Thank you! the trigger worked perfectly! you're a real life saver!

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

×