What's the easiest way to do so? Anyone done this or similar before? I might be able to do it, but I have the slight feeling i'd do it too complicate
trigger with animated subvalve?
Moderator: Moderators
trigger with animated subvalve?
I want to launch a thread by a subvalve (animate/redvalve_nopulse) and I want the player to have to use it until it turned for e.g 360? (it shall rotate of course), then launch the thread. As soon as the player interrupts using the valve, it shall turn back.
What's the easiest way to do so? Anyone done this or similar before? I might be able to do it, but I have the slight feeling i'd do it too complicate
What's the easiest way to do so? Anyone done this or similar before? I might be able to do it, but I have the slight feeling i'd do it too complicate
trigger_use, setthread to a thread like this
that's useheld, as long as use is held, the loop keeps going, so make it very small increments, or use wait 1 or something to smooth it out.
Code: Select all
while($player useheld)
{
// rotate the thing and whatever else
}Moderator
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
thanks so far! u are using $player. In another script I saw something similar which used parm.other instead. What would be the difference?lizardkid wrote:Code: Select all
while($player useheld) { // rotate the thing and whatever else }
- MPowell1944
- Moderator
- Posts: 287
- Joined: Thu Jan 09, 2003 7:06 am
- Location: Woodstock, GA
- Contact:
I have a trigger to start the thread, so parm.other should be fine!?
Her'es what I have so far
but with this I get a
if ((!(parm.other.useheld) || !(isalive parm.other) || !(parm.other cansee $water_wheel 45 96)) && (level.wheelrot > 0))
if ((!(parm.other.useheld) || !(isalive parm.other) || !(parm.other ^
^~^~^ Script Error: NULL entity in parameter 1
several times and then a command overflow
Could u tell me what to do, plz?
Her'es what I have so far
Code: Select all
main:
...
level waitTill prespawn
thread water_prep
...
level waittill spawn
...
end
water_prep:
level.wheelrot = 0 //wheel is in startposition
level.waterrun = 0 //water is not in action
end
water_on:
while(1)
{
if ((parm.other.useheld) && (isalive parm.other) && (parm.other cansee $water_wheel 45 96))
{
if (level.wheelrot <= 360)
{
$water_wheel rotateZ 1
level.wheelrot++
}
if (level.wheelrot > 360 && level.waterrun == 0)
{
level.waterrun = 1 //water is moving
thread water_rise //thread to let water go up and down
wait .5
}
}
if ((!(parm.other.useheld) || !(isalive parm.other) || !(parm.other cansee $water_wheel 45 96)) && (level.wheelrot > 0))
{
$water_wheel rotateZ -1
level.wheelrot--
}
if (level.wheelrot <= 0)
{
level.wheelrot = 0
}
}
end
water_rise:
...
level.waterrun = 0
endif ((!(parm.other.useheld) || !(isalive parm.other) || !(parm.other cansee $water_wheel 45 96)) && (level.wheelrot > 0))
if ((!(parm.other.useheld) || !(isalive parm.other) || !(parm.other ^
^~^~^ Script Error: NULL entity in parameter 1
several times and then a command overflow
Could u tell me what to do, plz?
ok, but ime (in my experience) having a lot of NOT operators can be extremely confusing. but it's confusing to me all the NOTs you were going through,
it didn't make much sense to me :S
so if he's not holding USE, he's not alive, he can't see the water wheel, and the wheel rotation variable is at 0....if ((!(parm.other.useheld) || !(isalive parm.other) || !(parm.other cansee $water_wheel 45 96)) && (level.wheelrot > 0))
if ((!(parm.other.useheld) || !(isalive parm.other) ||
it didn't make much sense to me :S
Moderator
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
the NOT operators are for the case that
(the player does NOT press use-key OR is dead OR does NOT look to the wheel) AND the wheel is not in it's start position, the wheel shall rotate back to it's start position.
here's the status quo, which gives me a command overflow after having used the trigger
This is with 3 if-clauses, in descending order:
3rd: if the wheel's rotation variable is negative, it is set to 0
2nd: if the player releases the wheel (the trigger), the wheel shall rotate back
1st: if the player uses the trigger in a proper way, the wheel shall either rotate to it's end position or as soon as it has reached that, it shall stop and call the thread to let the water rise.
But, as stated, I get a possible infinite loop (command overflow) after a single move of the wheel. Unfortunately, I don't have any idea why or how to fix this.
(the player does NOT press use-key OR is dead OR does NOT look to the wheel) AND the wheel is not in it's start position, the wheel shall rotate back to it's start position.
here's the status quo, which gives me a command overflow after having used the trigger
Code: Select all
water_on:
self nottriggerable
while(1)
{
if ((parm.other.useheld) && (isalive parm.other) && (parm.other cansee $water_wheel 45 96))
{
if (level.wheelrot <= 360)
{
$water_wheel rotateZ 1
level.wheelrot++
$water_wheel playsound wheel_move
}
if (level.wheelrot > 360 && level.waterrun == 0)
{
level.waterrun = 1 //water is moving
$water_wheel playsound wheel_stop
thread water_rise //thread to let water go up and down
wait .5
}
self triggerable
}
if ((!(parm.other.useheld) || !(isalive parm.other) || !(parm.other cansee $water_wheel 45 96)) && (level.wheelrot > 0))
{
$water_wheel rotateZ -1
level.wheelrot--
$water_wheel playsound wheel_move
}
if (level.wheelrot < 0)
{
level.wheelrot = 0
}
}
end
3rd: if the wheel's rotation variable is negative, it is set to 0
2nd: if the player releases the wheel (the trigger), the wheel shall rotate back
1st: if the player uses the trigger in a proper way, the wheel shall either rotate to it's end position or as soon as it has reached that, it shall stop and call the thread to let the water rise.
But, as stated, I get a possible infinite loop (command overflow) after a single move of the wheel. Unfortunately, I don't have any idea why or how to fix this.
i.. honestly don't know what to do :S
try making a more artificial way, but it might work better.
like;
once the player hits and holds the wheel, use the bomb script used on stock maps to determine if he's hodling it and pop hte stopwatch etc. once the player lets go of the USE key, send a message (i guess that's impossible,so set a variable) and use a while loop based on that variable to make the wheel spin away.
i suppose you'll want to set it back to normal for looks, so maybe havea var at 0 at the beginning and increment it when the useheld thing is donw.. set it to rotateZ 1 and wait until it returns to original position.
anyway, you'll have to adjust the script somehow... only way i see to do it is use something that works already. *shrug*
try making a more artificial way, but it might work better.
like;
once the player hits and holds the wheel, use the bomb script used on stock maps to determine if he's hodling it and pop hte stopwatch etc. once the player lets go of the USE key, send a message (i guess that's impossible,so set a variable) and use a while loop based on that variable to make the wheel spin away.
i suppose you'll want to set it back to normal for looks, so maybe havea var at 0 at the beginning and increment it when the useheld thing is donw.. set it to rotateZ 1 and wait until it returns to original position.
anyway, you'll have to adjust the script somehow... only way i see to do it is use something that works already. *shrug*
Moderator
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
me neitherlizardkid wrote:i.. honestly don't know what to do :S
hehe, that's obviouslizardkid wrote:anyway, you'll have to adjust the script somehow... *
that's what i was asking for in the 1st postlizardkid wrote:only way i see to do it is use something that works already. *shrug*
let's see, maybe someone else finds a way or I'll do a (boring) alarmswitch
in fact, i also needed a 'break' to let the script find it's peace again after all that action
So, thanks for ur help and maybe take a look at the pk3 with bsp or the pk3 with map file in the recycling bin
So, thanks for ur help and maybe take a look at the pk3 with bsp or the pk3 with map file in the recycling bin