Home   Help Search Login Register  

Author Topic: Position of the satchel  (Read 717 times)

0 Members and 1 Guest are viewing this topic.

Offline Blanco

  • Former Staff
  • ****
Position of the satchel
« on: 14 Oct 2003, 21:20:05 »
A sabotage mission, 3 objectives : An ammodepot, a shilka & a radarpost.

An event must start when all satchels (3) are placed near every objective. (let's say distance 6 meters)

What code do I need the check the position of the satchel?

 
Search or search or search before you ask.

_hammy_

  • Guest
Re:Position of the satchel
« Reply #1 on: 15 Oct 2003, 01:22:34 »
?(_unit distance _bomb < 6)

Offline revellion

  • Contributing Member
  • **
    • My Website
Re:Position of the satchel
« Reply #2 on: 15 Oct 2003, 11:58:22 »
set 1 trigger on all objectives

name em

trig1
trig2
trig3

then add the saboteur's init field: this addeventhandler ["fired",{_this exec "check.sqs"}]

--START--[check.sqs]--START--

? _this select 3 == "pipebomb" : goto "continue"

exit

#continue
obj = nearestobject [player,"pipebomb"]


? isnull obj : goto "continue"
? (obj in trig1) : goto "inobj1"
? (obj in trig2) : goto "inobj2"
? (obj in trig3) : goto "inobj3"

#inobj1

bombinobj1=true

exit
#inobj2

bombinobj2=true

exit
#inobj3

bombinobj3=true

exit
---END---[check.sqs]---END---

then add one more trigger Activation by: nobody
Condition: bombinobj1 && bombinobj2 && bombinobj3
On Activation:    *YOUR EVENT*
Best Logistic Addons and Missions: www.TheChainOfCommand.com

Offline Blanco

  • Former Staff
  • ****
Re:Position of the satchel
« Reply #3 on: 15 Oct 2003, 19:48:46 »
Great, I was thinking about an "fired" eventhandler but I thought that only works for riflles & ect ...cos you "put" a pipebomb... but it also works for grenades... and that's "throw" I think...

It doesn't matter, I will try it soon. ;)

I guess the obj variable can be local and isn't it...

? (obj in list trig2) : goto "inobj2"
...

Search or search or search before you ask.

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Position of the satchel
« Reply #4 on: 16 Oct 2003, 01:52:16 »
Great, I was thinking about an "fired" eventhandler but I thought that only works for riflles & ect ...cos you "put" a pipebomb... but it also works for grenades... and that's "throw" I think...

The eventhandler still picks it up, as 'putting' is still considered to be firing something ;)

You could try something like:

unit addeventhandler ["FIRED",{if ((_this select 3 == "pipebomb") and (player in list obj1trig)) then {obj1 = true}}]

for each of your objectives....

Just a side note, be careful not to have a variable assigned the same name as your trigger... all sorts of crazy things could happen ;)

Offline Blanco

  • Former Staff
  • ****
Re:Position of the satchel
« Reply #5 on: 16 Oct 2003, 20:48:45 »
wellI tested revelion's code last night and it doesn't work.

In fact it works all the time, even if the player put his satchel outside the trigger and always the first objective's achieved.

I found a way but there are still some problems.

I placed a trigger for each objective named radarpost,ammodepot,shilka)

Quote
round shaped , radius 6 *6
activation WEST, REPEATABLE
condition : player in thislist
onactivation : player addeventhandler ["fired",{_this exec "check.sqs"}]
on deactivation : player removeallEventHandlers "fired"

an init.sqs with

Quote
bombinobj1=false
bombinobj2=false
bombinobj3=false

and "check.sqs"


Quote
;--START--[check.sqs]--START--

? _this select 3 == "pipebomb" : goto "continue"

exit

#continue
_obj = nearestobject [player,"pipebomb"]


? isnull _obj : goto "continue"
? (!bombinobj1 && _obj distance radarpost < 6) : goto "inobj1"
? (!bombinobj2 && _obj distance ammodepot < 6) : goto "inobj2"
? (!bombinobj3 && _obj distance shilka < 6) : goto "inobj3"

#inobj1

bombinobj1=true
hint "objective 1 is completed"

exit
#inobj2

bombinobj2=true
hint "objective 2 is completed"

exit
#inobj3

bombinobj3=true
hint "objective 3 is completed"
exit
;---END---[check.sqs]---END---

I think I made it myself difficult, but it works.
But...
as you can see this script only works for the objectives with the names radarpost,ammodepot & shilka. How can I include the objectivesnames as a parameter?
I know an eventhandler "fired" got 4 parameters, but can you define other (external?) parameters in "check.sqs"?

Another thing is that that the objective is still achieved when the player deactivate his satchel. How can I fix that?

In attach : a test mission on desert island, no addons needed.










« Last Edit: 17 Oct 2003, 23:08:27 by Blanco »
Search or search or search before you ask.

Offline revellion

  • Contributing Member
  • **
    • My Website
Re:Position of the satchel
« Reply #6 on: 22 Oct 2003, 12:05:08 »
 :-\

i think you have misunderstood the thing abit

the eventhandler is to be in the soldier's init field not in trigger m8

or you'll get the big PROB  8)

just add it to the players who have Satchels' initfield: this addeventhandler ["fired",{_this exec "check.sqs"}]

hopefully this removes all confusion  ;)
Best Logistic Addons and Missions: www.TheChainOfCommand.com

Offline Blanco

  • Former Staff
  • ****
Re:Position of the satchel
« Reply #7 on: 22 Oct 2003, 18:43:04 »

Hmmm,...I knew that, but it doesn't work, the script activates everywhere on the map when I place a satchel.
 :-\
I think its something with the _obj in trig1
_obj in list trig1 doesn't work either.

The reason I placed the eventhandler in a trigger is to avoid that.
 

Search or search or search before you ask.

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Position of the satchel
« Reply #8 on: 23 Oct 2003, 03:35:08 »
A trigger won't pick up a satchel charge as it doesn't have a specific side assigned to it...

If you want to use a script that detects the satchel charge (an ugly and cumbersome method in my humble opinion ;)), you'll need to use distance.