Forum Jump :

Author Message


Posts: 73
Rank:


Level: Hidden

Country: ar
Location:
Occupation:
Age: 17
In-game name:

 
#1 Posted at 2010-02-02 03:50        
     
Guys! i'm need help!
I can't make an action from the action menu dissappear!
i've been literaly 1:30 hours trying... I read the editing guide, i read the BISTUDIOS scripting commands, I even tried to make my own way..
I just cannot get it to work!
I want this to happend: if you get in a radius of 3 meters from an ammo box ( named box1 ) then an action will be added: _refill = player addaction ["Refill ammunition.","ammo.sqs"];
the condition it's: ((player distance box1)<3)
but i want to make that if i am NOT in that 3 meters radius the action dissappears, witch doesn't!
here's the ammo.sqs:
~1
hint "5..."
~1
hint "4..."
~1
hint "3..."
~1
hint "2..."
~1
hint "1..."
~1
player addmagazine "30rnd_556x45_Stanag"
player addmagazine "30rnd_556x45_Stanag"
player addmagazine "30rnd_556x45_Stanag"
player addmagazine "30rnd_556x45_Stanag"
player addmagazine "30rnd_556x45_Stanag"
player addmagazine "30rnd_556x45_Stanag"
player addmagazine "handGrenade"
player addmagazine "handGrenade"
player addmagazine "handgrenade"
player addmagazine "handgrenade"
hint "Alright, ammo fully refilled! Wait 3 minutes for another refill!"

~180
hint "Ammo refill avalible again!"

i want to make that, after the last hint ( Ammo refill... ), you can use again the "refiller"... and so on, so on, so on.
...
and, if it's not too much trouble: it'll be a nice touch if the "refiller" gives only the magazines you've spend (NOT counting the handgrenades)
Guys.. I'd really appreciate your answer! please! i really need it!

This post was edited by SGJackson (2010-02-02 21:39, ago)


Author Message

W0lle  

call me evil


Posts: 1774
Rank:


Country: de
Location:
Occupation: CWR² Developer
Age: 98
In-game name: CWR2 PR

 
#2 Posted at 2010-02-02 05:57        
     
1. More exclamation marks you couldn't add, no?
2. Writing in all capital letters is considered screaming.
3. If you expect others solving your problems, could you then atleast describe in precise sentences what you want instead telling us bollocks about going crazy (which surely looks like judged by your post) or gonna make suicide?

I know you're just 13, but atleast try to act like a mature if you expect them to help you. Thanks.

Edit: Changed my mind after I found out you're not a legit ArmA2 owner. Go and ask your editing question where you got your game from...

This post was edited by W0lle (2010-02-02 15:13, ago)


Advertisement


Author Message


Posts: 18893
Rank:


Level: Super Admin

Country: nl
Location: The Netherlands
Occupation:
Age: 38
In-game name: Foxhound

 
#3 Posted at 2010-02-02 07:47        
     
Warning level +1 for typing in caps, both in the text as in your topic title.
You don't have many warnings left to go and since you don't have acces to the BI forums anymore I think you need to reconsider your posting behaviour.

Remove all the caps from your post and replace it with normal sized text.

Visit my family webshop desteigerhoutshop.nl.

Author Message


Posts: 73
Rank:


Level: Hidden

Country: ar
Location:
Occupation:
Age: 17
In-game name:

 
#4 Posted at 2010-02-02 21:40        
     
Alright, fixed it!
now could please someone answer it?
i meant.. if you've got the answer of course ¬¬
thnx!


Author Message


Posts: 75
Rank:


Level: Member

Country: nl
Location: The Netherlands
Occupation:
Age:
In-game name:

 
#5 Posted at 2011-07-07 17:23        
     
Why is this topic dead? Sorry for bumping but I also need this code.


Author Message

palyarmerc  

I live inside the editor


Posts: 752
Rank:


Level: Member PFS

Country: 00
Location:
Occupation: *Retired*
Age:
In-game name: *Retired*

 
#6 Posted at 2011-07-07 18:05        
     
You need a removeAction for an ammo crate or for anything that has addaction?
There has been posted numerous times now a Scripting Reference link in lots of Editing posts, also
there are numerous examples of addAction....numerous...(too many to count , that is...)

It pays to think about what you are trying to achieve, non-item-specific, if you catch my drift
;-)

..Rant over, the script is partially wrong anyway, it's not the player you want to add the action to.

cratefill= cratename addAction ["Refill ammunition.","cratefill.sqs"];

first few lines of cratefill.sqs would then be

_crate = _this select 0
_plyr = _this select 1

_crate removeAction cratefill

....that's all folks....!

Author Message


Posts: 75
Rank:


Level: Member

Country: nl
Location: The Netherlands
Occupation:
Age:
In-game name:

 
#7 Posted at 2011-07-07 21:16        
     
