Jump to content
Marvinn2002

[HELP] Putting a script in a sector

Recommended Posts

Im creating a gamemode with sector controls and im using the SimpleShops to create money and shops.

I created every sector correctly and put variables in LocationArea, calling ZonaCap1, ZonaCap2, ZonaCap3,...


https://imgur.com/a/DSNHc

 

But now i tried to create the reward system with fuctions from SimpleShops:
 

Add or sub cash

[500,0] call HG_fnc_addOrSubCash; // Add 500 to cash
[500,1] call HG_fnc_addOrSubCash; // Sub 500 from cash
[500,0,1] call HG_fnc_addOrSubCash; // Add 500 to bank
[500,1,1] call HG_fnc_addOrSubCash; // Sub 500 from bank

And the system:

_sideZonaCap1 = side ZonaCap1;

if (_sideZonaCap1 == east) then{
     [700,0] call HG_fnc_addOrSubCash;
	 sleep 600.0;
};

When i start the server, the area pull out my trigger and just stay a marker on my map

I thinks the problem is the area of the sector...

Someone knows how to fix that??

 

 

Share this post


Link to post
Share on other sites

Hey @Marvinn2002 it is not 100% clear from your post on what you trying to do.

Do you want to add 700 to the side that captures a sector? If so what is the sleep 600 for? do you want the reward to repeat every 10 mins a side holds the sector?

 

When placing a sector there is a field in the editor called expression, when a side captures the sector the code in the expression is run passing the variables sector and side so this can be used to add cash when the sector is captured to the side that captures it.

Share this post


Link to post
Share on other sites

@Larrow
 

16 hours ago, Larrow said:

Do you want to add 700 to the side that captures a sector?

Yes.

16 hours ago, Larrow said:

If so what is the sleep 600 for? do you want the reward to repeat every 10 mins a side holds the sector?

sleep 600 is just for that.

16 hours ago, Larrow said:

 

When placing a sector there is a field in the editor called expression, when a side captures the sector the code in the expression is run passing the variables sector and side so this can be used to add cash when the sector is captured to the side that captures it.


I put this in expression:
 

[] execVM = "Recompensa2.sqf";

 

And this in "Recompensa2.sqf":
 

_private OwnerOfTheSector = ownerSide this;

if (playerSide == OwnerOfTheSector) then {
     [5000,00] call HG_fnc_addOrSubCash;
};

Its not working and my debug dont answer anything about that

Share this post


Link to post
Share on other sites
8 hours ago, Marvinn2002 said:

[] execVM = "Recompensa2.sqf";

should be

[] execvm "yourscript.sqf";

in your code you are telling it to set execvm to "recompensa2.sqf" but since execvm isn't a variable this is not possible. That should fix your problem with your script not running

Share this post


Link to post
Share on other sites

expression

_this execVM "Recompensa2.sqf"

Recompensa2.sqf

params[ "_sector", "_owner" ];

if !( _owner isEqualTo sideUnknown ) then {
	[5000,0] remoteExec [ "HG_fnc_addOrSubCash", _owner ];
};

Think from memory that's correct that the expression is handled server side, i'll test later and update if its not the case

Share this post


Link to post
Share on other sites
14 hours ago, Squirtman said:

should be


[] execvm "yourscript.sqf";

in your code you are telling it to set execvm to "recompensa2.sqf" but since execvm isn't a variable this is not possible. That should fix your problem with your script not running

I tried the help from Larrow and worked, but thanks for helping me

Share this post


Link to post
Share on other sites
On ‎20‎/‎03‎/‎2018 at 11:08 AM, Larrow said:

expression


_this execVM "Recompensa2.sqf"

Recompensa2.sqf


params[ "_sector", "_owner" ];

if !( _owner isEqualTo sideUnknown ) then {
	[5000,0] remoteExec [ "HG_fnc_addOrSubCash", _owner ];
};

Think from memory that's correct that the expression is handled server side, i'll test later and update if its not the case

Works fine in Editor, but when i put the mission on my Dedicated Server, dont works, you can do a code for this? I dont know how to do that.

Share this post


Link to post
Share on other sites

Already works as posted. The sector expression is run from the server and the function is remoteExec for all units of the captured side.

Test_Mission two sides, one sector, that when captured systemChats units of the owning side and that the message originated from the server.

  • Like 1

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

×