Home   Help Search Login Register  

Author Topic: Script wont work, very simple but..  (Read 1118 times)

0 Members and 1 Guest are viewing this topic.

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Script wont work, very simple but..
« on: 07 Sep 2008, 22:23:58 »
Hi I'm trying to get this very simple script to work. Here it is, the player walks up to a jeep, he is  a couple feet away, an action appears on the action menu to "destroy" the jeep through a script. Here is what I have in the init field of the player.


INIT: ("aP" is name of the player)
Quote
Ap addaction ["destroy","distance.sqs"]

MY SCRIPT: (T1 is name of the jeep)
Quote
aP distance T1 < 2; goto "blowup"

#blowup
T1 setdammage 0

Ap removeaction destroy

Exit

Funny thing is, the action appears on the action menu, I press it and the script produces no errors but here's the problem. Nothing works at all. The jeep doesn't get destroyed and the action doesn't get removed, so where did I go wrong?

Thanks for the help.


« Last Edit: 07 Sep 2008, 22:26:21 by NightJay0044 »
Who's hyped for Arma4, long live Arma!

Offline Gcfungus

  • Members
  • *
Re: Script wont work, very simple but..
« Reply #1 on: 08 Sep 2008, 00:10:42 »
With actions, it's easier to assign them names, rather than numbers.
So, you could add this:
Code: [Select]
destroy = aP addaction ["destroy","distance.sqs"]Also, the script needs changing:
Code: [Select]
?(aP distance T1 > 2):exit
T1 setdammage 1
aP removeaction destroy

You didn't assign the action a name. Also, you changed the case of aP, which I think changes it. Also, the syntax for the if statement needed changing. Finally, the setdammage ranges from 0 to 1. 0 being completely healthy, 1 being dead. You fixed it.
Should work, haven't tested but if you have any problems just give us a bell. They're easy mistakes to make, and takes some time just to realise what's wrong.  :) :good:
-=GC=-Fungus1999
« Last Edit: 08 Sep 2008, 00:12:15 by Gcfungus »
The object of war is not to die for your country, but to make the other bastard die for his.
~George Patton

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Re: Script wont work, very simple but..
« Reply #2 on: 08 Sep 2008, 10:33:16 »
Thanks for the help, oh yeah I didn't realize or think about if 1 was dead or 0 was alive for the setdammage command.

One more thing, why when using the "Distance" command do you have to use these marks () around the distance command?  No where in the Command Reference at OFPEC does it tell you to put them in there. SO how does a reader know what he's doing right or wrong without needing help from another person when it's in the Command Reference?

That's one thing where the command reference really confuses me, but that's another topic.

Thank you.
Who's hyped for Arma4, long live Arma!

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Script wont work, very simple but..
« Reply #3 on: 08 Sep 2008, 12:26:20 »
The COMREF example does not require brackets because it's not part of a conditional statement. This is a basic principle of scripting which it's assumed everyone already knows. Evidently not. Perhaps it's time for a few more examples to be added to the COMREF...  :scratch:

Offline NightJay0044

  • Former Staff
  • ****
  • Let's make OFPEC great again
    • My Steam Workshop
Re: Script wont work, very simple but..
« Reply #4 on: 09 Sep 2008, 02:38:15 »
Oh well when you say; "A basic principle of scripting" it doesn't fall under my skills to much. I don't have to much experience in scripting.  I suppose I need to upgrade my sklls then.  :D
Who's hyped for Arma4, long live Arma!