Home   Help Search Login Register  

Author Topic: Certain set damge causing a hold fire.  (Read 1478 times)

0 Members and 1 Guest are viewing this topic.

Offline Jimboob

  • Former Staff
  • ****
Certain set damge causing a hold fire.
« on: 09 Aug 2006, 02:05:44 »
Basicly, ive got this,

Code: [Select]
?((getdammage unit)>0.4): setCombatMode "BLUE"
But it doesnt seem to work.

What I want is when an enemy gets hit, (An AI) I want him to hold fire. Thought this would work but to no avail, continues to fire at me.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re: Certain set damge causing a hold fire.
« Reply #1 on: 09 Aug 2006, 02:12:11 »
GetDammage is quite buggy from my experience. That code should work, although try to debug it with a hint-format check to see how much damage is actually caused. If that doesn't work, go with EventHandlers or something instead, if you can spare the CPU/Memory it takes.

EDIT: Typo.

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Certain set damge causing a hold fire.
« Reply #2 on: 09 Aug 2006, 10:04:47 »
er, actually the syntax is incorrect.

Code: [Select]
?((getdammage unit)>=0.4) : unit setCombatMode "BLUE"
setcombatmode needs to be told the unit (or group) whose combatmode it's setting.

always read the COMREF folks.

Offline johnnyboy

  • OFPEC Patron
  • ****
  • Matan los Pantalones!!!
Re: Certain set damge causing a hold fire.
« Reply #3 on: 10 Aug 2006, 18:52:28 »
I like this idea...and suggest a modification.  When hit, have the soldier not fire for a few seconds (say a random range of .5 to 3), then setcombatmode back to "RED".    This would simulate impact and fear stunning the soldier.

May burn too much cpu to put this script or eventhandler on all ai though...
El Cojon: "Do you like to Tango?"
You: "Only in Bagango."
Download Last Tango in Bagango and discover how El Cojon earned his name...

Offline Martin Kuka

  • Members
  • *
Re: Certain set damge causing a hold fire.
« Reply #4 on: 10 Aug 2006, 19:27:33 »
Of course he will hold fire for few secs only...
Getdammage is indeed buggy, I have a trigger where in condition I set this:

Getdammage easttroop >=0.7

And on activation:

Hint "Mortal Wound"

But It takes two headshots to display the hint.
Lets get rocked

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Certain set damge causing a hold fire.
« Reply #5 on: 11 Aug 2006, 09:19:52 »
Quote
Getdammage is indeed buggy
The damage caused to a unit depends on where it was hit and with what...
Also, triggers are 'executed' at about 0.5 second intervals so there may be a delay between the shot and the hint..

Although it wouldn't surprise me if the function was indeed buggy as so many others are..

@dmakatra
How exactly is an interrupt (eventHandler) more CPU/memory consuming than a function?
The game itself uses eventhandlers for almost everything...

I'm not a real coder but I don't really see how that would be true.. :P
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline dmakatra

  • Members
  • *
  • Better known as Armsty
Re: Certain set damge causing a hold fire.
« Reply #6 on: 11 Aug 2006, 13:45:43 »
@dmakatra
How exactly is an interrupt (eventHandler) more CPU/memory consuming than a function?
The game itself uses eventhandlers for almost everything...

I'm not a real coder but I don't really see how that would be true.. :P
AFAIK, that is how I remember it and how I learnt it. Anything I say these days should be taken with caution though, as I haven't done any scripting for over a year. :P

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re: Certain set damge causing a hold fire.
« Reply #7 on: 11 Aug 2006, 14:24:01 »
Event handlers are definitely the way to go everywhere you can use them, but common sense is naturally needed.

It depends on how you use (or more precisely, what you start from the event handlers) event handlers if they take too much processing power or not. Putting a fired event handler into many units and then starting a long-ish script from those event handlers, is well... plain stupidity. Imagine two 12-man groups firing automatic weapons simultaneously, and count how many instances of the script you will have started per minute in an intense firefight... So there you get strain on the CPU via an event handler but that is not the event handler's fault anymore, really.