Welcome to the Iron Front Fan Forums!
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
santiagojamesaea

Sergeant
Registered:
Posts: 106
Reply with quote  #1 
Hi all,

Some time ago i posted here on how to make an ammo box spawn when a vehicle passed over/through a certain waypoint.The idea was to fight your way through the first "objective" and then have a jeep or such drive up and "drop off" an ammo crate so you could reload before continuing.The jeep would leave at high speed-obviously afraid of randomly falling shells or such like.

Ok, i got that to work just fine placing a marker called

marker1

a trigger with this in it's act.line

flare1 = "LIB_BasicAmmunitionBox_SU" createVehicle [(getmarkerpos "marker1" select 0),(getMarkerpos "marker1" select 1), 1];

But as ever i wanted to modify it...what i want to do is to have a CUSTOM ammo crate dropped off,with me selecting the ítems inside.I HAVE been able to make my own ammocrate.sqf file(oksman video and Arma Edit there) with the ítems inside  i want and it Works just fine,(i do try before asking)but what i seem unable to do is make the trigger "drop off" the ammo crate i have created.
Has anyone any ideas?

After various attempts the best one i came up with was this;

flare1 = "LIB_BasicAmmunitionBox_SU" createVehicle [(getmarkerpos "marker1" select 0),(getMarkerpos "marker1" select 1), 1]; gear = [this] execVM "ammocrate.sqf";
 
But no joy..can anyone push me in the right direction!

Cheers

I know the script starts off with "flare1" but that's because i was modifying a "spawn" script i had used before!
0
BRS

Captain
Registered:
Posts: 195
Reply with quote  #2 
Quote:
i seem unable to do is make the trigger "drop off" the ammo crate i have created.

Could you explain this a little, I have problems to understand well.
Do you mean that there is no ammo crate dropped at all, or is an ammo crate dropped but it comes not with the custom content?
In last case I would suggest that you use the 'name' of your custom crate -flare1- or what ever you call it now
and replace [this] by [whatevername] execVM "ammocrate.sqf";

0
santiagojamesaea

Sergeant
Registered:
Posts: 106
Reply with quote  #3 
ok,
sorry BS for being vague,

The Ammo crate is dropped off it's just not the custom one!!

I'm sorry but i don't understand the rest.I actually don't know what "flare1"does,i just copied it from when i was spawning flares from a trigger(eye Candy actually)and used it to spawn the ammo crate.There is nothing on the map named as flare1.

My sqf file is very basic and is called ammocrate.sqf;


_crate = _thisselect 0;

_crate addMagazineCargo ["lib_71Rnd_762x25", 10];

_crate addMagazineCargo ["lib_rpg6 ", 10];

_crate addMagazineCargo ["LIB_1Rnd_RPzB", 04];

I can get it to drop off the standard russian ammo box no problema but i don't know how to make work for the custom one.I DON'T have the custom one on the map,is this where i'm going wrong?

thanks

0
BRS

Captain
Registered:
Posts: 195
Reply with quote  #4 
if you do something like:
ammo_box ="LIB_BasicAmmunitionBox_SU" createVehicle [ _pos_to_place select 0, (_pos_to_place select 1), (_pos_to_place select 2)];

so ammo_box is the 'name' of the thing you spawned by above code.
This name you can use for further actions now:
[ammo_box] execVM "ammobox.sqf";


So in your case, if you spawn your sov ammo crate by:
myCrate = "LIB_BasicAmmunitionBox_SU" createVehicle [(getmarkerpos "marker1" select 0),(getMarkerpos "marker1" select 1), 1];

you can call your custom sqf code to fill this box with your inventory by:
gear = [myCrate] execVM "ammocrate.sqf";


If your sqf code do not return any value (I think so), you should better write:
nul = [myCrate] execVM "ammocrate.sqf";


hope this will be all to solve your problem. Let me know.


Quote:
I DON'T have the custom one on the map,is this where i'm going wrong?

You don't need the crate on the map, it's correct spawning it like you did.
0
santiagojamesaea

