Jump to content
Sign in to follow this  
cobra@pulse

Certain Scripts

Recommended Posts

Hello people.

Righty then. I've got a MP mission, been working on it for some time now and im struglling with some of the scripts im trying to write for it.

What am i struglling with?

Well the following are what I am having trouble with:

- onMapSingleClick : I am trying to script it so that once the player has the action he can click on the map to direct where a Resistance group will go to. Must be able to use in MP

Thats really the only one i was struggling with, thinking about it now, lol.

Any help would be great, cheers

Share this post


Link to post
Share on other sites

Okay, here it is. There is no script for it, choose a (some) unit(s) with a function key, go to your map, and simply click on the location you want them to go.  biggrin_o.gif If it dosen't work,  crazy_o.gif thats messed up, cus it worked for me.

Share this post


Link to post
Share on other sites

Perhaps someone can help me too. I am making an FMV.sqs and I do not know how to make AI sit in a chair.  banghead.gif Been struggling on this for some time now.

Share this post


Link to post
Share on other sites

welcome.gif Welcome to the forum mate.

Firstly, I see that you may have misunderstood me. Your talking about using it in the mission, using F1 etc to move units. Im talking about advanced editing and scripting of moving units and AI around the map, believe me its not as simple as you may think. E.g. the script looks like that atm:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

; Resgrp is a group

; gl_Resgrp is a gamelogic although I can't remember exactly what its for

Resgrp sidechat "Black Eagle, stand by for movement orders."

~1

hint "Click on the position on the map where you want Black Eagle to go to"

~1

"Regrpmarker" SetMarkerType "Start"; "Resgrpmarker" setMarkerColor "ColorGreen"

? count units Resgrp == 0:goto "dead"

leader Resgrp sideChat "Black Eagle standing by."

a = 0

b = 0

onMap=false

onMapSingleClick {Resgrp move _pos; leader Resgrp sidechat "Black Eagle Moving on"; gl_Resgrp setPos {a = (_pos select 0); b = (_pos select 1); clicked = true"publicVariable _x" forEach [a,b,onMapSingleClick]}

@onMap

onMapSingleClick {}

_pos = [a,b]

#dead

[West, "HQ"] sideChat "We've got no contact with Black Eagle, I think they are all dead. Continue on with the mission. Out"

EXIT

As you can see. Not that simple but cheers for trying.

With your problem, use the command:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Unitname switchmove "FXSitHandsOnTable"

To get the unit sitting at the table moving his hands every now and then.

Good luck, and in the future mate, dont thread hyjack. Got a problem, search first then post in a new thread, not something that has no relivance at all to what you want to know. thumbs-up.gif

Anyone else help me?

Share this post


Link to post
Share on other sites

Another help question, does that code you gave me work without a table and only a chair, and does that code only work in a specific waypoint?

Share this post


Link to post
Share on other sites

Its an animation, and dont worry, it has nothing to do with way points.

Open another thread mate and i'll help you or perhaps edit the one you already created. We are going way offtopic of what this ones supposed to be about.

Share this post


Link to post
Share on other sites

i understand your question but i have no idea hows its done, i went into the on map single click business and never undertsood how it worked.. maybe sometime i will look into it when i have the time and see what wonders i can make.. lol biggrin_o.gif

"He wants a group to move to a position he selects when he clicks on the map"

Share this post


Link to post
Share on other sites

Not an expert on the subject but I may be able to help some.

A couple of things I noticed in your script. First of all, I did not see where you make onMap true so the script stops there (unless it is set to "True" elsewhere).

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">onMapSingleClick {Resgrp move _pos; leader Resgrp sidechat "Black Eagle Moving on"; gl_Resgrp setPos {a = (_pos select 0); b = (_pos select 1); clicked = true"publicVariable _x" forEach [a,b,onMapSingleClick]}

I also noticed that there is not a ";" between clicked = true and "publicVariable _x" forEach [a,b,onMapSingleClick] but these are not your only issues.

Where is the movement commands to make the group goto their destination?

Below is code from a script that I use to move units to a marker. Works in MP but the darn markers do not move to the new position on each players screen. Never was able to fix that but look and see how this works. I did not make the script, only adapted two different scripts from the (old) OPEC site.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">a=0

b=0

clicked = false

onMapSingleClick {a = (_pos select 0); b = (_pos select 1); clicked = true; publicvariable "a"; publicvariable "b"; publicvariable "clicked"}  

@clicked

onMapSingleClick {}

_pos = [a,b]

"Alphapoint" setMarkerPos _pos

[Alphagroup,"Alphapoint"]exec "Goto.sqs"

exit

And the "goto.sqs":

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">group1=group (_this select 0)

_marker=1

_marpos=_this select _marker

units group1 commandmove getmarkerpos _marpos;

Exit

The original author used more lines of code than needed in the "goto.sqs" but I never bothered to clean it up as it worked well enought at the time. It should also work like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">group1=group (_this select 0)

_marpos=_this select 1

units group1 commandmove getmarkerpos _marpos;

Exit

Hope that this helps you some.

Wadmann

Share this post


Link to post
Share on other sites

Doesn't it work if you just do something simple like:

onmapsingleclick {resgroup move _pos; true}

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×