Home   Help Search Login Register  

Author Topic: My Script  (Read 5028 times)

0 Members and 1 Guest are viewing this topic.

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:My Script
« Reply #15 on: 03 Jan 2004, 22:28:26 »
OK.......I cooked up a quick mission using your script.

I took out the line _man domove getpos _target.
Put this line back in if you need it for your mission, but the problem I found was _man kept trying to move closer to the _target after each dotarget and dofire.

Maybe you could put that line outside the loop so he only moves near the target once.


Also changed a few other bits.

Try this.......I know it works......I tried it.:

_man = _this select 0
_target = _this select 1

;lets first check if the target is alive...
?!alive _target : goto "TargetisDead"

;if the target is alive then the script carries on...
_man SetCombatMode "Yellow"
_man SetBehaviour "Aware"

#Loop1
~10
_man dotarget _target
_man dofire _target

? alive _target: goto "loop1"
?! alive _target : titletext [format ["%1 neutralized.", name _target], "Plain down"]
Exit

;if the target is dead then this part of the script is executed...
#TargetisDead
titletext [format ["Sir, we have a problem, %1 appears to be dead.", name _target], "Plain Down"]

Exit



Planck
« Last Edit: 03 Jan 2004, 22:39:07 by Planck »
I know a little about a lot, and a lot about a little.

Offline rhysduk

  • Former Staff
  • ****
Re:My Script
« Reply #16 on: 04 Jan 2004, 23:07:36 »
Hi Planck,

Its not a mission in making, im just starting scipting so this is my first script in the learning process :)

I noticed that you have changed the content of the titletext thingy around, maybe thats what was wrong with it :)

Ill check it out and let you know :D

Regards Rhys
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Offline MachoMan

  • Honoured
  • Former Staff
  • ****
  • KISS, Keep it Simple Stupid
Re:My Script
« Reply #17 on: 05 Jan 2004, 23:25:01 »
First off all, i think the ofp engine is Case sensitive wich means u are using capital letters, where u shouldn't!
First u call the loop: Loop1, but when u call it in your ?...... u say loop1. Change that!

And second: You do realise that the script will actualy take 10 seconds too start!

And howabout only targeting _target if _man has reached _target? Something like this:

Code: [Select]

_pos = getpos _target
_man domove _pos

#loop1
~10
? getpos _man == _pos: goto "fire"
goto "loop1"

#fire
_man dotarget _target
_man dofire _target
« Last Edit: 05 Jan 2004, 23:27:46 by MachoMan »
Get those missions out there you morons!

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:My Script
« Reply #18 on: 05 Jan 2004, 23:43:48 »
The above would make the _man target and fire at _target when the _man is standing at the exact same place where _target was standing when the script was started. No good, will not work.


Oh, and OFP is not case sensitive about these things.
« Last Edit: 05 Jan 2004, 23:46:18 by Artak »
Not all is lost.

Offline rhysduk

  • Former Staff
  • ****
Re:My Script
« Reply #19 on: 05 Jan 2004, 23:45:59 »
 :o Hmm Thanks Artak, i didnt see or know that  :thumbsup:

Ill look into the spelling error and let you guys knows...

Regards Rhys :booty:
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:My Script
« Reply #20 on: 05 Jan 2004, 23:53:00 »
Try adding a check for distance or how much the _man (hunter?) knows about the _target (rabbit?).

Lines like
?_man knowsabout _target > 0: go to targetting and shooting
and
?_man distance _target < 300: go to targetting and shooting
inside the move loop should prove usable.  ;)
Not all is lost.

Offline rhysduk

  • Former Staff
  • ****
Re:My Script
« Reply #21 on: 05 Jan 2004, 23:55:16 »
Thanks Again Artak,,

I didnt know about the "knowsabout" function ... let me check it out and let you know :)

Drinks on me :cheers:

Rhys
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Offline rhysduk

  • Former Staff
  • ****
Re:My Script
« Reply #22 on: 06 Jan 2004, 22:24:47 »
Setting some htings aside regarding my script for this little post :)

I read somewhere that certain things can be passed back and forth scripts...

somehting like _man = 1 CAN

but _man = blah blah CANT

I was wondering, if a seperate script was made to continually check the state of two men  (hunter and target) if _man/_target\ = _this select 0

IE :- _man = _this select 0 OR

_target = _this select 1

can be passed to this new checking script.. i dont see how the script will know what _target  and  _man is... ie the script is executed by[mansname, targetsname} exec "blablah.sqs" ....

Rhys
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:My Script
« Reply #23 on: 06 Jan 2004, 22:39:22 »
I don't understand. What?  ;D

[edit]

