Jump to content
Sign in to follow this  
dachevs

Arma RPG

Recommended Posts

I'm creating a mod for Arma---an RPG. Like Sahrani Life-----My Problem----when you buy a car, it takes the money from you and spawns the car near you---BUT if you dont have any money it still spawns the car near you-FOR FREE! :/

What can I do about this? ALSO: How can I make hte script remove money from different Civs, I tried to put the "Buy" action on the building for all civs--i.e. CarShop addaction ["Buy", "BLah.sqf"];

carShop addaction ["Buy", "Blah1.sqf"]---but when I previewed there were two buy actions., and if i selected the bottom one it removed the 2nd Civs money.

Can anyone help???

Share this post


Link to post
Share on other sites

You only need to add the action to the building once and then all players can use that action and launch the same script.

if (!(player == _this select 1)) exitWith {};

if (money<_cost) exitWith {player groupchat "I dont have enough money to buy that item"};

money=money-_cost;

...script goes on creating car or whatever...

_cost is local in the script and money is local to the player.

Share this post


Link to post
Share on other sites

HMMM>>>Wasnt quite clear enough really. confused_o.gif

What I need is a script that removes the object, because it is an object in your inventory.

--So I need it to remove a certain amount of the object from your inventory, and check if that that amount of hte object is actually in your inventory. If you don't have enough of the object I need a hint or message to say something "You dont have enough to buy this car."

----Also I have an arrest script but how do I make it to where the police have the action to arrest the civ but the civ does not?

help.gif

Share this post


Link to post
Share on other sites

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

_maxRemove = _this select 1;

_i = 0

#removeLoop

_unit removeMagazine "className"

_i = _i + 1

?_i < _maxRemove : goto "removeLoop"

#Exit

Exit

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[playerName, numToRemove] exec "remove.sqs"

where the "className" is the className for your money or whatever you want to remove.

Share this post


Link to post
Share on other sites

Thanks. MUCH APPRECIATED. THis is perfect! thumbs-up.gif

*EDIT* confused_o.gif Get error message arma2008-03-2216-04-10-85.jpg

remove.sqs

Quote[/b] ]

_unit = _this select 0;

_maxRemove = _this select 1;

_i = 0

#removeLoop

_unit removeMagazine "RPO_obj3"

_i = _i + 1

?_i < _maxRemove : goto "removeLoop"

#Exit

Exit

[s1, 5] exec "remove.sqs"

I probably did alot wrong. sad_o.gif

Share this post


Link to post
Share on other sites

Try this.

(I don't know why that error is happening)

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

_unit = _this select 0;

_maxRemove = _this select 1;

_i = 1

#removeLoop

_unit removeMagazine "RPO_obj3"

_i = _i + 1

?_i == _maxRemove : goto "Exit";

goto "removeLoop"

#Exit

Exit

If that doesn't work, i'll try something else =/

Share this post


Link to post
Share on other sites

when you're calling the script, were you putting maxremove in quotes by mistake? That would turn it into a string (object) instead of a number, like it says in the screenshot. I might be way off, though, just a thought smile_o.gif

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[unit, 5] exec ...

Instead of

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[unit, "5"] exec ...

Share this post


Link to post
Share on other sites

still don't works, same error. confused_o.gif Don't have it in quotes.

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  

×