Home   Help Search Login Register  

Author Topic: scripting new characteristics to a unit  (Read 1096 times)

0 Members and 1 Guest are viewing this topic.

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
scripting new characteristics to a unit
« on: 14 May 2008, 23:48:19 »
 greetings,

is it possible (via script only).. to make a man drive like a car?

i was thinking about being out in the desert and have an addaction command like "sit down" and the unit preform the 'sitdown' animation and stays there... then somehow?? he becomes a car, but only in movement with the keyboard.

it would look like a yogi skimming along the beach on his butt.

thx

Offline Loyalguard

  • Former Staff
  • ****
Re: scripting new characteristics to a unit
« Reply #1 on: 15 May 2008, 00:09:19 »
It is possible, but would require quite a bit of work...first you would need to use playMove or switchMove to get the right animation.  Then set up a display event handler for the movement keys.  Finally, tie the movement keys into the setPos command to move the unit.

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
Re: scripting new characteristics to a unit
« Reply #2 on: 15 May 2008, 00:12:20 »
Then set up a display event handler for the movement keys.  Finally, tie the movement keys into the setPos command to move the unit.

i understand how to do the addaction and animation.. but the last two are new to me.

can you explain a little bit more, then i will have a direction to start digging through the forums.

edit:  :dry: i was looking at the BI wiki and i see now what you mean about... a lot of work.
« Last Edit: 15 May 2008, 05:04:35 by loki72 »

Offline Loyalguard

  • Former Staff
  • ****
Re: scripting new characteristics to a unit
« Reply #3 on: 15 May 2008, 10:15:42 »
The display event handler checks for key up (and or down) events and gives you the ability to run uniqe code for each key.

Then I think constantly updating the units position with setPos is the only way to make the unit move because setVelocity will not work for man class objects that are touchng the ground.