Home   Help Search Login Register  

Author Topic: NOT ENUFF MONEY!  (Read 838 times)

0 Members and 1 Guest are viewing this topic.

marcus3

  • Guest
NOT ENUFF MONEY!
« on: 14 Mar 2005, 16:59:49 »
ok now i have searched the forum and cant find nothing. no dont blow me up or something. with a money script. can you make it where when trying to buy something you dont have enuff money you dont get it. wood this work


if man1money = 10 and guncost = 20; man you are tyring to buy from sidechat "you dont have enuff money! beat it and dont come back"


or something like that
(came up with all this right off the top of my head)


Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:NOT ENUFF MONEY!
« Reply #1 on: 14 Mar 2005, 17:05:07 »
? man1money < guncost : sideChat "blah"
Plenty of reviewed ArmA missions for you to play

marcus3

  • Guest
Re:NOT ENUFF MONEY!
« Reply #2 on: 14 Mar 2005, 17:09:59 »
dont get it

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:NOT ENUFF MONEY!
« Reply #3 on: 14 Mar 2005, 17:19:45 »
I inferred from your post that the amount of money that man1 has is recorded in the variable man1money.    I also inferred from your post that the cost of the gun was held by the variable guncost.

Now, when the two characters meet I presume that a script is called to handle their conversation and the transaction.    The line of code I gave goes in the script.  

Does that help?
Plenty of reviewed ArmA missions for you to play

marcus3

  • Guest
Re:NOT ENUFF MONEY!
« Reply #4 on: 14 Mar 2005, 17:26:16 »
me trying right now

marcus3

  • Guest
Re:NOT ENUFF MONEY!
« Reply #5 on: 14 Mar 2005, 17:35:54 »
mmm i am kinda lost do you want the scripts and the mission
i think i will make it cars not guns.
no addons

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:NOT ENUFF MONEY!
« Reply #6 on: 14 Mar 2005, 18:44:05 »
you have the condition however it appears you dont know how conditions work...
example, you put

? jasonmoney < redcarcost
Thats fine but that wont do anything but bring up an error...
I would try this:

?(JasonMoney < 500):titletext ["You bum! you dont have enough money!","Plain Down"];exit
JasonMoney = JasonMoney - 500
hint"You got a car for 500 bucks!"
I like your approach, lets see your departure.
Download the New Flashlight Script!

marcus3

  • Guest
Re:NOT ENUFF MONEY!
« Reply #7 on: 14 Mar 2005, 19:45:51 »
well i hate to say this but.....
i still dont get it do you know where a tut on this is or can you explane it all to me?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:NOT ENUFF MONEY!
« Reply #8 on: 14 Mar 2005, 19:55:31 »
marcus3, I think the problem is that you do not have sufficient basic scripting knowledge to understand the answers.     Before going any further, read

- snYpir's A Friendly Intro to Code Snippets
- Johan Gustafsson's Scripting Tutorial
- Command Reference Scripting Topics Script Syntax

Then look up all of the commands you have used in your script in both the online comref and also the old Unofficial Command reference guide.    Then look up all the commands mentioned in this thread.    

It sounds like a lot but it isn't really and at the end you'll have a much better understanding of what's going on here.   ;)
Plenty of reviewed ArmA missions for you to play

marcus3

  • Guest
Re:NOT ENUFF MONEY!
« Reply #9 on: 14 Mar 2005, 21:39:51 »
ok......:( i guess i was geting ahead of my self.

Offline Roni

  • Members
  • *
  • Play the Game !
Re:NOT ENUFF MONEY!
« Reply #10 on: 14 Mar 2005, 23:14:31 »
Hi marcus3

Here's the 20 cent basic tour on what you want to do -

If a variable has a _ in front of it then it only works in that script (eg _target, _JasonMoney).  You can't call it or use it anywhere else.

If a variable DOESN'T have a _ in front of it then it stays until the end of the mission or until some script or trigger changes it (eg target, JasonMoney).

You want to use the second type !

If you want to check something in a script then use a question mark or the word "if", your test, a colon (:) or the word "then", and your result (what you want to happen).

So if you made a variable called JasonMoney somehow (maybe by setting it in the player's Init field at start - JasonMoney = 1000), you could then put this in an addaction on an object -

?(JasonMoney < 500):titletext ["You bum! you dont have enough money!","Plain Down"],exit

JasonMoney = JasonMoney - 500
hint"You got a car for 500 bucks!"


The first line says - if JasonMoney is less than 500 then show a message ("You bum . . etc") and exit the script.  The rest says "if you didn't exit the script because of that first line then take away 500 of Jason's money and tell him he got the car.  I suppose to avoid having the Feds raid this car yard you should also add something that gives Jason his car eg -

"Jeep" camcreate getPos Jason


I hope that this helps.  I know that the tutes etc are all very daunting to start off with - when I first saw the comref I thought that I'd never use even a tenth of the commands and now I've used almost every one of them.

Happy scripting !



roni




marcus3

  • Guest
Re:NOT ENUFF MONEY!
« Reply #11 on: 15 Mar 2005, 10:48:33 »
ok thanks man