Advertisement

Author Topic: Bank/ Marker/ Triggers/ menu  (Read 265 times)

0 Members and 1 Guest are viewing this topic.

Offline Mad Pup

  • One Who Asks A Lot.
  • Members
  • *
  • OFPEC Is Awesome
Bank/ Marker/ Triggers/ menu
« on: 11 Feb 2010, 21:27:38 »
Mad Pup here, sorry I didn't have time to search the depots, or the forums for the answers to these questions. So here goes.
I am making a mission (multiplayer), where each character has a bank account, and money, and there are stores.
There are 4 civilian slots, 4 west slots, and 4 east slots.
Question 1. How do I make it so that each player starts with $400, and makes $200 every hour in the game (which would be 10 mins in real time), but only if he/she is in a designated area, and so that he/she can go to a building/object, and deposit/withdrawl money??

2. How do I make it so that certain markers on the map, are only visible to one side?

3. How do I make triggers that are only executed by a certain player?

4. How do I make menu's pop up, with certain cars and/or guns, when a player executes a script?


Thanks SO much for your help. And again, sorry I didn't have time to look through the depots, and forums.

- Mad Pup  :D
"The object of war is not to die for your country, but to make the other poor bastard die for his" - General Patton
[SH]MadPup
[SH]Squad

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: Bank/ Marker/ Triggers/ menu
« Reply #1 on: 11 Feb 2010, 21:47:08 »
(1) You'll need some kind of looping script, something like this. (not guaranteed to work)

Code: [Select]
_money == 400
#loop
~600
? player distance someplace <= 200 : _money = _money + 200
goto "loop"

To subtract someone's money,

Code: [Select]
_money = _money - 200
Observe that the = command doesn't mean the same thing as = in mathematics.

(2) According to the "biki," setmarkerpos is executed locally. So have your markers begin the mission in a corner of the map and use setmarkerpos on each to computer to shift them to different positions.

(3) name your players p1, p2, p3...etc and add this to the end of your conditions field

Code: [Select]
&& p1 == player
Et cetera

(4) I haven't made a dialog menu yet, but start with something like this.
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)

Offline Krieg

  • Mission Maker
  • Members
  • *
  • Who dares wins.
Re: Bank/ Marker/ Triggers/ menu
« Reply #2 on: 12 Feb 2010, 07:38:58 »
I have to agree with RKurtzDimitriyev on some points, but there is one little bug in his money script.

Code: [Select]
_money == 400
#loop
~600
? player distance someplace <= 200 : _money = _money + 200
goto "loop"

What he uses here is an local variable, meaning that it will not work outside that script.
What you need is a global variable that would work in any script.
How to use them: Click here. So, you'd basically have to define a global variable and use it. Besides that one more error remains in the script RKurtzDimitiyev posted.
Code: [Select]
_money == 400That basically means that you would say to OFP: "_money is equal to 400". But, unfortunatley, maths work differently in OFP. What you want to say via script to OFP is:
Code: [Select]
_money = 400
Which means "400 is the value of _money" which would make OFP engine assign value of 400 to _money, and not make a (to my understanding at least) short-term comparison.

Also I am a bit disagreeing with trigger solution.
Triggers works fine, but with one little difference (again, to my understanding) you'd have to group the certain player to the trigger you want to be executed by that player.
« Last Edit: 12 Feb 2010, 19:55:01 by Krieg »
If you see a light at the end of the tunnel, then it's probably an enemy tank.

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: Bank/ Marker/ Triggers/ menu
« Reply #3 on: 12 Feb 2010, 15:09:23 »
Whoops, Krieg is right, I should have put

Code: [Select]
_money = 400
With one = sign rather than two. And yes, global variable will probably be better than local, depending on how your mission design works out. I guess I just instinctively put in a local variable.

Regarding the triggers, I guess it depends on what you're asking, Mad Pup.

If you want only the computer of player "p1" to execute the effects of the trigger, simply attach

Code: [Select]
&& player == p1
to the end of the conditions field. Computers whose "player" is not p1 will never activate the trigger. I don't believe any grouping is necessary.

But if you want, for example, a trigger that will execute when a certain unit enters a certain area, all you need to do is group the trigger with the unit and set activation to something like "vehicle -- present."
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)

Offline Mad Pup

  • One Who Asks A Lot.
  • Members
  • *
  • OFPEC Is Awesome
Re: Bank/ Marker/ Triggers/ menu
« Reply #4 on: 13 Feb 2010, 00:28:00 »
Okay RKurtzDmitriyev, if I generate a dialog, how do I put it into play? Say a civilian walks up to a flag pole (this is a real player), and an action pops up that reads "Withdrawl / Deposite Money", when he selects this action, the menu pops up.

ALSO: What would I put in a script, to show how much money you have, in a hint?


- Mad Pup
« Last Edit: 13 Feb 2010, 01:50:10 by Mad Pup »
"The object of war is not to die for your country, but to make the other poor bastard die for his" - General Patton
[SH]MadPup
[SH]Squad

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: Bank/ Marker/ Triggers/ menu
« Reply #5 on: 13 Feb 2010, 02:17:28 »
Say a civilian walks up to a flag pole (this is a real player), and an action pops up that reads "Withdrawl / Deposite Money", when he selects this action, the menu pops up.

Sounds like you'll need to use addAction on the flagpole, and link it to a script that causes the dialog to pop up. Is there any documentation for that dialog generator? It should tell you how to integrate a dialog into a script.

Quote
What would I put in a script, to show how much money you have, in a hint?

Use the hint and format commands. Example:

Code: [Select]
hint format ["You have %1 dollars left", money]
Where "money" is...your money!
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)

Offline Mad Pup

  • One Who Asks A Lot.
  • Members
  • *
  • OFPEC Is Awesome
Re: Bank/ Marker/ Triggers/ menu
« Reply #6 on: 17 Feb 2010, 21:37:12 »
Okay, Questions 1, and 3 are solved.
"The object of war is not to die for your country, but to make the other poor bastard die for his" - General Patton
[SH]MadPup
[SH]Squad