# palyarmerc : You need a removeAction for an ammo crate or for anything that has addaction?
There has been posted numerous times now a Scripting Reference link in lots of Editing posts, also
there are numerous examples of addAction....numerous...(too many to count , that is...)

It pays to think about what you are trying to achieve, non-item-specific, if you catch my drift
;-)

..Rant over, the script is partially wrong anyway, it's not the player you want to add the action to.

cratefill= cratename addAction ["Refill ammunition.","cratefill.sqs"];

first few lines of cratefill.sqs would then be

_crate = _this select 0
_plyr = _this select 1

_crate removeAction cratefill

I saw like 2 other ones, but i simply did understand how to use them. also i wasnt going to use his script, i just needed the command for my own script. Just going to add those commands now

Added 5 minutes later:

Ok so the script didnt really work well for me.
Because im simply trying to remove the action once it has been used.

Could explain the lines?

This post was edited by Greenpeacekiller (2011-07-07 21:27, ago)


Author Message

Pirin  



Posts: 1545
Rank:


Level: Member PFS

Country: us
Location: Atlanta, GA
Occupation: IT
Age: 40
In-game name: kylania

 
#8 Posted at 2011-07-07 21:39        
     
Can you give more detail about what you are doing Greenpeacekiller? This is how to remove an action from within the script that the addAction calls:

// These are the special variables passed by the action script.
_actHad = _this select 0;  // Object that had the Action (also _target in the addAction command)
_actUsed = _this select 1;  // Unit that used the Action (also _this in the addAction command)
_actID = _this select 2;  // ID of the Action

// Use them to remove the action.
_actHad removeAction _actID;


Author Message


Posts: 75
Rank:


Level: Member

Country: nl
Location: The Netherlands
Occupation:
Age:
In-game name:

 
#9 Posted at 2011-07-08 00:05        
     
# Pirin : Can you give more detail about what you are doing Greenpeacekiller? This is how to remove an action from within the script that the addAction calls:

// These are the special variables passed by the action script.
_actHad = _this select 0;  // Object that had the Action (also _target in the addAction command)
_actUsed = _this select 1;  // Unit that used the Action (also _this in the addAction command)
_actID = _this select 2;  // ID of the Action

// Use them to remove the action.
_actHad removeAction _actID;

I'm trying to make it so when you use the Addaction on a guy. They guy starts saying some lines, then activating a trigger. But if you talk to the guy, the action will still be there. and you can use it over & over again.

And I still dont really understand it.
How does "this select 0" work?

Also, i know this doesnt fit to the title but im going to ask it anyway instead of making a new topic for it.
How do you put a timer between the script
Example:
Command line 1.
Wait
Command line 2
etc

I heard you can use Sleep but every time i use it it just uses the last line and gives me a bunch of errors on top
And question 2.
Whats the command to trigger a trigger?
its been bothering me all day, and im simply stuck with my mission until i got this script working.


Author Message

Pirin  



Posts: 1545
Rank:


Level: Member PFS

Country: us
Location: Atlanta, GA
Occupation: IT
Age: 40
In-game name: kylania

 
#10 Posted at 2011-07-08 01:36        
     
Here's a demo mission that shows most of what you're asking about.

Run up to the woman and use the "Talk to her" action. As soon as you do you'll see that it goes away. This is from the talkToHer.sqf script.

When you call a script it's usually like this:

_nil = ["bob","mary"] execVM "names.sqf"];

The ["bob","mary"] part is called the arguments, a comma separated array of input for the script. Within the script this array is referred to as _this. So in this case _this select 0 (selecting the first, zero, position in the array) is equal to "bob". _this select 1 would select the second item in the array, "mary". If you were to reference just _this, then it would be equal to ["bob","mary"].

Inside the talkToHer.sqf you'll notice that I use sleep and globalChat to make her talk to you.

There's two methods I'm using to trigger a trigger as well. First we set a variable called womanangry to false in her init field. Then inside the dialog I set it to true. This sets off the uhuh trigger on the map who's condition was:

womanangry

Doesn't make sense right off the bat, but by putting the condition to that it's waiting for the variable, womanangry, to be true. That triggers the first trigger. Notice we gave it a Name of uhoh and it does nothing but play a Voice of a woman weeing under Effects. I attached it to her in her init field so it'll follow her around.

The second method of triggering a trigger is with the triggerActivated command. I put the second trigger's condition to:

triggerActivated uhoh

This waits for the trigger named uhoh to go off, then because I set it as a Countdown 5/5/5 it waits 5 seconds to do it's thing.

All makes sense? If now, ask more questions!


Author Message


Posts: 75
Rank:


Level: Member

Country: nl
Location: The Netherlands
Occupation:
Age:
In-game name:

 
#11 Posted at 2011-07-09 13:32        
     
Well i still find it very confusing, but i geuss ill just use this script and be done with it before i get brain damaged :-P