Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: SPON Money v0.1.2 (ACCEPTED)  (Read 28917 times)

0 Members and 1 Guest are viewing this topic.

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: SPON Money (DO NOT SUBMIT)
« Reply #15 on: 30 Nov 2007, 10:12:30 »
@Spooner

Not exactly, but if you look at our two missions here O-Team and Piper Warrior Tour Guide you'll find they won't work with Solus' default Extended Init Eventhandler (only the latest version, which adds some bollocks to the end which screws with our missions). LCD figured it out and fixed it, but...you can never say that an addon like that won't bug your mission; or in consequence your scripts.  :)

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: SPON Money (DO NOT SUBMIT)
« Reply #16 on: 30 Nov 2007, 13:07:32 »
@Wolfrug:
As far as I can tell, Supergrunt was implying that my scripts didn't work with XAM-1.3 because XAM-1.3 doesn't use extended event handlers (XAM 1.3 is known to be incompatible with any addon that utilises Solus' extended event handlers, but they are making it compatible for XAM-1.4), but since my work is not an addon, so uses scripted, rather than configured, event handlers, this particular issue cannot be affecting my scripts.

The idea that my scripts are incompatible with XAM and/or the extended event handlers for a different reason, however, is quite a different issue! Hopefully, Supergrunt can give me some more details of what he was meaning, since he was being a little cryptic (e.g. does my script make XAM not work properly or does XAM make my script not work properly? Are there particular circumstances when there is a failure or does it just happen when you load a mission? Is there an error message and if so, any idea what it says? Or does it just not work or CTD?). I appreciate the fact that Supergrunt has brought this issue to my attention, but I can't replicate the problem so that I can fix it, without having a bit more information.

EDIT: Had a look around in the extended event handlers (v1.1), but couldn't see anything that would interfere with other scripts. Any idea what exactly was going wrong with your missions, or was it in fact a problem with the addons required by your missions that didn't use the extented event handlers addon so were incompatible?
« Last Edit: 30 Nov 2007, 13:16:31 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline D.murphy man

  • Members
  • *
  • I'm a llama!
Re: SPON Money (DO NOT SUBMIT)
« Reply #17 on: 06 Dec 2007, 16:05:55 »
Hey spooner, heh been a few years since iv posted at OFPEC, i must say this is an excellent set of scripts you have here, im currently using them for a MP zombie RPG like mission im making but i have a few questions:
Firstly i read earlier that:
Quote
On a completely different note, I made SPON Money teamswitchable (each person has separate cash, but a common bank account)
By this do you mean that a players bank account is not specific to the player but can be access by others to? as for example theres 0 in the bank, but player 1 deposits 100 player 2 can withdraw that 100? or did i just misunderstand this? If this is the case how can i have bank accounts separate for each player?

Also how can i pay specific players money? For example once an objective is complete or an AI is killed a specific player receives money? In my case I want players to receive money every time they kill a Zombie.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: SPON Money (DO NOT SUBMIT)
« Reply #18 on: 07 Dec 2007, 00:12:54 »
Glad to see that people are actually using the scripts! We also do need a lot more zombie missions in the game too; preferably about 200 more!!!

I meant that in SP when you teamswitch then you will still have access to the same bank account, but that each individual character has their own cash value. In the currently released version, both cash and bank balance are for all characters, which is a bit silly (I had originally ignored the idea of teamswitching, just because I don't like it personally ;P ). In any sort of COOP/MP, then cash and bank balances are always entirely separate for each player.

With the current SPON Money v0.1.2, you can just add or remove money directly from the two global variables, SPON_playerBankBalance and SPON_playerCashBalance on the machine that is local to the player in question. If I remember rightly, if these values are affected while the shop dialog is open then the values shown in the dialog don't update until something is bought or sold. Just something to bear in mind if you are testing changing players money values. In the current WIP version, I've added functions to do this so that you can affect these values on any person from any machine. I'd like to get the new version out before Christmas, but I can't promise anything since I'm very busy on other projects right now and it also relies on some major changes I'm planning to make to SPON Core...
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline D.murphy man

  • Members
  • *
  • I'm a llama!
Re: SPON Money (DO NOT SUBMIT)
« Reply #19 on: 07 Dec 2007, 01:35:13 »
Thanks very much for the reply, much appreciated!

Offline D.murphy man

  • Members
  • *
  • I'm a llama!
Re: SPON Money (DO NOT SUBMIT)
« Reply #20 on: 07 Dec 2007, 14:28:30 »
Ok i have another, hopefully simple question!

I have Zombie units spawn with a even handler attached:
Code: [Select]
_x addEventHandler ["killed","SPON_playerCashBalance = SPON_playerCashBalance +50"]
Now this works all fine and dandy in SP however i am not sure how it will behave in MP. Being my scripting is pretty rusty these days at best I'm a little bit confused when it comes to MP scripting and whole Local and global thing. Of course I only want the player that killed said zombie to be rewarded with £50 but im guessing that when the zombie is killed, the killed event handler will activate globally and give all players 50, since i guess every machine would detect the death of the said zombie?

Could something along the lines of this work?:
Code: [Select]
_x addEventHandler ["killed",{_this exec "checklocal.sqs}"]

Checklocal.sqs:
_this select 0 = _killer
?!_killer=local:exit
SPON_playerCashBalance = SPON_playerCashBalance +50
I haven't actually tried the line above and no doubt iv cocked it up.

EDIT!:
I just read on the BIS wiki that:
Quote
MP notes: "Killed" and "Hit" eventhandlers are executed where given unit is local.
All other eventhandlers are executed on all computers.
So im guessing i don't need to change anything at all and that the player that killed the zombie, will be the only one that is rewarded? in less iv misunderstood this.
« Last Edit: 07 Dec 2007, 14:33:48 by D.murphy man »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: SPON Money (DO NOT SUBMIT)
« Reply #21 on: 07 Dec 2007, 15:23:13 »
Er, no, since the zombies will be local on the server and that will be where the killed handler runs, not on the player's machine. Fortunately, since you are using SPON Core (required by SPON Money), you can communicate this info relatively easily (even simpler in the next version of SPON Money...but you have to wait for that!):
Code: (killed handler which will only run on the server) [Select]
_zombie addEventHandler ["killed",
    {
        zombieKiller = _this select 1;
        publicVariable "zombieKiller";
        ["zombieKilledEvent", []] call SPON_publishGlobalEvent;
    }
]

Code: (in init.sqf) [Select]
["zombieKilledEvent",
    {
        if (player == zombieKiller) then
        {
            SPON_playerCashBalance = SPON_playerCashBalance + 50;
        };
    }
] call SPON_addEventHandler;

Also remember that if you run a zombie over, then you, the player, aren't considered the "killer" (and neither is the vehicle, I think). Whether you need to worry about that rather depends if you have vehicles in your mission.

Incidentally, you would use local like:
Code: [Select]
?!local _killer:exit
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline D.murphy man

  • Members
  • *
  • I'm a llama!
Re: SPON Money (DO NOT SUBMIT)
« Reply #22 on: 07 Dec 2007, 16:01:04 »
Thanks for the reply! It seems to work like a charm!

But alas! things never seem to go smoothly. I am now having problems with one of my shops. Or more precisely my vehicle shop.

I have this in my init.sqf:
Code: [Select]
[
["Prices.sqf"],
"£",
{ 1000 }, // Always $50 in pocket.
{ 10000 }, // Americans have more money in the bank.
0.33333 // You keep 1/3 of cash when you respawn.
] execVM "SPON\Money\initMoney.sqf";

//---------------------Guns

_stock1 =
[
// Weapons.

["RPG7V", "G36K","G36A","G36C", "Makarov", "PK", "SVD", "AKS74U", "AK74", "MP5A5", "M16A2", "M16A4", "M16A4_ACG", "M4SPR", "M4", "M4A1", "M24", "M240", "M249", "M9","PipeBomb", "SmokeShell", "Flare","Binocular", "NVGoggles"],
["PG7V","PG7VR", "30Rnd_556x45_G36", "10Rnd_762x54_SVD", "100Rnd_762x54_PK" ,"8Rnd_9x18_Makarov" ,"30Rnd_545x39_AK" ,"30Rnd_556x45_Stanag" ,"20Rnd_556x45_Stanag" ,"5Rnd_762x51_M24" ,"100Rnd_762x51_M240" ,"200Rnd_556x45_M249" ,"15Rnd_9x19_M9" ,"30Rnd_9x19_MP5"]
];

[Gunstore, 0.5, 1.0, _stock1] execVM "SPON\Money\setShop.sqf";

//-------------------vehicles

_stock2 =
[

["UH60MG", "MH6","HMMWV50", "HMMWV","Skoda","Skodablue","skodaRed","Skodagreen","datsun1_civil_1_open","datsun1_civil_2_covered","datsun1_civil_3_open","car_hatchback","car_sedan","LandroverMG","UralCivil2","UralRepair","UralRefuel","UAZMG","BRDM2","M1030","TT650G","TT650C","Truck5tMG"]
];

[equipmentstore, 0.5, 1.0, _stock2] execVM "SPON\Money\setShop.sqf";


//--------------------bank

[banker1] execVM "SPON\Money\setBank.sqf";
And when i try to access the 'Equipmentstore' and error is thrown up somthing along the lines of 'Error Zero devisor' and shopdiologui.sqf line 436.
Im sure its most likely some mistyping on my part or something iv missed out. Iv checked my price SQF over and every thing seems to be in order there so im guessing its my init.sqf

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: SPON Money (DO NOT SUBMIT)
« Reply #23 on: 07 Dec 2007, 16:12:41 »
Well, one thing is that all the "execVM" used for my scripts in the init.sqf should be "call compile preprocessFileLineNumbers" (this was discussed earlier in the thread; blame my shoddy documentation). execVM might work fine, but best to be safe.

The thing is that the first array in the stock is for weapons, the second for ammo and the third is vehicle. Thus you need some empty arrays for your vehicle array, so the shop knows that it is selling vehicles:
Code: [Select]
_stock2 =
[
        [], // No weapons
        [], // No ammo
["UH60MG", "MH6", etc., etc., etc.]
];

(the reason I have 3 lists of different item types, rather than one big list, is that some weapons and magazines have exactly the same name, so it needs to be specified which is which. Although no weapons/magazines share class names with vehicles, it is a lot simpler and clearer to keep them separated as well).
« Last Edit: 07 Dec 2007, 16:14:14 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline D.murphy man

  • Members
  • *
  • I'm a llama!
Re: SPON Money (DO NOT SUBMIT)
« Reply #24 on: 07 Dec 2007, 16:15:46 »
Ah that makes perfect sense now, thanks again Spooner, very much appreciated! Now that thous main things cleared up for me i should hopefully be able to complete a beta of this Zombie MP RPG soon!

Offline D.murphy man

  • Members
  • *
  • I'm a llama!
Re: SPON Money (DO NOT SUBMIT)
« Reply #25 on: 19 Feb 2008, 19:44:28 »
Hey again Spooner, I just have a quick question!

Is it possible to Clearmagazinecargo and clearweaponcargo vehicles that are brought? its just that the civilian Urals are loaded up with ammo and things when they are spawned, which could be abused by players buying Urals and selling all the flares, grenades and rockets out of it to make some quick profit.

Also i tried contacting you on MSN about the fix you mentioned to me for the Language issues when players use SPON_money in other game languages. I wasnt at my pc at the time you mentioned it so i thought id ask again! plus might come as benefit to all if you put the quick fix here in the forums.

Cheers!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: SPON Money (DO NOT SUBMIT)
« Reply #26 on: 20 Feb 2008, 18:42:57 »
To perform commands on a newly created vehicle, edit SPON\Core\showShopDialog.sqf and change:
Code: [Select]
case TYPE_VEHICLE:
{
    _itemClass createVehicle (getPos player);
};

to:
Code: [Select]
case TYPE_VEHICLE:
{
    _veh = _itemClass createVehicle (getPos player);
    clearWeaponCargo _veh;
    clearMagazineCargo _veh;
};

I'll add a better way of doing this so you can automatically perform commands when a vehicle is created in the much promised new version of SPON Money...*coughs*

(I've told D.murphy man a possible way to fix the non-English language things, but I haven't been able to test that. Hopefully that issue will be resolved now).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Callaghan

  • Members
  • *
Re: SPON Money (DO NOT SUBMIT)
« Reply #27 on: 10 Mar 2008, 17:41:07 »
Couple of questions -
1st do you have or know a way of converting a units value in points into money and rewarding the killing player with that money?
i.e. in a PvP game if someone destroys an enemy tank they will recieve the tanks value in points as well as the crews in money?

2nd do shopkeepers buy items they dont sell? Or do they only buy wht they sell?
Is what they buy added to their stock or does it dissappear?

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: SPON Money (DO NOT SUBMIT)
« Reply #28 on: 10 Mar 2008, 18:15:16 »
1. It is possible and it is done successfully to give a zombie-killing bounty in the Quarantine mission. Look a few posts up in this thread to where I explained how to implement this. There isn't a way to "convert a unit's value in points into cash" as such, since this game doesn't assign points values to units. Well, I suppose there are the points in the scoreboard (infantry = 1, vehicle = 2, tank = 3), but I don't think you can find out those numbers. There is no reason that you couldn't give a different bounty based on what vehicle has been destroyed by using different killed handlers on each vehicle type.

2. Shopkeepers always have unlimited numbers of everything that they sell. They buy all items that have been put in the main prices.sqf, regardless of what they sell (They will only buy weapons and grenades, however, never magazines and vehicles). There are so many issues involved in having stock-levels in shops that I can't see it is worthwhile having a system to manage that (not least of which is synchonising stock levels in MP, which although possible is a lot of effort for the limited usefulness). You'd need to develop a complex economy based on numbers of players online and sales rates to stop shops from running out of goods or the shops always being full. Overall, I really don't think it is worth the effort to develop this kind of system, especially since the parameters would be horrendously mission-specific.
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: SPON Money (DO NOT SUBMIT)
« Reply #29 on: 10 Mar 2008, 18:40:57 »
1) The rating command sort of does that : it gives more points for units with higher rank/more dangerous and such. For instance a tank will be worth upwards a thousand points, whereas a simple infantryman is considerably less. You could probably work with that to some extent :) Suggest you first research the command and the returns given properly though! (also note that you start with different amounts of rating depending on your rank).

Wolfrug out.
"When 900 years YOU reach, look as good you will not!"