Home   Help Search Login Register  

Author Topic: actions, variables and rank...  (Read 810 times)

0 Members and 1 Guest are viewing this topic.

Joukov

  • Guest
actions, variables and rank...
« on: 19 Oct 2005, 04:32:31 »
Yea it worked, thanx alot......
I have a few more questions,
1. Is it possible to remove a specific action from a unit? I know about the unitname removeAction "#", but it doesnt seem to work...  So i was wondering if you can remove a specific action by specifying it's name... Or if it is possible to remove all actions.
2. First of all how do i define a variable, like do i have to specify what type of a variable it is ant if yes, then what types are there. Also if i define a variable in the description.ext (in a campaign), would I be able to change that variable from in the game?
3. For the identities, is it possible to set the rank, and to update it in the game?
Sorry if uh, my q's are sorta confusing.... thanx for all the help!

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:actions, variables and rank...
« Reply #1 on: 19 Oct 2005, 08:17:30 »
1. when adding an action, give it a name like this

Code: [Select]
my_action = unit_name addaction ["foo","foo.sqs"]
to remove that particular action, use

Code: [Select]
unit_name removeaction my_action
had you checked the comref you would have known that one already...

2. variables don't need to be defined as such, as flashpoint will initialise them the first time it sees them. it is good programming practice to tell flashpoint about arrays though. define them like so

Code: [Select]
my_array = []
3. rank cannot be changed in-game. rank can be set when creating new units in-game - see the createunit command.

finally, it's easier for us at ofpec to help you if you stick to one question per thread. what happens is that once threads are solved, we go through them all and pick the ones which are the most asked. those then get made into FAQ entries. however, if there are threads like this, with a bunch of questions being dealt with, it's more difficult to sort them out.

in future, one question per thread please, unless they are directly related to each other i.e. how do i get a loon in a sled, how do i get that loon to drive that sled down a chimney and deliver presents while saying 'ho ho ho'... ;)
« Last Edit: 19 Oct 2005, 08:19:06 by bedges »

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:actions, variables and rank...
« Reply #2 on: 19 Oct 2005, 09:41:36 »
Quote
it is good programming practice to tell flashpoint about arrays
::)
It is vital to 'tell' OFP about arrays or you will not be able to use them...

If you have in your scripts something like:
Code: [Select]
? (_dude hasWeapon "M16"): _dudeArr = _dudeArr + [_dude]It will not work..
You must first initialize the _dudeArr like in your (bedges) example..

Same practise should be used for boolean variables (true/false or 1/0)...
Otherwise you might get some odd unwanted behaviours with your scripts or triggers...

Quote
had you checked the comref you would have known that one already...
IMO the method mentioned by Tactician in there is much better, no need to name your actions etc... :P
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:actions, variables and rank...
« Reply #3 on: 19 Oct 2005, 20:26:41 »
1.   You cannot remove hardcoded actions like "reload" or "get in as driver".


2.  You don't have to define variables.   If the game meets an undefined variable it will treat the whole expression as false.    Variables don't have types.   If you wanted to be safe and define all your variables, you could do it in your init.sqs

var1=false
var2=false

I don't know much about campaigns but description.ext is not a place for variables.   Variable values can be changed from anything to anything else at any point.    Use saveVar to transfer variable values from one mission to another in a campaign.


3.  bedges is correct, rank cannot be changed during the game.
Plenty of reviewed ArmA missions for you to play