Home   Help Search Login Register  

Author Topic: Pairing up setWPPos with OnMapSingleClick?  (Read 1193 times)

0 Members and 1 Guest are viewing this topic.

Offline Krieg

  • Mission Maker
  • Members
  • *
  • Who dares wins.
Pairing up setWPPos with OnMapSingleClick?
« on: 01 Jan 2010, 10:12:59 »
My basic idea is to have a group which player could order around to move.
So basically, this is how it would go:
    Player would use radio clicking on group's name.
    List of command would pop up, one of them move.
    Player would click on move.
    Group would reply: "Roger, where to?"
    Player would open up map and click where to.
    Group would reply: "Copy, moving out!"

On scripting/editing base it would look like this:
Group would have a hold waypoint, which would move from it's current location OnMapSingleClick and group would move towards it. My problem is that I have absolutely no idea how the code would look like.
Maybe something like this (?):
Code: [Select]
_pos = _this select 0
OnMapSingleClick {group1 setWPPos _pos}
If you see a light at the end of the tunnel, then it's probably an enemy tank.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Pairing up setWPPos with OnMapSingleClick?
« Reply #1 on: 01 Jan 2010, 12:31:40 »
First thing to try would be searching the Editors Depot for a tutorial about OnMapSingleClick.

When you say "List of command would pop up, one of them move" it sounds like you're talking about dialogs. Next thing to try would be searching the Editors Depot for a tutorial about how to create and interact with dialogs.

After that you will have a much better idea of what the code should look like.  :good:

Offline Krieg

  • Mission Maker
  • Members
  • *
  • Who dares wins.
Re: Pairing up setWPPos with OnMapSingleClick?
« Reply #2 on: 01 Jan 2010, 13:05:39 »
Thanks for response Bedges, I will look into that!  :good:

Edit: I am having a problem...
Whenever I try to run the mission I am testing dialog in my OFP crashes...
Anyways, here is dialog in description.ext:

Code: [Select]
#define ST_LEFT      0
#define ST_RIGHT     1
#define ST_CENTER    2
#define ST_MULTI        16
#define ST_SHADOW       256
#define ST_NO_RECT      512
#define CT_STATIC    0
#define ST_PICTURE   48
#define FontM "tahomaB36"
#define FontHTML "CourierNewB64"
#define CT_ACTIVETEXT 11
#define CT_BUTTON   1
#define ST_FRAME   64
#define CT_EDIT    2
#define CT_COMBO                 4
#define CT_LISTBOX               5
#define CT_SLIDER     3
#define ST_HPOS       0x0F

class RscText
{
        type = CT_STATIC;
        idc = -1;
        style = ST_LEFT;
        colorBackground[] = {0, 0, 0, 0};
        colorText[] = {1, 1, 1, 1};
        font = FontM;
        sizeEx = 0.04;
};

class RscPicture
{
        type = CT_STATIC;
        idc = -1;
        style = ST_PICTURE;
        colorBackground[] = {0, 0, 0, 0};
        colorText[] = {1, 1, 1, 1};
        font = FontM;
        sizeEx = 0.04;
};

class RscActiveText
{
        type = CT_ACTIVETEXT;
        idc = -1;
        style = ST_LEFT;
        color[] = {1, 1, 1, 1};
        colorActive[] = {1, 0, 0, 1};
        font = FontM;
        sizeEx = 0.04;
        soundEnter[] = {"ui\ui_over", 0.2, 1};
        soundPush[] = {, 0.2, 1};
        soundClick[] = {"ui\ui_ok", 0.2, 1};
        soundEscape[] = {"ui\ui_cc", 0.2, 1};
        default = false;
};

class RscButton
{
        type = CT_BUTTON;
        idc = -1;
        style = ST_CENTER;
        colorText[] = {0, 0, 0, 1};
        font = FontHTML;
        sizeEx = 0.025;
        soundPush[] = {, 0.2, 1};
        soundClick[] = {"ui\ui_ok", 0.2, 1};
        soundEscape[] = {"ui\ui_cc", 0.2, 1};
        default = false;
};

