Home   Help Search Login Register  

Author Topic: Are You hurt?  (Read 760 times)

0 Members and 1 Guest are viewing this topic.

Offline Captain Crunch

  • Members
  • *
Are You hurt?
« on: 27 Jan 2004, 21:17:03 »
Hi again!

   Is there not a command (or snippet) that checks if a unit or object has been injured or damaged. Like ? Dammaged or something like that??

  I've checked in the Ed depot but can'tt find it. Is it just because it doesn't even exists!?

  Many thanks in advance!

   crunch
Back to the forest!

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Are You hurt?
« Reply #1 on: 27 Jan 2004, 21:37:32 »
the official command reference is your bible m'kay  :hmm: ;)

Quote
getDammage obj
Operand types:
    obj: Object
Type of returned value:
    Number
Description:
    Object dammage in range 0 to 1

Example:
    getDammage player
Not all is lost.

Offline Captain Crunch

  • Members
  • *
Re:Are You hurt?
« Reply #2 on: 27 Jan 2004, 22:48:03 »
RRAAhh!! Sorry! I mistook GetDammage for SetDammage!

I'm sorry, I was born french!  :P

Hmm! To make this thread worthwhile, I've seen (I think) the command "GetRelPos" once, back in nineteen twelve. But it's not in the Comref. (At least I didn't see it, !Really!)

Does this command actually exists or is my head injury from back when I fought the Australians in Vietnam still playing tricks on me!?

I tried this but get the error message "Unknown operator, _Vehicle"


_Vehicle = _This Select 0

#Ready


_X = ((GetRelPos _Vehicle) Select 0)
_Y = ((GetRelPos _Vehicle) Select 1)
_Z = ((GetRelPos _Vehicle) Select 2 + 3)
Back to the forest!

Offline Captain Crunch

  • Members
  • *
Re:Are You hurt?
« Reply #3 on: 28 Jan 2004, 00:50:30 »
@ GetDammage _Vehicle > 0.7 : Unit AddAction ["Repair", "Repair.sqs"]

   This is totally wrong!!! Totally wrong! (I made it myself!!!)

You get my idea though, right? Does someone know the right syntax? Damn I really try!!

Thanx much!
Back to the forest!

CrashnBurn

  • Guest
Re:Are You hurt?
« Reply #4 on: 28 Jan 2004, 01:02:32 »
addaction only works on humans. If it's an AI vehicle, the vehicles leader will call for repair, if a repair vehicle with support waypoint is on the map.

Offline Captain Crunch

  • Members
  • *
Re:Are You hurt?
« Reply #5 on: 28 Jan 2004, 05:38:38 »
Hi there!

   The unit I am giving the addaction command is a human player.

   My goal here is to activate an action in the action menu that will allow the player to repair a damaged vehicle with the help of a script. (_Vehicle SetDammage 0 for example).

   What I'm looking for is the correct syntax for this idea here: (if possible)

   @ GetDammage _Vehicle > 0.7 : Unit AddAction ["Repair", "Repair.sqs"]

 PS: I've tried with the "If" command and it worked fine.:

? (GetDammage _Vehicle 0.7) : Player AddAction ["Repair", "Repair.sqs"]


Back to the forest!

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Are You hurt?
« Reply #6 on: 28 Jan 2004, 08:34:01 »
Quote
addaction only works on humans. If it's an AI vehicle, the vehicles leader will call for repair, if a repair vehicle with support waypoint is on the map.


Fortunately, that's wrong  ;D You can add an action to ANY object. When a unit is close enough to the object (about 5 meters or closer, and facing it), then he gets the action in his action menu. When he goes farther away, the action then goes away. So it would be simpler to add the action to the vehicle, not to the player.

Code: [Select]
@ GetDammage _Vehicle > 0.7 : Unit AddAction ["Repair", "Repair.sqs"]
Your syntax is messed up here (a common mistake though  :P ). The  @condition  will make the script wait at that line until the condition is true. Then it will go on to the next line. The  ?condition : action thingy works differently: when the script gets to that line, it checks if the condition is true. If the condition is true, it does the action (or actions, if separated by a ; ). Either way, it will then go to the next line, right away (unless a goto command is in there).

So the correct syntax is:

Code: [Select]
@ GetDammage _Vehicle > 0.7

 Unit AddAction ["Repair", "Repair.sqs"]

Got it?  :)
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

