Home   Help Search Login Register  

Author Topic: Creating diff patrols with script...help!  (Read 519 times)

0 Members and 1 Guest are viewing this topic.

Offline myke13021

  • Contributing Member
  • **
  • Myke
Creating diff patrols with script...help!
« on: 15 Jan 2004, 00:49:05 »
hey scripting gods (and goddesses, if present)

i got a little prob...i would like to use a script to insert diff patrols on a map using the createunit command. i alread know about the group problem which is discussed in another thread and i followed instructions described there to get an empty group. I created a unit and inserted into his init field: GroupAlpha=group this; deletevehicle this
as far as good...next i made a trigger with the following on activation:
["INFANTERY", "patrol1", "GroupAlpha"] exec "patrol.sqs"
the script goes as this:

; get the parameters given
_type = _this select 0
_pos = _this select 1
_group = _this select 2

; check which patrol to create
?(_type == "SPETZNATZ"): Goto "Spetznatz"
?(_type == "RPGPATROL"): Goto "RPGPatrol"
?(_type == "INFANTERY"): Goto "Infantery"
?(_type == "SNIPER"): Goto "Sniper"

; No type was found so alert creator theres a typo
_errorText = Format["ERROR: INVALID TYPE %0", _type]
Hint _errorText
Exit

; creating Spetznatz Patrol
#Spetznatz
"SoldierESaboteurPipe" CreateUnit [GetMarkerPos _pos, _group, "", 0.8, "CAPTAIN"]
"SoldierESaboteurPipe" CreateUnit [GetMarkerPos _pos, _group, "", 0.7, "LIEUTENANT"]
"SoldierESaboteurPipe" CreateUnit [GetMarkerPos _pos, _group, "", 0.6, "SERGEANT"]
"SoldierESaboteurPipe" CreateUnit [GetMarkerPos _pos, _group, "", 0.5, "CORPORAL"]
"SoldierESaboteurPipe" CreateUnit [GetMarkerPos _pos, _group, "", 0.5, "PRIVATE"]
"SoldierESaboteurPipe" CreateUnit [GetMarkerPos _pos, _group, "", 0.5, "PRIVATE"]
"SoldierESaboteurPipe" CreateUnit [GetMarkerPos _pos, _group, "", 0.5, "PRIVATE"]
"SoldierESaboteurPipe" CreateUnit [GetMarkerPos _pos, _group, "", 0.5, "PRIVATE"]
exit

;creating RPG Patrol
#RPGPatrol
"OfficerE" CreateUnit [GetMarkerPos _pos, _group, "", 0.8, "LIEUTENANT"]
"SoldierEMG" CreateUnit [GetMarkerPos _pos, _group, "", 0.7, "SERGEANT"]
"SoldierELAW" CreateUnit [GetMarkerPos _pos, _group, "", 0.6, "CORPORAL"]
"SoldierELAW" CreateUnit [GetMarkerPos _pos, _group, "", 0.5, "PRIVATE"]
"SoldierEMedic" CreateUnit [GetMarkerPos _pos, _group, "", 0.5, "PRIVATE"]
"SoldierEMG" CreateUnit [GetMarkerPos _pos, _group, "", 0.5, "PRIVATE"]
"SoldierELAW" CreateUnit [GetMarkerPos _pos, _group, "", 0.5, "PRIVATE"]
"SoldierELAW" CreateUnit [GetMarkerPos _pos, _group, "", 0.5, "PRIVATE"]
exit

;creating Inf Patrol
#Infantery
"OfficerE" CreateUnit [GetMarkerPos _pos, _group, "", 0.8, "LIEUTENANT"]
"SoldierEMG" CreateUnit [GetMarkerPos _pos, _group, "", 0.7, "SERGEANT"]
"SoldierELAW" CreateUnit [GetMarkerPos _pos, _group, "", 0.6, "CORPORAL"]
"SoldierEB" CreateUnit [GetMarkerPos _pos, _group, "", 0.5, "PRIVATE"]
"SoldierEMedic" CreateUnit [GetMarkerPos _pos, _group, "", 0.5, "PRIVATE"]
"SoldierEB" CreateUnit [GetMarkerPos _pos, _group, "", 0.5, "PRIVATE"]
"SoldierEB" CreateUnit [GetMarkerPos _pos, _group, "", 0.5, "PRIVATE"]
"SoldierEB" CreateUnit [GetMarkerPos _pos, _group, "", 0.5, "PRIVATE"]
exit

;creating Sniper Patrol
#Sniper
"SoldierESniper" CreateUnit [GetMarkerPos _pos, _group, "", 0.9, "CAPTAIN"]
"SoldierESniper" CreateUnit [GetMarkerPos _pos, _group, "", 0.8, "LIEUTENANT"]
"SoldierESniper" CreateUnit [GetMarkerPos _pos, _group, "", 0.7, "SERGEANT"]
"SoldierESniper" CreateUnit [GetMarkerPos _pos, _group, "", 0.6, "CORPORAL"]
exit

as you see the script should create a patrol of give type but it doesn't...where's the error?
What did i wrong? Is anything in this script that could work?
Please help me, i would pray to you for the rest of my life if you do ;-)

deaddog

  • Guest
Re:Creating diff patrols with script...help!
« Reply #1 on: 15 Jan 2004, 00:55:00 »
You are passing the groupname as a string, which is not valid.  A string is a string and a group is a group.  Do this instead:

["INFANTERY", "patrol1", GroupAlpha] exec "patrol.sqs"

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Creating diff patrols with script...help!
« Reply #2 on: 15 Jan 2004, 00:55:42 »
Should it be

getMarkerPos "_pos"

Edit:  kinda the opposite comment from deaddog's ...

Edit edit:  go with deaddog
« Last Edit: 15 Jan 2004, 00:56:04 by macguba »
Plenty of reviewed ArmA missions for you to play

deaddog

  • Guest
Re:Creating diff patrols with script...help!
« Reply #3 on: 15 Jan 2004, 00:58:43 »
Yeah, the marker name is correct.  Marker names are strings.  I didn't see anything else wrong (quick glance) except infantry is misspelled :)  Not that it matters  ;D

*edit*

I mean that getmarkerpos _pos is correct.
« Last Edit: 15 Jan 2004, 01:00:35 by deaddog »

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:Creating diff patrols with script...help!
« Reply #4 on: 15 Jan 2004, 01:00:08 »
omg...so f***in simple i didn't recognized it....and so fast the answer.....thx a lot deaddog......maybe i think i'm too stupid for this  ;D

(note for myself: add deaddog to the credits in mission for his help


imo closed...thx again

deaddog

  • Guest
Re:Creating diff patrols with script...help!
« Reply #5 on: 15 Jan 2004, 01:03:13 »
Quote
......maybe i think i'm too stupid for this

Not at all.  It just takes practice and making a lot of mistakes.

An expert is someone who has made all the mistakes :)

(No, I'm not claiming I'm an expert)

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Creating diff patrols with script...help!
« Reply #6 on: 15 Jan 2004, 01:18:13 »
I knew I should have kept my mouth shut. :P
Plenty of reviewed ArmA missions for you to play

Offline myke13021

  • Contributing Member
  • **
  • Myke
Re:Creating diff patrols with script...help!
« Reply #7 on: 15 Jan 2004, 01:37:25 »
hmm...now by thinking over the script....does it matter if the script is executed on server AND on clients? or would i get multiple patrols insted of just one?....and if yes...how do i prevent this?

sry for beeing a noob  :-[
« Last Edit: 15 Jan 2004, 01:38:10 by myke13021 »