Home   Help Search Login Register  

Author Topic: help a scripting newbie please  (Read 918 times)

0 Members and 1 Guest are viewing this topic.

philjk

  • Guest
help a scripting newbie please
« on: 02 Mar 2005, 02:59:22 »
Help with making a unit start mission in building or on tower.
Ive tried this method but doesnt work for me.

In the mission editor, put a Player unit near the tower you want, make the unit so that it is controllable by you. Place a trigger anywhere and set Activate to "Radio Alpha", change "Once" to "Repeatedly", and put the follwing linein the "On Activation" line:
hint format["Location: %1\nAzimut: %2",getpos player,getdir player]

Hit preview, and climb the tower. Position youself exactly where you want the unit to be, facing the way you want him and everything.

Radio in, (0-0-1), and the position and azimuth will be displayed on the screen.

Next place a unit near the tower.

Using your numbers, in his Init field type:
this setpos [x,y,z];

i opened a intro.sqm that came with this file and took the [x,y,z] of a unit that started the mission in a building on first floor.After making a trigger in the game editor
I started mission and went to the units position and excecuted the above instructions.

The [x,y,z] of unit was
[4897.741211, 63.130798, 6920.581543]

The [x,y,z] of the results i got were
[4899.23, 6921.18, 0.00323486]

Help please. any simple script would be a god send

cirkut5732

  • Guest
Re:help a scripting newbie please
« Reply #1 on: 02 Mar 2005, 03:20:14 »
Hey, Im a noob too and first of all-Are you gonna play as the unit in the tower or do you just want a guy standing there looking pretty, if that is the case then use the mission editor to create a tower where you want and place your loon (unit) directly in the same spot, so when you preview your mission he will be standing underneath the tower or very close so adjust him where you want him. Next its all about making the unit "appear" as if he's standing in the tower so you use this script in the init line to raise him in the air...this setpos[getpos this select 0, getpos this select 1, (getpos this select 2)+1)  
the +1 can be adjusted, you want to go up so use positive numbers until he is standing on the tower, to go down use negative -1 -2 etc..
Hope this helps this is how i place a guard in a tower

Offline penguinman

  • Contributing Member
  • **
  • Money is worthless, just paper, ink, and threads
Re:help a scripting newbie please
« Reply #2 on: 02 Mar 2005, 03:24:16 »
lol just place him around and keep experimenting and he will automaticly go in the spot you want,. if it is the default bis tower. if u place him in the triangle of the icon on the mission editor map.

cirkut5732

  • Guest
Re:help a scripting newbie please
« Reply #3 on: 02 Mar 2005, 03:30:20 »
penguinman are you saying that if you put the soldier directly under the bis tower he will automatically be "in" the tower, I cant get him to do that, Ive read around that you have to set the height? If you can really do it with out adjusting the height please let me know, Make my editing easier LOL!!
Thanks

philjk

  • Guest
Re:help a scripting newbie please
« Reply #4 on: 02 Mar 2005, 03:45:54 »
Thanks for reply. The unit in tower is just going to stand and look pretty "lol". what happens though when i want to put unit in building on first floor lets say east unit. Have him guard a civil. so when i go in he will shoot at me

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:help a scripting newbie please
« Reply #5 on: 02 Mar 2005, 19:49:24 »
This is an odd scirpting thing, however I have discovered this.
For some odd reason or another, in the mission.sqm file, the order of position is actually [_x,_z,_y]!! I have no idea why it is in this order, but it is nonetheless.
So in order to convert the postion ie what you said: [4897.741211, 63.130798, 6920.581543] so the actual position should be  [4897.741211, 6920.581543,63.130798].
(Notice the switched _Z and _Y positions) This is why your radio script and mission.sqm pos do not match.
« Last Edit: 02 Mar 2005, 19:51:45 by RujiK »
I like your approach, lets see your departure.
Download the New Flashlight Script!