SOLVED: CHECK DOWN
Need a small hand on this script.
An animation plays eRepeat, eNoBlock.
Depending on that animations loop frame events should happen at random.
It is not Timer based.
There are 3 options at random.
Here is what I have:
Top of room script: int ran=2;
function room_RepExec()
{
ran++;
ran=Random(2);
if (cwitchey.View==90 && cwitchey.Loop==0 && cwitchey.Frame==2) // Then 3 options if animation at frame 2
if (ran==0)
{
// Do this
}
else if (ran==1)
{
// Do this
}
else if (ran==2)
{
// Do this
}
}
So far it does frame 2, shows an option (which has a delay of 50) and then the animation stops.
I am looking at adding if frame 5 as well.
all help much appreciated
EDIT
This seems to do the trick:
function room_RepExec()
{
ran++;
ran=Random(2);
if (cwitchey.View==90 && cwitchey.Loop==0 && cwitchey.Frame==2)
{
if(ran==0)
{
cELF.Say("Hello 1");
cELF.Say("Hello 1 again");
}
else if(ran==2)
{
cELF.Say("Hello 2");
cELF.Say("Hello 2 again");
}
else
{
cELF.Say("Hello 3");
cELF.Say("Hello 3 again");
}
}
}
I also want to declare:
if cElf >=250 give 3 options and also if <=251 give 3 options
Can you help please
EDIT EDIT EDIT This seems to have solved the case:
function room_RepExec()
{
ran++;
ran=Random(2);
if (cwitchey.View==90 && cwitchey.Loop==0 && cwitchey.Frame==2 )
{
if(ran==0 && cELF.y >=251 )
{
cELF.Say("Hello 1");
cELF.Say("Hello 1 again");
}
else if(ran==0 && cELF.y <=250 )
{
cELF.Say("Hello 1");
cELF.Say("Hello 1 again");
}
else if(ran==1 && cELF.y >=251 )
{
cELF.Say("Hello 2");
cELF.Say("Hello 2 again");
}
else if(ran==1 && cELF.y <=250 )
{
cELF.Say("Hello 2");
cELF.Say("Hello 2 again");
}
else if(ran==2 && cELF.y >=251 )
{
cELF.Say("Hello 3");
cELF.Say("Hello 3 again");
}
else if(ran==2 && cELF.y <=250 )
{
cELF.Say("Hello 3");
cELF.Say("Hello 3 again");
}
}
}
Can you explain this part to me (line 4 and 5):
ran++;
ran=Random(2);
You first set ran to increase repeatedly, immediately followed by setting it to 0, 1 or 2 randomly?
Hi
I copied an old script and forgot to take out :) (roll)