Jump to content
Sign in to follow this  
fackstah

Territory Capture script with money

Recommended Posts

in the mission i have been working on there are areas that can be captured with seized by side trigger after 5 minutes and it Exec's a script

The script i am using is :

if(str(playerSide) in ["WEST"]) then player setVariable["cmoney", (player getVariable "cmoney")+200,true];
hint format["You got 200$ for capturing the territory!"];

I also tried :

if(str(playerSide) == "WEST") then player setVariable["cmoney", (player getVariable "cmoney")+200,true];
hint format["You got 200$ for capturing the territory!"];

but i seem to be having trouble getting it to work as now it does not give money at all

Originally i had

player setVariable["cmoney", (player getVariable "cmoney")+200,true];
hint format["You got 200$ for capturing the territory!"];

but that gave it to everyone in the map

anyone have any ideas of how to fix this ?

Cheers,

Roman

Share this post


Link to post
Share on other sites

if () then {code};

I think you have to define the variable too, so in the init.sqf set:

player setVariable["cmoney", 0,true];

Share this post


Link to post
Share on other sites

thanks, but im pretty sure the variable is already set since its a wasteland mission im hooking into the cmoney with a second script to add the money when the trigger is set .

my old version worked but i cannot get it to give it to only the side that captured the territory it gives it to everybody in game when somthing gets captured

MY old code:

player setVariable["cmoney", (player getVariable "cmoney")+200,true];
hint format["You got 200$ for capturing the territory!"];

so i tried adding if(str(playerSide) == "WEST") then so that it would only give to "WEST" Side but now it is just not working

Cheers

Share this post


Link to post
Share on other sites

Ah ok!

I think it should work:

if (playerSide == west) then {player setVariable["cmoney", (player getVariable "cmoney")+200,true];hint format["You got 200$ for capturing the territory!"];}; 

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
Sign in to follow this  

×