Jump to content
Sign in to follow this  
Somerville

CrimeCity - help?

Recommended Posts

Hi there,

My clan members and I are virtually ready to release our version of CrimeCity - the popular OFP map - under the name "Sahraniville" (At this point, if any of you are interested, visit www.gol-clan.net/forums). We're having a few probelms at the moment:

1) Players who join-in-progress mess up the earnings, by reseting it to the default value. I think this is because each player starts the earnings scripts by a trigger detecting if they're alive. This has to be done in order to make sure that when a unit respawns, their earnings carry on. There's one value for the money:

sm

SM is the variable for the money. There is only 1. Each player calls the variable by another script. Basically, what happens is the player joins in the middle of it, and ArmA assumes that SM is reset back to the default value, which then resets the amount for everybody.

Question 1: Does anybody have any suggestions that don't involve me creating seperate money variables for each player?

2) At the moment, players don't have to buy a driver's licence to drive a car. The cops can perform a licence check, but each time the "Driver's Licence" is showing as False, even though it is true on the player's screen. I've ensured that I've put PublicVariable in to make sure that it's global, but still no joy.

Question 2: <s>Why doesn't ArmA like me?</s> Does anybody know if this is a known issue or whatever?

Thanks for any help!

Share this post


Link to post
Share on other sites

You should probably start the "money script" in the init.sqf which would make it local to the player. You'd just have to check that you weren't running it on the server in that case. By having a editor-placed (global) trigger check alive at the spawn-in point (I assume this is what you meant), you are running the script on every client and the server. You would also be having problems with any player manually returning to the spawn-in location. At least, that is assuming I'm understanding you properly.

Alternatively, you might want to look at my SPON Scripts, which deals with both cash and bank balances for every player, as well as shopping. Yes, I know there is a lot there, but the money/shopping/banking is what you might like to use. I'm currently working further on this part of the pack and will re-release it as SPON Money in the very near future, so that could make things simpler for you if that suits you at all.

Share this post


Link to post
Share on other sites

For question 1:

I'm halfway willing to bet that you're setting money to 0 in init.sqf aren't you? If you are, then you need to know that init.sqf is run for a player when they join a game.

One way to work around it if that's the case is build a check into the mission to see if it has already started. Then, test against that condition in the init.sqf and only set it to 0 if the mission hasn't started.

In fact, here's one easy as pie way to do that:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

If (!(MissionStarted)) then {Player1Money = 0;};

// the rest of init.sqf

sleep 1;

MissionStarted = true;

publicVariable "MissionStarted';

The reason that works, is because code run after the sleep command in init.sqf is only run after the briefing.

Question 2:

What are you using as the drivers license flag? I would guess a public boolean variable.

I'd be willing to bet that when you use publicvariable, you're not putting quotes around the variable name. It doesn't cause an error, it just doesn't broadcast. You have no idea how many times that's bit me in the ass in the past month or so.

Make sure it's something like this.

publicVariable "Player1DriversLicense";

If that's not the issue, try outputting the actual value of the flag in a chat form or something. If it's returning "SCALAR BOOL ARRAY 0xefffffff" (the hex code there probably isn't right, but you get the idea), the variable hasn't been initialised. If it actually returns false in the chat, then your problem is definatly that you're setting it to false somewhere else.

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  

×