Jump to content
Sign in to follow this  
Scrub

Script help needed

Recommended Posts

Once again I'm in need of someone to tell me what I'm doing wrong.  The Biki is a great starting place, but the examples do not all function as snippets for learning purposes.

Following examples from there (and a few from a certain talented Mod) I got this far:

The basic script will be built on and automated, but I need functionality before that. It's supposed to take city x,y coordinates gained from the _Towns array, select one at random, add a player waypoint to that position, and create a friendly (enemies added after this gets ironed out) for pickup, and have them move to a 'getin' WP that is sync'ed with the players 'load' WP, and one to 'getout' at base.  I get the players WP actions just fine, but I'm having great difficulty with createGroup, and because of that, the createUnit command will not function.  (There's where I need the help confused_o.gif)

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Towns = ["Ortego", 12391, 7099, "Corazol", 13314, 8863, "Geraldo", 13256,6873, "Dolores", 11598, 6129, "Parato", 11268, 5266, "Iguana", 10768, 4891, "Tiberia", 9329, 5191, "Cyao", 9366, 5857, "Arcadia", 7636,6311, "Gulan", 8901, 7779, "Somato", 9130, 8270, "Yaro", 9741, 8673, "Pariso", 10520, 9503, "Airfield", 9800, 10024, "Airbase", 9528, 9847]

_MisNo =0

_WPInd =0

_grpplayer = group player

_NumTowns = (count _Towns)/3

_Guess= (round(random _NumTowns))

_RTN= (_towns select _guess*3)

_RTPos = [(_RTN+1), (_RTN+2)]

_Base = [(_towns select 15*3+1), (_towns select 15*3+2)]

_MisNo = _MisNo + 1

_WPInd = _MisNo-1

createcenter west

createcenter east

;player waypoint placement and typecasting

_grpplayer addWaypoint [_RTPos, 0]

[_grpplayer, WPInd] setWaypointType "load"

_grpplayer addWaypoint [_Base, 0]

[_grpplayer, WPInd+1] setWaypointType "unload"

frgroup = createGroup west

engroup = createGroup east

;Create friendly group and assign/sync waypoints

Frunit = group frgroup createUnit ["SoldierWB", position _RTPos, [], 0, "FORM"]

frgroup Addwaypoint [_RTPos, 100]

[frgroup, WPInd] setWaypointType "getin"

[frgroup, 0] synchronizewaypoint [_grpplayer, 0]

frgroup Addwaypoint [_Base, 100]

[frgroup, WPInd+1] setWaypointType "getout"

hint format ["number of towns:%1 \n random town name:%2 \n Rnd num:%3", _NumTowns,_RTN,_Guess]

Thank you for any assistance.  smile_o.gif

Share this post


Link to post
Share on other sites

just playing around in the editor i found this line would create a error

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

so

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

frgroup = createGroup frgroup_center

also creating a group in a simpler form

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"SoldierWB" createUnit [position _RTPos, frgroup]

I setup a few triggers to create this group and add inf to it then I changed my player to East and when i tried it the west group that spawned didn't shoot at me....think I'll look into that a bit more.

Anyway hope this helps

edit: when i place a west unit on a island away from my mission the west inf that spawn recognise me as a enemy.

Share this post


Link to post
Share on other sites

Thank you very much  notworthy.gif

I have ideas.  Just need a lot of guidance.

Edit: I wonder if there is a proximity for activtion of spawned units so they don't spring up in the middle of your formation and commence the slaughter. huh.gif

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  

×