Home   Help Search Login Register  

Author Topic: Another Question  (Read 486 times)

0 Members and 1 Guest are viewing this topic.

netta1234

  • Guest
Another Question
« on: 15 Jul 2004, 18:09:02 »
Yo all  ;)

i need a Train script

ok

you go to Car lincens shop and u buy the lincens

now are all the actions at the Car shop activated

Buy Red Skoda and more...

how do i script this?  :-\

DBR_ONIX

  • Guest
Re:Another Question
« Reply #1 on: 02 Aug 2004, 15:22:00 »
Err, heres the simplest way I can think..
Make the liscensing person, with an addaction..

------=------
liscaction = this addaction ["Buy liscence","buylis.sqs"]
------=------

Then, make a script :

buylis.sqs
------=------
lisperson removeaction liscaction
HINT "Thanks for getting a liscene,\nDrive carefully!"

buyaction = redskoda Addaction ["Buy this car",{[redskoda,100] exec "buycar.sqs"}]
buyaction = redskoda Addaction ["Buy this car",{[blueskoda,300] exec "buycar.sqs"}]
;...etc....
EXIT
------=------

So, that will make the redskoda cost 100 thingys, and the blueskoda cost 300 thingys
You keep copy/pasting them, editing the the car name ([carname,cost] exec "buycar.sqs")

Heres the buycar.sqs script :
------=------
_car = this select 0
_carcost = this select 1
?(carcost > totalmoney):EXIT
_car locked false
totalmoney=totalmoney- _carmoney
HINT FORMAT ["Thank you for buying this fine car! It cost %1 \n You have %2 left!",_carcost,totalmoney]
_car removeaction buyaction
EXIT
------=------
And when you buy the car, it checks you have enough money, if not, it quits.. It then unlocks the car, takes the money away for the car (I guess you have a money system? If not, put a line in your INIT.sqs - totalmoney=100)
It then says thank you, tells you how much the car costs, and how much you have left, takes the Buy Car action away, then exits.

If you don't understand this.. I can make up a demo mission with it for you
- Ben
[Edit - messed up the code tags]
[Edit 18 :P - WTF it wrong! The tags keep getting messed up! >:|]
[Edit 19.. - Remove all the code tags, replaced 'em with
------=------
]
« Last Edit: 02 Aug 2004, 15:42:18 by DBR_ONIX »