Sergeant
Registered:
Posts: 106
Reply with quote  #5 
  • Hi there BS i think i understood some of that...

    The only thing is you gave a lot of "codes",but where do i put them?

    I'm really sorry for not picking this up quicker.

    thanks

    It's the first two lines and the last line which i don't really understand,or at least it seems that way at the moment!


    ok,(i'm editing my post)

    Do you want me to start from;

    "So in your case, if you spawn your sov ammo crate by:" and follow your instuctions from there,if this is so where do i write the last line?(i take it i have to add it to my sqf file)
  • last line;"nul = [myCrate] execVM "ammocrate.sqf";"
0
BRS

Captain
Registered:
Posts: 195
Reply with quote  #6 
hm, I hope I make not too complicated now.

These first two code lines are just thought as example.
The following two lines (3+4) are your own ones, I just added 'myCrate' in front.
This is a name of a variable used by the engine. You can name it different if you want.
This variable will take the value which is returned by the used 'createVehicle' function. Now you can use this variable (which contains info about your spawned crate) to go ahead. (i.e. start your sqf script.)
Quote:
but where do i put them?

Let the code lines where they are.
I assume that you placed this into your trigger:
flare1 = "LIB_BasicAmmunitionBox_SU" createVehicle [(getmarkerpos "marker1" select 0),(getMarkerpos "marker1" select 1), 1]; gear = [this] execVM "ammocrate.sqf";


So what I wanted to show by the line 3 + 4 is,
that you just need to change the things in shown there in red.
Replace flare1 with myCrate and
[this] with [myCrate] and it should work.

Forget about the last line for now. If you want we could talk about that again if the main problem, your custom filled ammo box, is working. Ok?


Saw it too late:
Quote:
(i take it i have to add it to my sqf file)

No, you don't need to change anything in that sqf file.
Let me explain: You call your sqf file like this here:
gear = [this] execVM "ammocrate.sqf";
Remember what I wrote above:
if you call a function (script) it may return something if it finished it's run.
Above it was the 'information' about your spawned ammo box.

So if your function would return a value this will go into a variable which you named gear in your code line above. This variable will be useless if you don't return something from your sqf file. That was what I ment, if you don't return something you could delete gear = and just call your sqf by
[myCrate] execVM "ammocrate.sqf"; or write nul= which will tell the game engine that your sqf will not return anything.
As I said before, forget this line for the moment :)



0
santiagojamesaea

Sergeant
Registered:
Posts: 106
Reply with quote  #7 
ok,i'm going to try this out now.

Thanks for being so patient.
0
santiagojamesaea

Sergeant
Registered:
Posts: 106
Reply with quote  #8 
Ok,

I've just been checking it and at first i thought it wasn't working,it is,(thank you),BUT what it is doing is adding what i have put in my ammocrate sqf TO the standard Russian Ammo box.
What i was trying to do was to JUST have what i had put into the ammocrate sqf file. Let me explain,have a standard Russian Ammo Box-Empty- EXCEPT for what i had written in my SQF file.What i'm getting is a standard russian ammo box PLUS what i have written in my sqf file!! :(  Sorry if i've been vague again,but i thought it would JUST take what was written in the SQF file ;i've just tried;

clearMagazineCargo this; clearWeaponCargo this;myCrate = "LIB_BasicAmmunitionBox_SU" createVehicle [(getmarkerpos "marker1" select 0),(getMarkerpos "marker1" select 1), 1];gear = [myCrate] execVM "ammocrate.sqf";

But no joy!

Could you help with this?
And thanks for what you've already done!
0
BRS

Captain
Registered:
Posts: 195
Reply with quote  #9 
Fine that it is working now.

clearMagazineCargo this; clearWeaponCargo this;myCrate = "LIB_BasicAmmunitionBox_SU" createVehicle [(getmarkerpos "marker1" select 0),(getMarkerpos "marker1" select 1), 1];gear = [myCrate] execVM "ammocrate.sqf"

This will not work, the first two parts are wrong. Maybe you could write it this way:
myCrate = "LIB_BasicAmmunitionBox_SU" createVehicle [(getmarkerpos "marker1" select 0),(getMarkerpos "marker1" select 1), 1];  clearWeaponCargo myCrateclearMagazineCargo myCrate; gear = [myCrate] execVM "ammocrate.sqf";

This way both functions will know which crate you mean ( by -> myCrate).

But I would suggest that you change your sqf. I don't know the complete content of your script, so I can just write a segment.
It could look like this inside your ammocrate.sqf:

private ["_crate"]; 

_crate = _this select 0;

 // Clear box
clearWeaponCargo _crate;
clearMagazineCargo _crate;

// Fill box now

//(your code from post before)

_crate addMagazineCargo ["lib_71Rnd_762x25", 10];

_crate addMagazineCargo ["lib_rpg6 ", 10];

_crate addMagazineCargo ["LIB_1Rnd_RPzB", 04];


Then you can use this line to call:
Quote:
myCrate = "LIB_BasicAmmunitionBox_SU" createVehicle [(getmarkerpos "marker1" select 0),(getMarkerpos "marker1" select 1), 1];gear = [myCrate] execVM "ammocrate.sqf";


Both ways should work. Use the way which is easier for you to understand.
0
santiagojamesaea

Sergeant
Registered:
Posts: 106
Reply with quote  #10 
Unbeleivable!!!

It worked first time! Sorry for the delay but i had a problem with my Internet connection.

I really thought i was  close to  doing it on my own...but i wasn't.Thank you VERY much,it sounds silly but for me it's small things like this that really add flavour and colour to the game.

Thanks again,You've explained it so well anyone else can read this and do it too!!

All the best!

:) :) :)
0
BRS

Captain
Registered:
Posts: 195
Reply with quote  #11 
No Problem, glad I could help in this case.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.