How do i detect if a unit is on water?
Is there sth like a default call where i can insert stuff like smoke coming from a exhaust or custom calculations with variables?
Some questions on unit scriting
Moderator: Moderators
-
- Posts: 916
- Joined: 27 Jun 2009, 01:32
Re: Some questions on unit scriting
For like a hovercraft driving on water there's this:
... you can use like this then (here a hovercraft spawning some "wave" particles):
There's also the IN_WATER value (probably should be in the exptype.h - should be number 28 of the get/set values). You can use that like this:
everything here is COB code
Code: Select all
setSFXoccupy(Func_Var_1)
{
Static_Var_1 = Func_Var_1;
}
Code: Select all
StartMoving()
{
signal SIG_MOVE;
set-signal-mask SIG_MOVE;
while( TRUE )
{
if( Static_Var_1 == 1 )
{
emit-sfx 3 from wake1;
emit-sfx 3 from wake2;
emit-sfx 3 from wake3;
emit-sfx 3 from wake4;
emit-sfx 3 from wake5;
emit-sfx 3 from wake6;
emit-sfx 3 from wake7;
emit-sfx 3 from wake8;
emit-sfx 5 from wake1;
emit-sfx 5 from wake2;
emit-sfx 5 from wake3;
emit-sfx 5 from wake4;
emit-sfx 5 from wake5;
emit-sfx 5 from wake6;
emit-sfx 5 from wake7;
emit-sfx 5 from wake8;
}
if( Static_Var_1 == 2 )
{
emit-sfx 3 from wake1;
emit-sfx 3 from wake2;
emit-sfx 3 from wake3;
emit-sfx 3 from wake4;
emit-sfx 3 from wake5;
emit-sfx 3 from wake6;
emit-sfx 3 from wake7;
emit-sfx 3 from wake8;
emit-sfx 5 from wake1;
emit-sfx 5 from wake2;
emit-sfx 5 from wake3;
emit-sfx 5 from wake4;
emit-sfx 5 from wake5;
emit-sfx 5 from wake6;
emit-sfx 5 from wake7;
emit-sfx 5 from wake8;
}
sleep 300;
}
}
Code: Select all
if (isMoving && GET IN_WATER)
{
do stuff
}
Re: Some questions on unit scriting
When is the setSFXoccupy function called and what does it exactly return?
where would i have to place the lowest part? Is there a function thats always called, even if the unit stands still and does nothing?
where would i have to place the lowest part? Is there a function thats always called, even if the unit stands still and does nothing?
Re: Some questions on unit scriting
erik, would you be so kind to try and limit your new threads? You do not need a thread for each and every new issue that you come uppon.
We do have a general help thread.
We do have a general help thread.
Re: Some questions on unit scriting
Well most other forums have a "one subject per thread" rule to avoid cross discussing but nvm...
Re: Some questions on unit scriting
AFAIK setSFXoccupy is called when a unit enters water, leaves water, is picked up or dropped by a transport.Erik wrote:When is the setSFXoccupy function called and what does it exactly return?
There is no 'timer' function, however you can easily make one yourself. Like that:Erik wrote:where would i have to place the lowest part? Is there a function thats always called, even if the unit stands still and does nothing?
Code: Select all
MyTimer()
{
while(TRUE)
{
<do whatever you want>
sleep 200;
}
}
Create()
{
<usual Create() stuff>
start-script MyTimer();
}