Ok, made some sense now.. maybe.
You can pass values with global variables. Global variables are the only kinds of variables you can use in the editor. When there's a 'global' variable there also has to be a 'local' variable.
That's right baby.

_localvariable
globalvariable

The local variable can only be read by the script it's in where a global variable can be read in any script or in the editor with triggers or what ever.

Thus, if you define target = (leader eastgroup1) you can use it in many scripts always giving you the same value.


Is this what you ment?
« Last Edit: 06 Jan 2004, 22:49:26 by Artak »
Not all is lost.

Offline MachoMan

  • Honoured
  • Former Staff
  • ****
  • KISS, Keep it Simple Stupid
Re:My Script
« Reply #24 on: 06 Jan 2004, 23:58:12 »
The above would make the _man target and fire at _target when the _man is standing at the exact same place where _target was standing when the script was started. No good, will not work.

It will not exactly work, but one of his problems is that the _man keeps getting new move orders,  this was meant to fix that (it will), i was pointing at a sollution to that problem, not supplying a complete working script, it's kinda floppy.
Get those missions out there you morons!

Offline rhysduk

  • Former Staff
  • ****
Re:My Script
« Reply #25 on: 08 Jan 2004, 18:18:07 »
Hey Planck,  >:(

I dont know if you did it intentionally or if it is why OFPEC is down, but after copying your script that you posted in REPLY 15, i had a sort of OFP Virus ...

What i mean is that OFP seems to be / well actually is executing a script that is not executed within the script or the mission...

It was something like __waituntil == time (0 + 1) ... seems that you or someone else is missing a ( or something - according to OFPP anyway ...

Rhys
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Offline rhysduk

  • Former Staff
  • ****
Re:My Script
« Reply #26 on: 08 Jan 2004, 18:25:32 »
HI guys , me again, having a problem with the behaviour and combatmode of my unit doing the killing :(

It seems that :-

Code: [Select]
_man SetCombatMode Safe
~0.1
_man SetBehaviour Safe
~0.1

doesnt work at all, but :-

Code: [Select]
_man SetUnitPos Up
~0.1
_man doMove getPos Gamelogic1

does work... :)

I have tried, "SAFE", "Safe", SAFE, Safe, and even safe

nothing works.. why ??

Rhys
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:My Script
« Reply #27 on: 08 Jan 2004, 20:59:35 »
Because combatmode is defined with colorcodes such as "red" or "blue" and so on. It's behaviour that's defined with "safe" and "danger" and so on.

Also '_man setunitpos Up' you have there should not work because the definition up, down, auto needs to be in quotes.

Check your command reference!!!  ;)


So that would be:

_man setcombatmode "yellow"
~0.1
_man setbehaviour "safe"


and


_man setunitpos "up"
~0.1
_man domove getpos gamelogic1


And as I've said earlier, OFP is not case sensitive about these things, so it matters not if your using setbeviour "sAfE" or "safe" or "SAFE" or what ever  ;)
Not all is lost.

Offline rhysduk

  • Former Staff
  • ****
Re:My Script
« Reply #28 on: 08 Jan 2004, 21:15:09 »
Hi Artak,

It seems that nothing works :(

Dont know why... in the comref - it doesnt say that UP, DOWN or AUTO needs to be in " them things... unless mines out-dated..

Anyway, my script is nowhere near perfect... ill upload a vesrion when OFPEC is back up....

i feel its a bit big to copy/paste here.... no its not. :-

Code: [Select]
_man = _this select 0
_target = _this select 1
_script = "script.sqs"


_man SetCombatMode "Yellow"
_man SetBehaviour "Aware"

#Loop1
? not alive _man : titletext [format ["%1 reports that %2 is KIA.", name player, name _target], "Plain Down"]
~3
_man doMove getPos _target
~1
_man doFire _target

? alive _target : goto "Loop1"
~1
? not alive _target : titletext [format ["%1 neutralized.", name _target], "Plain Down"]
~2
_man SetCombatMode "yellow"
~0.1
_man SetBehaviour "Safe"
~0.1
_man setUnitPos Up
~0.1
_man doMove getPos Gamelogic1

Exit
« Last Edit: 08 Jan 2004, 21:15:57 by rhysduk »
Reviewed Missions Board: Please Read the User's Guide before posting!

Pride and Joy 1 (HW100-T)

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:My Script
« Reply #29 on: 08 Jan 2004, 21:17:43 »
I don't understand where you are getting that error from rhys.

The script is just a copy of your original script, with a few syntax errors fixed and a line removed.

It worked perfectly for me.

Did you add anything to it?


Planck
I know a little about a lot, and a lot about a little.