Home   Help Search Login Register  

Author Topic: Dynamic WP's & Setting WP TYPE  (Read 802 times)

0 Members and 1 Guest are viewing this topic.

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Dynamic WP's & Setting WP TYPE
« on: 17 Nov 2002, 06:41:02 »

I'm using dynamic wp's I get the units to move the intended destination, I can change the combatmode to make them firewall at will. But I cannot for the life of me figure out how to set the dnamic WP to SAD (seek and destroy). In the editor when you add a real WP with a SAD type, it shows in the sqm as TYPE:SAD . How can i set this option via a script using dynamic WPS?

Hoz
Xbox Rocks

Diealot

  • Guest
Re:Dynamic WP's & Setting WP TYPE
« Reply #1 on: 17 Nov 2002, 16:13:22 »
I hate seeing a valid question go unanswered....Could one of you smart asses out there answer this...my ass is not smart enough too.

Offline Wiper

  • Members
  • *
Re:Dynamic WP's & Setting WP TYPE
« Reply #2 on: 17 Nov 2002, 18:42:25 »
hoz,
what do you mean with "dynamic WP" ?
do you 'SetWPPos'  ?

I dont think there is a (documented) command/parameter how to use the Editor-parameters (GetIn, S&D, ..) for a specific waypoint with a script.
But maybe  I'm missing something ...the last patch brought in so much new stuff i don't had time enough to study all of it...
-
For moving units around with a script i'd recommend the 'move" command  ( _unit move [position] ) and to script your own functions - at least ist's the way i do.

If u want an Inf unit to S&D f.e. simply give him a random radius (_r) an a random angle (_phi) and let him search around his position in combat mode or whatever for a couple of  minutes in a loop.
;======================
#Start_SAD
leader _squad SetCombatMode "RED"
_x= getpos leader _squad select 0
_y= getpos leader _squad select 1
_t= daytime
#Loop_SAD
? daytime > _t+180/3600: goto "End_SAD"
_r= random 100
_phi= random 360
leader _squad move [_x+_r*sin(_phi),_y+_r*cos(_phi)]
#SAD
:-------------------------------
; unit is on its way to the new S&D point...
; you can let do it here somefink - like react on
; knowsabout values, emergency "exit loop", etc..
;-------------------------------
~1
? ("unitready _x" count units _squad)!=(count units _squad):goto "SAD"
goto "Loop_SAD"
#End_SAD
;========================

I'm pretty shure the S&D command of the "Editor Waypoints" works the same way.

does it help ?

ww

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re:Dynamic WP's & Setting WP TYPE
« Reply #3 on: 17 Nov 2002, 18:54:19 »
I don't setWPpos I use the move command to move all my units to the post and then I change thier behavior. I thought about using the knowsabout command or the reveal command. I was hoping there was an easy answer to setting WP Type.

THanks for the code, I'll try it out here and let you know. Thanks for taking the time to answer.
Hoz
Xbox Rocks

Diealot

  • Guest
Re:Dynamic WP's & Setting WP TYPE
« Reply #4 on: 17 Nov 2002, 19:18:08 »
Iknew there was a smart ass out there to help you.... :D

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re:Dynamic WP's & Setting WP TYPE
« Reply #5 on: 17 Nov 2002, 22:09:21 »
Ok I tested it out and I had to change some code around to make it work. For testing I just call from radio trigger to start the script.

_squad = testgp1
leader = testdude1

;======================
#Start_SAD
_squad SetCombatMode "RED"
_x= getpos leader select 0
_y= getpos leader select 1
_t= daytime
#Loop_SAD
? daytime > _t+180/3600: goto "End_SAD"
_r= random 100
_phi= random 360
_squad move [_x+_r*sin(_phi),_y+_r*cos(_phi)]
#SAD
;-------------------------------
; unit is on its way to the new S&D point...
; you can let do it here somefink - like react on
; knowsabout values, emergency "exit loop", etc..
;-------------------------------
~1
? ("unitready _x" count units _squad)!=(count units _squad):goto "SAD"
goto "Loop_SAD"
#End_SAD
;========================

I added the variable at the top to define the groups and leader.
Now to make the code work I had to remove the y= select leader _squad, it was returning an error, group expected object. Not sure why you are selecting the squad pos and the leader pos, these would nearly be the same, or is this how the randmizing happens.

Either way it seems to be working ok, I am going to test it some more.

Thanks again for the help.

hoz
« Last Edit: 17 Nov 2002, 22:11:02 by hoz »
Xbox Rocks

Offline Wiper

  • Members
  • *
Re:Dynamic WP's & Setting WP TYPE
« Reply #6 on: 18 Nov 2002, 04:48:40 »
oh sorry,
should have mentioned that
_squad
is the local var name of the group and
leader _squad
actually returns the leader of that group.

So
getpos leader _squad select 1
should return a valid value for the y-coordinate/element of the pos array

sorry for the inconvinience but i simply wanted to give an example how it can be done straight from my memory
great anyway if it does the job for u now :-)

rgds
ww