OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Ding on 23 Jun 2005, 05:57:08

Title: Money Question #2
Post by: Ding on 23 Jun 2005, 05:57:08
New question, how do  i get it to desplay the amount of money to the player when the logic which plus 50's the total amount of money is activated, as in how do i get it to show the current amount of players money?
Title: Re:Money Question #2
Post by: qqqqqq on 23 Jun 2005, 11:17:35
Trigger

money1 > 50
hint format ["Player's money is %1", money1]
Title: Re:Money Question #2
Post by: Ding on 23 Jun 2005, 18:20:46
well i created a trigger

put money1 > 50 in the condition
and put
hint format ["Player's money is %1", money1]

in teh activation
then created another trigger saying money1 = 50

priviewd and nothing happened, what am i doing wrong?
Title: Re:Money Question #2
Post by: Planck on 23 Jun 2005, 20:20:28
Make it 51 then it should work.   ;D


Planck
Title: Re:Money Question #2
Post by: 456820 on 23 Jun 2005, 20:31:33
i thought the = needs 2 of them like this
money == 50
also what did you do about the hint format ["Player's money is %1", money1]
it sounds like you put that in the condition field aswell as on the linne below you say
in the activation field
wich kind of implies that you havent done that part yet ?
also if you want the trigger to activate when the player has 50 or more money if so use
money >= 50
Title: Re:Money Question #2
Post by: Ding on 23 Jun 2005, 21:27:40
right got it to work
Title: Re:Money Question #2
Post by: Ding on 24 Jun 2005, 05:46:03
how do i set the money level so that it cannot go below 0?

i have a small weapons shop, when you buy a weapon but the money can go ito minuses which is annoying, i have already tried

money < 0
money = 0
Title: Re:Money Question #2
Post by: qqqqqq on 24 Jun 2005, 13:05:04
Read the command reference.    Particularly these bits

http://www.ofpec.com/editors/comref.php?letter=num

http://www.ofpec.com/editors/comref.php?letter=3#Script%20syntax

You're not going to get anywhere unless you understand the meaning of things like = and ==.  

? money1 <= 0 : hint "You're broke!"; money1 = 0

? price1 > money1 :  hint "You can't afford that."
Title: Re:Money Question #2
Post by: OFPfreak on 25 Jun 2005, 00:39:20
ah rofl.. its simple.

Quote
put money1 > 50 in the condition
and put
hint format ["Player's money is %1", money1]

Its right I think. Try to put that in an .sqs file instead of a trigger if you know what I mean.
Something like this:

Code: [Select]
player1money=50
hint format["You have %1 in your bank account",player1money]

EDIT: OOPS!!!! Forgot to read that question!
Here is how to distract money from buying stuff and all that sh!t :P!

example:

in a trigger's activation put: buyglock=player addaction["buy a glock as weapon with ammo","weapon.sqs"]

make a file called weapon.sqs
put in it:

Code: [Select]
playermoney=200
takeaway=30
if playermoney<30: goto notenough
playermoney=playermoney-takeaway
hint format["you've bought a glock with ammo! You've got %1 dollars left!",playermoney]
goto exit

#notenough
hint "you don't have enough money for a glock with ammo!"

#exit

Tell me if it works or if it doesn't ;)!
Title: Re: Money Question #2
Post by: ModestNovice on 18 May 2008, 07:02:08
well i know this is old topic   :P

but heck...

Code: [Select]
playermoney=200
takeaway=30
if playermoney<30: goto notenough
playermoney=playermoney-takeaway
hint format["you've bought a glock with ammo! You've got %1 dollars left!",playermoney]
goto exit

#notenough
hint "you don't have enough money for a glock with ammo!"

#exit

this is wrong.

I think this right...

Code: [Select]
playermoney=200
_takeaway=30
? (playermoney<_takeaway) : goto "notenough"
playermoney=playermoney-_takeaway
hint format["You've bought a glock with ammo! You've got %1 dollars left!",playermoney]
goto exit

#notenough
hint "You don't have enough money for a glock with ammo!"

#exit
Exit

Title: Re: Money Question #2
Post by: Gcfungus on 18 May 2008, 09:24:26
I'll have to side with the admins. This post is 3 years old! Do not post in very old topics, as it's not relevant!!
Title: Re: Money Question #2
Post by: ModestNovice on 18 May 2008, 22:00:25
Yes but when I was trying to learn a money system, it was 2 year old posts here from OFP that helped me  :)