CrashnBurn

  • Guest
Re:Are You hurt?
« Reply #7 on: 28 Jan 2004, 10:44:02 »


Fortunately, that's wrong  ;D You can add an action to ANY object. When a unit is close enough to the object (about 5 meters or closer, and facing it), then he gets the action in his action menu. When he goes farther away, the action then goes away. So it would be simpler to add the action to the vehicle, not to the player.



So you're saying that AI have an action menu that they can call scripts from? ???  ::)

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Are You hurt?
« Reply #8 on: 28 Jan 2004, 14:33:26 »
Yes. You know how you have the default actions in your action menu, right. The AI has them too. If you have AI in your group you can access their actionmenu by selectring the unit and pressing 6 in command menu.
Same with a custom action which has been added with the addaction command. Obviously if the AI unit is not in your group you can't make him do the action, but who cares, and why would anyone want to.

And as Barron there said, walking close to any object with an action will make you see the action in your own action menu.

/edit

Oh and something you want to note when fiddling with actions is that if you don't want the action to be used by anyone else but the actions owner or say a specific group of units you can put
?_this select 1 != (leader maingroup): exit
or
whatever whoever
in the beginning of the script which the action launches.

Also in multiplayer note that the launched action is only executed on the specific player who launches it. If you want the action be executed on say all clients, you'll have to work for it.
« Last Edit: 28 Jan 2004, 14:40:04 by Artak »
Not all is lost.

SharkDog

  • Guest
Re:Are You hurt?
« Reply #9 on: 28 Jan 2004, 18:31:47 »
No I'm not hurt, but thanks for asking though

Offline Captain Crunch

  • Members
  • *
Re:Are You hurt?
« Reply #10 on: 28 Jan 2004, 22:36:27 »
Quote
No I'm not hurt, but thanks for asking though


lol!!!

   Sweet, sweet, sweet!! Thanx a lot to all of You!  ;)  8)

One question to Artak though:

Quote
Also in multiplayer note that the launched action is only executed on the specific player who launches it. If you want the action be executed on say all clients, you'll have to work for it.

I am making a multiplayer mission for two players. What do You mean by that?

  My script looks like this

;This creates variables.
_Vehicle = _This Select 0
_Unit = _This Select 1
;___________________________________________________________________________________________


;This is a label.
#Ready
;___________________________________________________________________________________________


;This waits until one or more of the _Vehicles is or are damaged.
@ GetDammage _Vehicle >= 0.7
;___________________________________________________________________________________________


;This add an action to the _Vehicle
_Vehicle AddAction ["Repair", "Repair.sqs"]
;___________________________________________________________________________________________


;Bye!
Exit


Would it work fine for the two units in the multiplayer? (Unfortunately, Ican't test it now)

If not, how can it be done?

   Thanks again!!  :D
Back to the forest!

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:Are You hurt?
« Reply #11 on: 29 Jan 2004, 07:19:22 »
What I'm saying is that when you execute that 'repair.sqs' script with the action, the other players in game might not know anything about it or the changes running the script caused (i.e. fixing the vehicle). I don't know exactly how setdammage command works in MP, but for example if you had skiptime command in that repair.sqs the result would be that the player who executed the action would have different time than other players, because the command was ran only on the player who executed the action.

I'm sorry, can I say that any harder to understand?  ;D
Not all is lost.

SharkDog

  • Guest
Re:Are You hurt?
« Reply #12 on: 29 Jan 2004, 23:29:32 »
:P