class RscFrame
{
        type = CT_STATIC;
        idc = -1;
        style = ST_FRAME;
        colorBackground[] = {0, 0, 0, 0};
        colorText[] = {1, 1, 1, 1};
        font = FontM;
        sizeEx = 0.04;
};

class RscEdit
{
       type = CT_EDIT;
       idc = -1;
       style = ST_LEFT;
       font = FontHTML;
       sizeEx = 0.02;
       colorText[] = {0, 0, 0, 1};
       colorSelection[] = {0.5, 0.5, 0.5, 1};
       autocomplete = false;
       text = ;
};

class RscLB_C
{
        style = ST_LEFT;
        idc = -1;
        colorSelect[] = {0.4, 0.4, 0.4, 1};
        colorSelectBackground[] = {0.2, 0.2, 0.2, 1};
        colorText[] = {0.2, 0.2, 0.2, 1};
        colorBackground[] = {0.4, 0.4, 0.4, 1};
        font = FontHTML;
        sizeEx = 0.025;
        rowHeight = 0.04;
};

class RscListBox: RscLB_C
{
        type = CT_LISTBOX;
};

class RscCombo: RscLB_C
{
        type = CT_COMBO;
        wholeHeight = 0.3;
};

class RscSliderH
{
            type = CT_SLIDER;
            style = ST_HPOS;
            color[] = {0.2, 0.2, 0.2, 1};
            idc = -1;
            sizeEx = 0.025;
};

class CCB
{
  idd = -1;
  movingEnable = true;
  controlsBackground[] = {DLG_BACK1, FRAME1};
  objects[] = { };
  controls[] = {TEXT2, PICTURE3, BUTTON4, BUTTON5, BUTTON6, BUTTON7, BUTTON8};

  class DLG_BACK1: RscText
  {
     colorBackground[] = {1, 0, 0, 0};
     text = ;
     x = 0;
     y = 0;
     w = 0.992;
     h = 0.93905;
  };
 class FRAME1 : RscText
 {
  x = 0
  y = 0
  idc = -1
  w = 0.992
  h = 0.93905
  style = ST_FRAME
  colorText[] = {1, 1, 0, 1};
  colorBackground[] = {1, 0, 0, 0};
  SizeEX = 0.025
 text = "Command Control Battle Net"
  };
 class TEXT2 : RscText
 {
  x = 0.495
  y = 0.1552956
  idc = -1
  w = 0.801
  h = 0.713
  style = ST_LEFT
  colorText[] = {1, 1, 0, 1};
  colorBackground[] = {1, 0, 0, 0};
 font = "TahomaB36"
  SizeEX = 0.04
 text = "Red Wolf is squad of 2 T80's and three T72's. They are veterans of the Everon Conflict, in which they, along squad equipped with prototype T80's so-called Red Grinders, eliminated last pockets of American resistance on Everon. For heroic actions on that day all personel received Order of Lenin. They are considered to be one of most experienced tank crew in the world.


List of current personel:
Dimitri Alexeyevich
Alexander Makhaev
Alexey Sergeyevich
Vladimir Moskvar
Sergei Ravnichar
Ivan Legeyevich
Igor Stalinovsky
Boris Minarov
Sasha Strelkoyev
Nikolai Ognyenov
Stanislav Ognestrelov
Andrey Pavelovski
Viktor Gromkin
Yakov Vodovorotski
Yuri Rezav
"
  };
 class PICTURE3 : RscText
 {
  x = 0.19
  y = 0.01884
  idc = -1
  w = 0.8
  h = 0.208
  style = ST_PICTURE
  colorText[] = {1, 1, 1, 1};
  colorBackground[] = {0, 0, 0, 0};
 font = "TahomaB36"
  SizeEX = 0.04
 text = ""
  };
 class BUTTON4 : RscButton
 {
  x = 0.03375
  y = 0.06368
  idc = -1
  w = 0.102
  h = 0.077
  style = ST_CENTER
  colorText[] = {0, 0, 0, 1};
 font = "CourierNewB64"
  SizeEX = 0.025
 text = "Move
"
 action = "player exec ""redwolfmove.sqs"""
 default = false
  };
 class BUTTON5 : RscButton
 {
  x = 0.0325
  y = 0.23327
  idc = -1
  w = 0.103
  h = 0.077
  style = ST_CENTER
  colorText[] = {0, 0, 0, 1};
 font = "CourierNewB64"
  SizeEX = 0.025
 text = "SITREP
"
 action = "hint ""This is not yet available"""
 default = false
  };
 class BUTTON6 : RscButton
 {
  x = 0.03125
  y = 0.39311
  idc = -1
  w = 0.102
  h = 0.077
  style = ST_CENTER
  colorText[] = {0, 0, 0, 1};
 font = "CourierNewB64"
  SizeEX = 0.025
 text = "Behaviour: Aware
"
 action = "player exec ""redwolfaware.sqs"""
 default = false
  };
 class BUTTON7 : RscButton
 {
  x = 0.03125
  y = 0.53931
  idc = -1
  w = 0.102
  h = 0.077
  style = ST_CENTER
  colorText[] = {0, 0, 0, 1};
 font = "CourierNewB64"
  SizeEX = 0.025
 text = "Behaviour: Combat"
 action = "player exec ""redwolfcombat.sqs"""
 default = false
  };
 class BUTTON8 : RscButton
 {
  x = 0.03
  y = 0.68161
  idc = -1
  w = 0.102
  h = 0.079
  style = ST_CENTER
  colorText[] = {0, 0, 0, 1};
 font = "CourierNewB64"
  SizeEX = 0.025
 text = "Behaviour: Danger"
 action = "player exec ""redwolfdanger.sqs"""
 default = false
  };
};
« Last Edit: 01 Jan 2010, 16:10:06 by Krieg »
If you see a light at the end of the tunnel, then it's probably an enemy tank.

