Home   Help Search Login Register  

Author Topic: problem with "usermarker.sqs"  (Read 706 times)

0 Members and 1 Guest are viewing this topic.

Offline ONoSixIsDown

  • Members
  • *
problem with "usermarker.sqs"
« on: 26 Dec 2005, 17:26:00 »
I'm having problems implementing a script i pulled out of the editor's depot (group command v2, usermarker.sqs)

I copied all the other scripts and modified them where needed and every thing works fine up untill i use the radio to command, Alpha to signal a squad to move out. (you give the squad a waypoint by double-clicking on the map and hitting enter, leaving it blank. It then is supposed to change the marker type for a second then delete it's self.) My problem is when i create a "usermarker", the script doesn't seem to fire.

I've already made sure that the squads are assigned the correct names, and double checked and triple checked. everything seems in order as i'm not getting any error messages.

also, the "usermarker" script is called by a trigger with these settings...

type: none
condition: true
onactivation: [3] exec "usermarker.sqs"; usermarkerset=false

I don't under stand why there is a "3" in the array box and i
think that might be related to the problem.  I looked through all the other scripts and on all the units and triggers and can't find any refrence to it.  The tutorial mission it comes from functions properly and i can't figure out why mine won't.....

help :'(

anyone have any idea what i'm doing wrong?
« Last Edit: 26 Dec 2005, 17:30:36 by OhNoSixIsDown »
CRIMSON REIGN COMMING..... eventually :/

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:problem with "usermarker.sqs"
« Reply #1 on: 26 Dec 2005, 17:49:00 »
I don't know the script but I bet there is a line that says:

_somethingorother= _this select 0

The 3 that you are concerned about is a value that is being passed into the script and will be recongnised as _this select 0 inside the script.  So the _somethingorother will be set to 3 .

Does this make sence?

Offline ONoSixIsDown

  • Members
  • *
Re:problem with "usermarker.sqs"
« Reply #2 on: 26 Dec 2005, 18:02:02 »
i get what you are saying and i just went over the script and there was nothing in there saying

"_yadayadayada= this select 0"

here's a copy of the script......

Quote

; user defined marker detection script v1
; by snYpir for the OFP editing center

;---------------------------------------------
; this script will constantly monitor for new user-defined markers
; it is designed to be called right at the start of a mission

; every time a new user defined marker is created:

; the global variable 'userMarker' will equal the latest marker
; the global variable 'userMarkerPos' will equal the position of the latest marker
; the global variable 'userMarkerX' will equal the X coord of latest marker
; the global variable 'userMarkerY' will equal the Y coord of latest marker
; the global variable 'userMarkerSet' will equal true.

; it is YOUR responsibility to set userMarkerSet back to false! ie in your artillery script or wherever. If you don't it doesn't matter, if the user enters a new marker then the new marker information will override the global variables

; it does not matter how many markers already exist on the map, this script will just hunt for the first user defined marker the player places, then the next etc.

; WARNING!!!! THE DELETE BUTTON IS THE ACHILE'S HEEL OF THIS SCRIPT!!!!!

; PARAMETERS: takes the number of pre-defined markers you have already set in the editor
;----------------------------------------------

; BEGIN BITS U CAN EDIT
;----------------------

; set the time between marker checks - should be between 0.25 and 1
_pause = 0.5

; time in seconds to show 'destroy' icon before the marker will disappear, default is 1
; careful, you don't want the player adding new markers while we are waiting for the
; destroy icon to disappear, so don't make this value too high
_hidedelay = 2

; the icon to display for user-defined markers
_icon = "end"

; END BITS U CAN EDIT
;--------------------

userMarkerPause = false
userMarkerSet = false

_nEditorMarkers = _this select 0

; this loop will run until the end of the mission
#missionLooop

;wait for a marker to be added
#loop2

;halt the script if requested
@NOT(userMarkerPause)

; find the id of what will be the next user-defined marker
_counter = _nEditorMarkers
#loop1
_markerposn = getMarkerPos format["_USER_DEFINED #0/%1",_counter]
? ((_markerposn select 0) == 0 AND (_markerposn select 1) == 0) : goto "nextmarkerspotfound"
_counter = _counter + 1
goto "loop1"

; ok so now _counter will equal the position of where a new marker will go.
#nextmarkerspotfound

; make sure another marker has not been added during the loop above
? ((_markerposn select 0) != 0 AND (_markerposn select 1) != 0) : _counter = _counter + 1

~_pause

_markerposn = getMarkerPos format["_USER_DEFINED #0/%1",_counter]
? (_markerposn select 0) == 0 AND (_markerposn select 1) == 0 : goto "loop2"

; remember the new marker information in userMarker, userMarkerPos, userMarkerPosX, userMarkerPosY
userMarker = format["_USER_DEFINED #0/%1",_counter]
userMarkerPos = _markerposn
userMarkerX = (_markerposn select 0)
userMarkerY = (_markerposn select 1)

; change markers icon
userMarker SetMarkerType _icon

; switch the userMarkerSet flag to true - it is your responsibility to switch it back to false
userMarkerSet = true

; uncomment for information about new marker to be printed to screen
;hint format["Marker %1 placed at position: (%2,%3)",_counter,userMarkerX,userMarkerY]

; short pause to allow icon to change
~_hidedelay

; hide the marker (so the player will not intentionally delete it)
userMarker SetMarkerType "empty"

; loop back up to wait for the next marker

goto "missionLooop"


i can't find anything that passes "3" as a variable anywhere...

maybe SnYpir can shed some light on this  :P
« Last Edit: 26 Dec 2005, 18:03:39 by OhNoSixIsDown »
CRIMSON REIGN COMMING..... eventually :/

Offline ONoSixIsDown

  • Members
  • *
Re:problem with "usermarker.sqs"
« Reply #3 on: 26 Dec 2005, 19:23:08 »
ok, well i just about abandoned the above method of controlling multiple squads and have decided to take a much more simpler method.

this way only uses one trigger and two scripts script for each group.  

the trigger is as follows
Quote
type: radio alpha, present, repeatably
condition: this
onactivation: onMapSingleClick {[(...pos] exec "Alphagroup.sqs"

the first script is called "goto.sqs"

Quote
group1=group (_this select 0)
_marker=1
_marpos=_this select _marker
units group1 commandmove getmarkerpos _marpos;
Exit

the second one that defines the group (alphagroup) in question is...

Quote
onMapSingleClick {}
_pos = _this select 0
"Alphapoint" setMarkerPos _pos
[Alphagroup,"Alphapoint"]exec "Goto.sqs"

exit

now in each group leader's name field has alphagroup/bravogroup/charliegroup and what happens is when the leader dies the squad no longer complys.  What i want to know is how to make the "goto" script order the group in question's leader to move to the marker placed with the single click....

any ideas?
CRIMSON REIGN COMMING..... eventually :/

Offline TLI

  • Members
  • *
  • You just THINK I'm a llama!
Re:problem with "usermarker.sqs"
« Reply #4 on: 26 Dec 2005, 19:57:54 »
To digress back to your first question,
i just went over the script and there was nothing in there saying

"_yadayadayada= this select 0"
Actually, about halfway down, there is the line
Quote
_nEditorMarkers = _this select 0
and
Quote
_counter= _nEditorMarkers
 SnYpir explains that the 3 passed into the script is the number of editor-placed markers in his tutorial mission. I'm guessing that you have more than 3 markers in your mission (which throws off snYpir's counter). Try changing the 3 to whatever number of markers you have in yours.
« Last Edit: 26 Dec 2005, 20:03:37 by N »
High explosives are essential.