Jump to content
Sign in to follow this  
Spudgunner

waitUntil or getDammage problem

Recommended Posts

SOLVED: :16_6_8: I made a really stupid mistake. I can't believe I was using the wrong variable. The sniper was doing the shooting and the variable I should have used was "lookout", who is also a sniper unit. :o

For some reason this code is not allowing the camera to move to the next scene. The idea is to change to camera scene TWO when sniper is damaged or killed. To ensure he is killed, I have used setDamage 1 from a trigger. Everything worked until I added this code:

//snipers full health value: should be 0
_num = [url="http://community.bistudio.com/wiki/getDammage"]getDammage[/url] sniper;

//Camera scene ONE

[url="http://community.bistudio.com/wiki/waitUntil"]waitUntil [/url]{ _num != (getDammage sniper)};

// camera scene TWO

Can anyone see what's causing the problem?

Edited by Spudgunner
add links; SOLVED

Share this post


Link to post
Share on other sites

_num never changes, so the waitUntil never triggers.

Try

waitUntil {getDamage sniper > 0};

Or use the handleDamage eventHandler.

Share this post


Link to post
Share on other sites
_num never changes, so the waitUntil never triggers.

Try

waitUntil {getDamage sniper > 0};

Or use the handleDamage eventHandler.

_num is not meant to change as it hold the full heath value but it should trigger when compared to the new value.

I tried > 0, also != 0 and == 1, but none of these allows the script to move onto the next camera scene. I've never used a EventHandler before but I tried this in my camera scene script - but it didn't work:

isHurt= false;
_EHdamIdx = sniper addEventHandler ["dammage", {isHurt = true}];

// camera scene ONE

waitUntil {isHurt == true};

// camera scene TWO

The spelling of damage as dammage is how it is spelt in the wiki.

Edited by Spudgunner
mistake

Share this post


Link to post
Share on other sites

Is it throwing out a script error or just not triggering?

If you're taking the boolean route, be sure to define it first. (isHurt = false) It doesn't always matter but in some cases the script shits itself when something is undefined.

That said, the first idea you were working with worked for me:

_currentHealth = damage untSniper;
waitUntil {_currentHealth != (damage untSniper)};
hint Format ["Pop! %1", damage untSniper];

Share this post


Link to post
Share on other sites

:16_6_8: SOLVED: I made a really stupid mistake. I can't believe I was using the wrong variable. The sniper was doing the shooting and the variable I should have used was "lookout", who is also a sniper unit. :o

Is it throwing out a script error or just not triggering?

If you're taking the boolean route, be sure to define it first. (isHurt = false) It doesn't always matter but in some cases the script shits itself when something is undefined.

That said, the first idea you were working with worked for me:

_currentHealth = damage untSniper;
waitUntil {_currentHealth != (damage untSniper)};
hint Format ["Pop! %1", damage untSniper];

It might be the way the sniper unit is killed. I'm using setDamage 1 to kill the sniper and the enemy unit fires his weapon just to make the noise. I used a trigger earlier with a boolean expression, just to test waitUntil, which worked. So the problem lies with the getDammage command. I noticed you use "damage" instead of "getDammage", maybe thats the reason. I'll try again, thanks.

Edited by Spudgunner
Solved problem

Share this post


Link to post
Share on other sites

The eventHandler was handleDamage, not just damage. You're right about getDamage vs getDammage. They fixed this super old typo with setDamage/setDammage but apparently not with get... Odd. You could have used just damage as well. :)

Here's a demo mission which shows a camera scene, then whenever the sniper takes any damage at all, it triggers a second camera scene.

Share this post


Link to post
Share on other sites
The eventHandler was handleDamage, not just damage. You're right about getDamage vs getDammage. They fixed this super old typo with setDamage/setDammage but apparently not with get... Odd. You could have used just damage as well. :)

Here's a demo mission which shows a camera scene, then whenever the sniper takes any damage at all, it triggers a second camera scene.

Thanks, I'll take a look at the files. I can't run it yet as I haven't got OA.

I'm suprised they haven't sqf'ied sqs in OA for camera work.

I've preety much solved the problem. The problem was me! I was using the wrong variable all along. :D Hours lost over one error -nearly cost me the war.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×