Home   Help Search Login Register  

Author Topic: Pistol on table again lol  (Read 2621 times)

0 Members and 1 Guest are viewing this topic.

Offline Martin Kuka

  • Members
  • *
Pistol on table again lol
« on: 11 Aug 2006, 18:57:47 »
I took this script from earlier posts in here and modified it to fit the purpose of mine.
But no matter that it is strictly speciefied for a table which executes it, the weapon is still nowhere to be found.

Weapon = "weaponholder" createVehicle getpos _This
Weapon addMagazineCargo ["RevolverMag",4]
Weapon addWeaponCargo    ["Revolver",1]
Weapon Setpos [Getpos _This Select 0, Getpos _This Select 1, (getpos _This select 2) + 0.965]

Where is an error? At weaponholder? does it have to be specified too?
I see that just one simple answer will match it. ;D

Thanx, I promise that after this I`ll stop bothering and get to work on my campaign (1st ;D
Lets get rocked

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Pistol on table again lol
« Reply #1 on: 11 Aug 2006, 19:23:49 »
how is the script called?

Offline Martin Kuka

  • Members
  • *
Re: Pistol on table again lol
« Reply #2 on: 11 Aug 2006, 19:24:29 »
Campweapon.sqs
Lets get rocked

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Pistol on table again lol
« Reply #3 on: 11 Aug 2006, 19:30:20 »
no, not what is the script called, how is the script called....

Offline Martin Kuka

  • Members
  • *
Re: Pistol on table again lol
« Reply #4 on: 11 Aug 2006, 19:33:07 »
Yikes! Here is the original script:

table = _this select 0
_weapon = _this select 1
_mag    = _this select 2


Weapon = "weaponholder" createVehicle getpos _table
Weapon addMagazineCargo ["_mag",4]
Weapon addWeaponCargo    ["_weapon",1]
Weapon Setpos [Getpos _table Select 0, Getpos _table Select 1, (getpos _table select 2) + 0.95]

Script (my version) is called in Table Init if you mean this ;D
Lets get rocked

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Pistol on table again lol
« Reply #5 on: 11 Aug 2006, 19:42:38 »
mkay. what i meant was, how do you run (or "call") the script.

do you use

Code: [Select]
[this] exec "Campweapon.sqs"
or

Code: [Select]
[table_name] exec "Campweapon.sqs"
or etc.

either way, see the attached missionette for the working script. with any luck you should be able to work with that to get what you need.

Offline Martin Kuka

  • Members
  • *
Re: Pistol on table again lol
« Reply #6 on: 11 Aug 2006, 19:48:23 »
Oki thanx a lot :) As my script is specified for one unit only, so I simply use:

This exec "campweapon.sqs"

I did that with ammoboxes and it worked.
Lets get rocked

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Pistol on table again lol
« Reply #7 on: 11 Aug 2006, 20:33:14 »
right then. first thing - making multiple posts one after the other is something we like to avoid at ofpec. use the 'modify' button to edit your previous post if you have something to add.

secondly, re-reading the thread from the beginning it seems you have taken the original script and have modified it for use in your own mission. this is fine. but we're not talking about the same script now.

please post the script "campweapon.sqs", along with a description of how you are calling the script. then we can get on with solving your problem :)

also, don't worry about asking questions. that's the whole reason ofpec exists.

Offline Martin Kuka

  • Members
  • *
Re: Pistol on table again lol
« Reply #8 on: 11 Aug 2006, 22:40:06 »
No,lately I was talking about the script you offered me ;)
I made a quick revision and compared the header with header of some of my scripts.
Guess that I didnt find any error within, but OFP did:

_Table = _This select 0
weapon = _this select 1
_mag    = _this select 2   - Here the game engine noticed an error:

"_mag    = _this select 2 , Error: Can`t be splitted by 0.

I wish I could interprete this error more correctly, but right now I can`t switch to game.

Anyway it seems that there`s some complication in the 3rd line of the header.

And secondly ;D

I need stop asking at least for a while, otherwise you`ll only my posts and my project is laid for nothing ;)

BTW here is the script I`m talking about, I took from the missionette you posted a link to...

_table = _this select 0
_weapon = _this select 1
_mag = _this select 2


Weapon = "weaponholder" createVehicle getpos _table
Weapon addMagazineCargo [_mag,4]
Weapon addWeaponCargo    [_weapon,1]
Weapon Setpos [Getpos _table Select 0, Getpos _table Select 1, (getpos _table select 2) + 0.965]

exit

The script is called from target table`s init line as " [This] exec "table_weapon.sqs"



« Last Edit: 11 Aug 2006, 22:47:53 by Martin Kuka »
Lets get rocked

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Pistol on table again lol
« Reply #9 on: 11 Aug 2006, 23:01:55 »
okay. the problem lies in that the script is looking for 3 bits of information -

Code: [Select]
_table = _this select 0
_weapon = _this select 1
_mag = _this select 2

when you call the script using this exec "table_weapon.sqs", only one bit of information is being sent to the script - the table.

if you know that you only ever want to have revolvers on the table, use this script

Code: [Select]
_table = _this

Weapon = "weaponholder" createVehicle getpos _table
Weapon addMagazineCargo ["revolvermag",4]
Weapon addWeaponCargo    ["revolver",1]
Weapon Setpos [Getpos _table Select 0, Getpos _table Select 1, (getpos _table select 2) + 0.965]

exit

and call the script by using this exec "table_weapon.sqs" in the init line of the table.

however, if you want to be able to have different weapons on the table, you will have to give the script the name of the weapon and the name of the magazines too, as well as the table, by using [This, "weapon_name","magazine_name"] exec "table_weapon.sqs".

and using this script

Code: [Select]
_table = _this select 0
_weapon = _this select 1
_mag = _this select 2


Weapon = "weaponholder" createVehicle getpos _table
Weapon addMagazineCargo [_mag,4]
Weapon addWeaponCargo    [_weapon,1]
Weapon Setpos [Getpos _table Select 0, Getpos _table Select 1, (getpos _table select 2) + 0.965]

exit
« Last Edit: 11 Aug 2006, 23:08:14 by bedges »

Offline Martin Kuka

  • Members
  • *
Re: Pistol on table again lol
« Reply #10 on: 12 Aug 2006, 11:49:47 »
Now one more thing, the script is working, but weapon can`t be picked up....
Think that there was a reveal command somewhere...

Thanx for the script again ;D
Lets get rocked

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re: Pistol on table again lol
« Reply #11 on: 12 Aug 2006, 11:55:06 »
add

Code: [Select]
player reveal weapon
at the end of the script, before the 'exit'.

Offline Martin Kuka

  • Members
  • *
Re: Pistol on table again lol
« Reply #12 on: 12 Aug 2006, 12:22:37 »
Oki thanx a lot ;D
Lets get rocked

PetriHonka

  • Guest
Re: Pistol on table again lol
« Reply #13 on: 12 Aug 2006, 16:03:47 »
would the same apply if i wanted to have a radio on a table as whenever i place a radio and a table in the same place the radio appears underneath the table.

Offline JasonO

  • OFPEC Patron
  • ****
  • Oh no...
    • The New Life RPG
Re: Pistol on table again lol
« Reply #14 on: 12 Aug 2006, 18:35:52 »
would the same apply if i wanted to have a radio on a table as whenever i place a radio and a table in the same place the radio appears underneath the table.

The above meathod is not needed for a radio.

In the INIT field of the radio put the following:

Quote
this setpos[(getpos this select 0),(getpos this select 1),1]

Change the bold number at the end to adjust height for the table