Walter_E_Kurtz

  • Guest
Re: Pairing up setWPPos with OnMapSingleClick?
« Reply #3 on: 02 Jan 2010, 20:37:51 »
These are machine-readable files, Krieg, so you have to be a lot more careful about syntax. The problem appears to be line-breaks (aka Carriage Returns). OFP doesn't understand that you expect it to continue reading beyond the end of the line.
Code: [Select]
text = "Move
"
text = "SITREP
"
text = "Behaviour: Aware
"
respectively, ought to be:
Code: [Select]
text = "Move"
text = "SITREP"
text = "Behaviour: Aware"

And for the biggest mess of all:
Code: [Select]
text = "Red Wolf is squad of 2 T80's and three T72's.\nThey are veterans of the Everon Conflict, in which they,\nalong squad equipped with prototype T80's so-called Red Grinders,\neliminated last pockets of American resistance on Everon.\nFor heroic actions on that day all personel received Order of Lenin.\nThey are considered to be one of most experienced tank crew in the world.\n\n\nList of current personel:\nDimitri Alexeyevich\nAlexander Makhaev\nAlexey Sergeyevich\nVladimir Moskvar\nSergei Ravnichar\nIvan Legeyevich\nIgor Stalinovsky\nBoris Minarov\nSasha Strelkoyev\nNikolai Ognyenov\nStanislav Ognestrelov\nAndrey Pavelovski\nViktor Gromkin\nYakov Vodovorotski\nYuri Rezav"\n is used to tell OFP to continue the text on a new line, but why you'd want such a huge block of prose in a dialog defeats me ::)

Offline Krieg

  • Mission Maker
  • Members
  • *
  • Who dares wins.
Re: Pairing up setWPPos with OnMapSingleClick?
« Reply #4 on: 02 Jan 2010, 20:53:13 »
Lots of thanks on this one, Walter_E_Kurtz!
I created this using OFP Dialog Maker, so I guess that where I made the mistakes!

Quote
but why you'd want such a huge block of prose in a dialog defeats me  ::)

I guess it was meant to be placeholder until I find a better space-filler, so the size of the dialog is "justified".
I guess I better write a tutorial on how to use "Command Control Battle-net", that will hopefully make "The Red Grinder II" more playable.

Edit: Works perfectly now!
Now I just need to to learn to use dialogs... But that is not a problem!
Once again, thanks for the help!  :good:
« Last Edit: 02 Jan 2010, 21:10:52 by Krieg »
If you see a light at the end of the tunnel, then it's probably an enemy tank.