Home   Help Search Login Register  

Author Topic: Newbie and the Bomb script  (Read 761 times)

0 Members and 1 Guest are viewing this topic.

Aryion

  • Guest
Newbie and the Bomb script
« on: 11 Dec 2004, 06:53:16 »
ok im new here, and i need help on a script im learning.

im using Johan Gustafsson's Scripting Tutorial, and i seem to be having issues getting the scripts to work....it doesnt say any errors...the scripts just do not work, i've done everything i could think of so i come here asking for help

(i have no idea how to make that little code box to throw this script in)
ok now does anything look wrong with this script that might be messing me up?

=====================================================

; A small script that will blow up a vehicle as soon as a specific unit gets into it

; Get the unit that will be affected
_Unit = _this select 0
; Get the vehicle that will be affected
_Vehicle = _this select 1

; Main loop
#Update

; Check if the unit is in the vehicle
? (_Unit in _Vehicle) : goto "BlowUp"

; Wait 2 seconds
~2
goto "Update"

; The unit must be in the vehicle
#BlowUp
; Destroy the vehicle
_Vehicle setdammage 1
exit

=====================================================

it might also be possible that i need to update my ofp, but id perfer not to because me and my friend like to play online and downloading the patch from gamespy takes way to damn long.

any help will be welcome.

bored_onion

  • Guest
Re:Newbie and the Bomb script
« Reply #1 on: 11 Dec 2004, 12:37:38 »
the script looks fine but it may depend on how you're calling it. firstly, is it in your missions folder and is it an 'sqs' file?(seems basic but ive done it) secondly, do you have a trigger/init field with the following line:
Code: [Select]
[unit,car] exec "nameofscripthere.sqs"
third, have you named each of the units to be concerned as you have in the brackets above (in my case 'unit' is the man and 'car' is the vehicle). finally, in the above line of code have you called the right script (in my case i would call 'nameofscripthere.sqs' and the script in my missions folder would be called 'nameofscripthere.sqs')

apologies if im being too patronising

btw to make some thing in a line of code you need to put a "[" then write "code" then a "]" at the start of your encoded bit and at the end put "[" then "/" then"code" then "]". i would write it out but that would put it into code :)

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:Newbie and the Bomb script
« Reply #2 on: 11 Dec 2004, 12:43:30 »
Hmm...

First: update your game to the latest version. Try the BIS site if the other site is too slow, I didn't have any problems downloading from there. There is absolutely no reason to stay in an older version. I think your script doesn't need a new version, but I don't know for sure about your version so update now. You'll need the updated version when you start making use of newer features in the scripting language. Make sure your friend updates too.

 ;D

You are not telling how you are calling the script... are you calling it at all?

Has to be like

[unit,vehicle] exec "script.sqs"

for example in object's initialization field or in a init.sqs file.

Make sure the mission editor is in advanced mode.

I don't see any errors in the script itself. I tried the script and it works just perfectly.

I called it from the player's initialization field like this:

[this,jeep] exec "script.sqs"

where jeep is of course the name of the vehicle that is "trapped".

  :)

Offline MachoMan

  • Honoured
  • Former Staff
  • ****
  • KISS, Keep it Simple Stupid
Re:Newbie and the Bomb script
« Reply #3 on: 11 Dec 2004, 13:41:23 »
Wow, now hold it u all, this is gonna eat cpu power:

This is exactly why BIS gave us the Event GetIn. So please use an addEventHandler "GetIn".
Get those missions out there you morons!

bored_onion

  • Guest
Re:Newbie and the Bomb script
« Reply #4 on: 11 Dec 2004, 14:40:36 »
their using a tutorial so we wanna get that understood before we suggest anything else

Aryion

  • Guest
Re:Newbie and the Bomb script
« Reply #5 on: 11 Dec 2004, 20:10:16 »
Ok thanks guys for the help so far, and sorry for not telling how i call it.

but i believe im calling it properly, i name the soldier "ap" and then on the jeep in the init field i put

[ap, this] exec "bomb.sqs"

and its in my folder where the mission is...i plan on updating today so i'll try that...

but i still get nothing...the only other thing i can think of is that when i save it, it secretly makes it a bomb.sqs.txt file...i think i read that it might do that at some time...not too sure, but as far as i can tell everything is right.

sorry about the delay in responding.

thanks

Edit:

Might i also add that the simple hello script doesnt work either when i try and use it

; My first script will show a message for the user.
; Say Hello!
TitleText ["Hello!", "plain down"]
; Exit
Exit

then i would call it on the player with

[] exec "hello.sqs"

as far as i can tell im doing everything right
« Last Edit: 11 Dec 2004, 20:46:03 by Aryion »

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:Newbie and the Bomb script
« Reply #6 on: 11 Dec 2004, 20:53:06 »
 ::)

You are using Notepad, right?

Save As...

change the file format to "All Files"

and then write the file name with .sqs extension.

Should be no problem.

If the script file is in the correct folder, it should work.


 :P

If you already did this correctly, then I don't know what the problem could be.

Configure your Windows to show file extensions:

http://www.granneman.com/techinfo/windows/showextensions/

 ;)
« Last Edit: 11 Dec 2004, 21:01:40 by Baddo »

Aryion

  • Guest
Re:Newbie and the Bomb script
« Reply #7 on: 11 Dec 2004, 21:01:57 »
ya that didnt work, thx for the help anyway though...i have no idea whats wrong with this....i can see this issue taking a while to fix...sigh haha and i thought i might be getting somewhere with the scripting,  it doesnt seem to be all that hard.

Edit: wait...i just did that extension thing to see and it says its a .sqs.txt file...thats my problem isnt it? how can i fix it?
thanks in advance
« Last Edit: 11 Dec 2004, 21:07:04 by Aryion »

Offline Baddo

  • Former Staff
  • ****
  • Reservist Jaeger
Re:Newbie and the Bomb script
« Reply #8 on: 11 Dec 2004, 21:11:26 »

I already told you how to fix it...

Read my previous post.

 :)

Aryion

  • Guest
Re:Newbie and the Bomb script
« Reply #9 on: 11 Dec 2004, 21:36:38 »
HORAY! that did it thanks alot, you've been a big help.
....now do i have to close this topic somehow or just ignor it?

haha thanks again