Welcome, Guest Wednesday 16th April 2014, 11:10:51
   Home   Help Search Login Register  

OFPEC Forum

Author Topic: AddAction - It adds the action to other units if you are too close - how to disa  (Read 1064 times)
0 Members and 1 Guest are viewing this topic.
Acecool
Guest
« on: 04 Mar 2005, 19:36:21 »

ble?


Basically, _unit Addaction...

If you get too close to that unit it gives you the action too..

How can you turn that off?
Logged
nominesine
Intel Depot
Administrator
*****
Offline Offline


I'm NOT back!


WWW
« Reply #1 on: 04 Mar 2005, 19:57:02 »

You cannot turn it off. But there are ways to prevent other units from using it.
Logged

OFPEC | Intel Depot
RETARDED Ooops... Retired!
RujiK
*
Offline Offline


KoKo Puh-Fizzles!


« Reply #2 on: 04 Mar 2005, 20:10:14 »

well, I'm sure that was helpful...
One way to do it is all units are going to be able to see the action however you can make it so only one person can use it.
Like one way you could do this is a simple check, such as:
Code:
_unit = _this select 0
?(_unit != name_with_action):hint"Ha! you cant do that!";exit
;then put whatever you want to happen here.
Logged

I like your approach, lets see your departure.
Download the New Flashlight Script!
Acecool
Guest
« Reply #3 on: 04 Mar 2005, 22:05:56 »

This works:
? _this select 0 != _this select 1 : exit

But I am pretty sure I have seen it done somewhere...


Crime City 1.30 has it, cant find out how he did it though...
« Last Edit: 04 Mar 2005, 22:08:13 by Acecool » Logged
AK-Chester
Guest
« Reply #4 on: 05 Mar 2005, 03:20:02 »

The action needs to be ADDED locally.
Code:
? alive _unit && local _unit && _unit == player : _unit addAction ["Blah","blah.sqs"]
Logged
Acecool
Guest
« Reply #5 on: 05 Mar 2005, 03:42:44 »

Cool, thanks :-)

I think its working :-)))))

---

Formatting question now :-)

call format [{? alive _unit && local _unit && _unit == player : %1 addAction ["Statistics","Scripts/Stats.sqs"]}, _unit_id]

Doesnt wotrk :-/
« Last Edit: 05 Mar 2005, 04:05:05 by Acecool » Logged
Garcia
*
Offline Offline


Leeds United is the best football team...EVER!


« Reply #6 on: 05 Mar 2005, 12:35:16 »

The way I've done it is having 3 scripts

script 1:

Quote
? (unitname != player) : exit
#loop1
unitname removeaction actionname
#loop
? (something) : exit
?(unitname distance object1 <= 10): goto "start"
~2
goto "loop"

#start
actionname = unitname addaction ["Something","script2.sqs"]
#dcheck
? (something) : exit
?(unitname distance object1 > 10): goto "loop1"
~2
goto "dcheck"

script 2:

Quote
_unit = _this select 1
_unit removeaction spawnaction
something = true
publicvariable "something"
exit

script 3:

Quote
#loop
?(something): goto "start"
~5
goto "loop"

#start
~4
;what you want to happen here


exit

Script 1 first checks if the unit that you want to have the action is player on the computer, if not it exits. That way only the player you want to get the action gets it.
It then adds the action when the unit is within 10 m from a object (object1), and removes it when the unit is more than 10 m away. When the unit calls the action, he executes script2.sqs, which only removes the action and sets a variable to true and public variables it. You then have script3 that is running on every computer. It checks every 5 seconds if the variable is true, and when it is, it moves on in the script, where you add what you want to happen when the player uses the action Wink

That should work...worked for me Wink

Oh, and yes...you have to execute script1 and script2 in the init.sqs, and set the variable (something) to false in the init too...
« Last Edit: 05 Mar 2005, 12:41:52 by Garcia » Logged
Acecool
Guest
« Reply #7 on: 05 Mar 2005, 14:43:44 »

Hi, thanks for that post, but its a loop that just keeps going and going or?

? alive _unit && local _unit && _unit == player : _unit addAction ["Blah","blah.sqs"] -- works perfectly..


Just when I use this for respawn:
call format [{? alive _unit && local _unit && _unit == player : %1 addAction ["Statistics","Scripts/Stats.sqs"]}, _unit_id]

It doesnt work, formatting error..
Logged
AK-Chester
Guest
« Reply #8 on: 05 Mar 2005, 15:43:11 »

