OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: PheliCan on 19 Jun 2003, 05:58:42

Title: Please help!!! (move problems)
Post by: PheliCan on 19 Jun 2003, 05:58:42
Could anyone please help us with this problem!?
We have (almost) tried everything...

What we want to do is to order an AI-unit to move from the clientside. This might sound easy and we have actually succeeded! Now to the hard part...

The unit is in your group. We want to unjoin the AI-unit and make him move to a specific position (from onMapSingleClick).

Problem is that when we unjoin, the AI-unit doesn't seems to listen anymore. He just stands there looking dumb!  :(

It works when we move another group created from the editor, but not when we create one during gameplay (from a script). What we actually do, is to join the local player to grpNull and then joins the rest of the group that shouldn't move to him again. The remaining original (first) group is the one that should move...

move.sqs
Code: [Select]
hint "Click map where to move..."
onMapSingleClick { mapPos=_pos; mapUnits=_units; mapContinue=true }
@mapContinue
mapContinue=false
onMapSingleClick { mapPos = nil; mapUnits = nil; mapShift = false; mapAlt = false }

_playerGroup = units player
[player] join grpNull
(_playerGroup - mapUnits) join player

patrolUnit = leader (mapUnits select 0)
patrolMovePosX = mapPos select 0
patrolMovePosY = mapPos select 1
publicVariable "patrolUnit"
publicVariable "patrolMovePosX"
publicVariable "patrolMovePosY"
exit

moveserver.sqs
Code: [Select]
? !(local server) : exit
#update
   patrolUnit = objNull
   patrolMovePosX = 0
   patrolMovePosY = 0

   patrolUpdate = true
   publicVariable "patrolUpdate"
   #retry
      ~0.01
      _unit = patrolUnit
      _movePosX = patrolMovePosX
      _movePosY = patrolMovePosY
   ? ( (_unit == objNull) OR (_movePosX == 0) OR (_movePosY == 0)) : goto "retry"   

   patrolUpdate = false
   publicVariable "patrolUpdate"
   _unit move [_movePosX, _movePosY, 0]
goto "update"

PLEASE!!!! I beg you guys on my bare knees... We have been working from 00:00 to now (05:30) and we still havn't had any luck! (We have tried to solve it before, but now we're outta ideas...)
Title: Re:Please help!!! (move problems)
Post by: PheliCan on 03 Jul 2003, 10:51:49
Hmm..... Was this too hard for you guys or what?? Not anyone have an idea what to do??!
Title: Re:Please help!!! (move problems)
Post by: Unnamed on 05 Jul 2003, 04:50:24
I don't think you can create groups at runtime?

I found this work around on one of the forums.

Create a single soldier belonging to the apropriate side in the editor, and add this to his init field:

Code: [Select]
Temp1 = group(this) ; deletevehicle this
The guy gets deleted at the start of the mission, but his spirit lives on in the form of Temp1. So just replace GrpNull with Temp1.

Title: Re:Please help!!! (move problems)
Post by: PheliCan on 07 Jul 2003, 23:44:51
I've tried this but, unfortunatly, it didn't work...  :-\

Thanks for the tip, thu...
Title: Re:Please help!!! (move problems)
Post by: peter on 08 Jul 2003, 00:01:09
i think you need another delay before the move-command ...

~1 should do it ...