call format [{? alive _unit && local _unit && _unit == player : %1 addAction ["Statistics","Scripts/Stats.sqs"]}, _unit_id]

It doesnt work, formatting error..

This might work (not tested):
Code:
call format [{? alive _unit && local _unit && _unit == player : %1 addAction ["Statistics","Scripts\Stats.sqs"]}, _unit_id]
But... I don't really see the need for the call/formatting thingy here anyway. Instead, you should be able to do it like this:
Code:
? alive _unit && local _unit && _unit == player : player addAction ["Statistics","Scripts\Stats.sqs"]
In any case... make sure you use \ instead of / for path names.  Wink
« Last Edit: 05 Mar 2005, 15:43:29 by AK-Chester » Logged
Acecool
Guest
« Reply #9 on: 05 Mar 2005, 16:09:50 »

Would "player" point to the _unit?

Didnt work, still error in number expression or so...
Logged
Planck
Honoured
Former Staff
****
Offline Offline


I'm never wrong ....I'm just not always right !


« Reply #10 on: 05 Mar 2005, 16:15:50 »

It might help a bit if you posted the exact error, including the '#'.


Planck
Logged

I know a little about a lot, and a lot about a little.
Acecool
Guest
« Reply #11 on: 05 Mar 2005, 16:17:18 »

Error, invalid number in expression - is all I see

call format [{? alive _unit && local _unit && _unit == player : %1 addAction ["Statistics","Scripts/Player/Stats.sqs"]}, _unit_id]
Logged
Planck
Honoured
Former Staff
****
Offline Offline


I'm never wrong ....I'm just not always right !


« Reply #12 on: 05 Mar 2005, 16:24:16 »

Despite what Ak-Chester said you are still using '/' instead of '\' for the paths.

you should try his alternate code as well.


Planck
Logged

I know a little about a lot, and a lot about a little.
AK-Chester
Guest
« Reply #13 on: 05 Mar 2005, 16:28:57 »

Would "player" point to the _unit?
Yup, since this only adds the action to a player unit, and only if _unit == player. So, in this case, it makes no difference if you add the action to "player" or "_unit" - they're the same here.
Code:
? alive _unit && local _unit && _unit == player : player addAction ["Statistics","Scripts\Stats.sqs"]
« Last Edit: 05 Mar 2005, 16:29:24 by AK-Chester » Logged
Acecool
Guest
« Reply #14 on: 05 Mar 2005, 16:54:17 »

ÃŽ tried that..

With the alternate code...

? alive _unit_id && local _unit_id && _unit_id == player : player addAction ["Statistics","Scripts\Stats.sqs"] - Error expected object - returned string...


#############


_unit = _this select 0

? _unit == p1 : _unit_id = "p1"
? _unit == p2 : _unit_id = "p2"
? _unit == p3 : _unit_id = "p3"
? _unit == p4 : _unit_id = "p4"
? _unit == p5 : _unit_id = "p5"
? _unit == c1 : _unit_id = "c1"
? _unit == c2 : _unit_id = "c2"
? _unit == c3 : _unit_id = "c3"
? _unit == c4 : _unit_id = "c4"
? _unit == c5 : _unit_id = "c5"
? _unit == c6 : _unit_id = "c6"
? _unit == c7 : _unit_id = "c7"
? _unit == c8 : _unit_id = "c8"
? _unit == c9 : _unit_id = "c9"
? _unit == c10 : _unit_id = "c10"

_unit removealleventhandlers "Killed"
_unit removealleventhandlers "Fired"

_msg = Format["%1 you died and will respawn in 1 Minute!", name _unit]
_unit groupchat _msg

~61
deletevehicle _unit
call format [{removeallweapons %1}, _unit_id]
? alive _unit_id && local _unit_id && _unit_id == player : player addAction ["Statistics","Scripts\Stats.sqs"]
Logged
AK-Chester
Guest
« Reply #15 on: 05 Mar 2005, 17:01:06 »

Well, your _unit_id is a string...  Roll Eyes
Logged
Acecool
Guest
« Reply #16 on: 05 Mar 2005, 21:52:10 »

Works here:
? alive _unit && local _unit && _unit == player : _unit addAction ["Statistics","Scripts/Player/Stats.sqs"]

Not _unit_id, I know, but I need to get it to work (Respawn script, Cant add to _unit as that is the dead body..)
Logged
Pages: 1 2 [All]   Go Up
  Send this topicPrint  
 
Jump to: