Jump to content
Sign in to follow this  
A-SUICIDAL

Question about setOwner

Recommended Posts

I use a missile script in my mission where the player has the ability to call a single missile strike, but what stinks about it is... the player receives no kill score points for anything that the missile kills. So I was wondering... since I never used "setOwner" or "owner" before, if maybe it might be possible to change the script and somehow make the missile itself owned by the player in hopes that maybe it would then give the player some kill points. I'm taking a wild guess on this, but does anybody know if that would work? And if "setOwner" and "owner" would not be a solution to this, what could I do to make the missile give the player kill points?

Share this post


Link to post
Share on other sites

Negative on setOwner and owner, they're unrelated to your problem. I believe it's not possible to give kill points to some arbitrarily, but someone else should have to confirm that.

Share this post


Link to post
Share on other sites

Did the team complete the objective? If so, that's all the points you need. :) Heck, guys I play with turn the scoreboard off entirely.

You might build the points into the missile script. Have it capture the target, then when the missile is destroyed check if the target was too and if so addscore to whoever ran the script?

Share this post


Link to post
Share on other sites

You might build the points into the missile script. Have it capture the target, then when the missile is destroyed check if the target was too and if so addscore to whoever ran the script?

Can you alter the scoreboard that shows when you press (default) "i"?

---------- Post added at 15:30 ---------- Previous post was at 15:25 ----------

http://community.bistudio.com/wiki/addScore

OK, I see now. You can alter the total score number, I asssume. I should go now and update my support scripts, but like you said, I don't care about those numbers anyway :).

Share this post


Link to post
Share on other sites
Can you alter the scoreboard that shows when you press (default) "i"?

Think it's an ACE thing actually, the score appears when you're disconnecting but in game i does nothing.

http://community.bistudio.com/wiki/addScore

OK, I see now. You can alter the total score number, I asssume. I should go now and update my support scripts, but like you said, I don't care about those numbers anyway :).

Ahh, ok, thought that was the how many kills you did, never have tried to keep score (other than bragging rights) so not sure! Sorry.

Share this post


Link to post
Share on other sites

Yeah, I never look at the score much either, but I have friends that do. They actually think that they are getting points when they kill a bunch of enemy using the "call missile" script.

It would be cool if I could some how detect how many enemy were killed by the missile and then at least addScore to the player that called the missile, like 1 point per each enemy killed by the missile.

Share this post


Link to post
Share on other sites

Well it should be easy to get an aproximation. Check for units within the radio of the missile blast, before and after the impact. The difference is the kill count.

Share this post


Link to post
Share on other sites

It's a laser designated bomb. The player must keep the target painted the entire time. I wouldn't know how to get the radius of the target before the bomb explodes. It's a modified version of a missile script originally created by Venori. I had problems where his missile sometimes took a long time to arrive depending on where you were located, also the missile would sometimes hit trees or mountains that were in the way, so I made the missile spawn 1000 meters up and 1000 meters behind the player that calls the missile. There is no jet, but it plays a jet sound. A timer and some hints added so you cannot call another missile for 10 minutes. Action to call missile gets added back after player respawns. Other than that it's pretty much the same missile script.

_missile is the name of the missile.

_target is the name of the target.

It doesn't take long for the missile to arrive.

Share this post


Link to post
Share on other sites
It's a laser designated bomb. The player must keep the target painted the entire time. I wouldn't know how to get the radius of the target before the bomb explodes.

If you have the target position, then before the explosion:

_unitsBeforeImpact = nearestObjects [_targetPos, ["Man","Car","Tank"], _radius];

_aliveUnitsBeforeImpact = [];
{
   if (alive _x) then {_aliveUnitsBeforeImpact = _aliveUnitsBeforeImpact + [_x]};
} forEach _unitsBeforeImpact;

And after the explosion:

_kills = {!alive _x} count _aliveUnitsBeforeImpact;

Share this post


Link to post
Share on other sites

I thought so Kylania, but I didn't want to feel stupid and ask, heh.

I'll try that now seba. Thanks

---------- Post added at 10:19 PM ---------- Previous post was at 09:40 PM ----------

Wow, it worked. I placed a few enemy groups on the hill and called a missile strike on them and after it exploded I had 23 kills and I counted 23 dead. I tested a bit further and at one point I turned my laser marker on and called the missile strike and then for a split second I turned my laser marker off and back on again and it gave me an error, and then missile never arrived either, so it might need a little tweaking to get it error free. I used a radius of 2000.

Share this post


Link to post
Share on other sites

Thanks seba. I had to change a few things, but it works perfect now. Well close enough anyway. Since it's for coop use, in case of an accidental TK would there be a way to script it to count how many "east" were killed in the radius only?

Also, I wanted to ask Kylania. When testing the missile script... if I call the missile and then turn the laser "off" and then "on" right away, the missile sometimes never gets back on track. Would it be possible to make it so instead of the missile going ballistic to some far away place when the laser dot is lost, to maybe have it keep heading to the location where the laser dot was last targeting? Like maybe add something like an invisible H that does a setPos loop at the location of the laser dot target - and if the laser is turned off - the missile continues heading towards the invisible H. I know it would sort of defeat the whole purpose of a guided missile, but there's like a 10 minute wait in my mission before the player can call another missile strike, and almost everybody that calls a missile strike always seems to screw it up by turning their laser off and on like 5 times - and then they wonder why the missile never shows up. lol. I actually had to add a hint that appears when they turn their laser off telling them:

hint composeText [parsetext format["<t size='1.2' align='center' color='#FF0000'>Laser target lost.</t><br/><t size='1' align='center' color='#FFFFFF'>Missile has gone ballistic!</t><br/><br/><t size='1' align='center' color='#FFFFFF'>You must keep your target painted with your Laser Marker at all times.</t>"]];

I use separate missile scripts for each player, which I guess works out well as far as the add addScore stuff goes.

Edited by A-SUICIDAL

Share this post


Link to post
Share on other sites

I use separate missile scripts for each player, which I guess works out well as far as the add addScore stuff goes.

Are you saying that you run the script in each individual player client machine? Because if you do, addscore won't work as you appear to expect.

https://community.bistudio.com/wiki/addScore

Effects of this scripting command are not broadcasted over the network and remain local to the client the command is executed on

Share this post


Link to post
Share on other sites

Quoted from Xeno:

Put the following into init.sqf:

Code:

if (isServer) then {
"paddscore" addPublicVariableEventHandler {
	((_this select 1) select 0) addScore ((_this select 1) select 1);
};
};

And on the client:

Code:

if (isServer) then {
player addScore _score_to_add; // for hosted environment
} else {
paddscore = [player, _score_to_add]; publicVariable "paddscore";
};

I then changed it a little to fit my scripts.

I do appreciate you reminding me about this since I otherwise would have forgotten.

Edited by A-SUICIDAL

Share this post


Link to post
Share on other sites

Yes, as you see locality is the problem. In multiplayer, addScore has to be run on the server. Makes sense when you think about it.

Apologies for not being clearer earlier. I was just rushing out to work when I made the post. (I saw what you wrote before the edit. :))

Share this post


Link to post
Share on other sites

Yeah, I was being funny. It's always funny when somebody takes the time to reply with, "You're doing it wrong" and then they don't bother to tell you the correct way to do it, lol. Actually, the funny part to me was the wiki link you posted, since the addScore wiki page does not offer a thorough explanation of how to use "addscore" correctly, yet it shows a "Global" icon at the top of the page and a script example that is identical to how I was doing it wrong, heh. That wiki addScore page seriously needs a user added comment from Xeno, like the one I posted(by Xeno) above.

I knew the script was only a few lines long. It's just that... addScore is not something I use everyday, so at the time - I kind of forgot how to apply it. I'm hoping I got it working correctly now.

Share this post


Link to post
Share on other sites
Thanks seba. I had to change a few things, but it works perfect now. Well close enough anyway. Since it's for coop use, in case of an accidental TK would there be a way to script it to count how many "east" were killed in the radius only?

Sure:

_unitsBeforeImpact = nearestObjects [_targetPos, ["Man","Car","Tank"], _radius];

_aliveUnitsBeforeImpact = [];
{
   if ((alive _x) && (side _x == east)) then {_aliveUnitsBeforeImpact = _aliveUnitsBeforeImpact + [_x]};
} forEach _unitsBeforeImpact;

Share this post


Link to post
Share on other sites
Yeah, I was being funny. It's always funny when somebody takes the time to reply with, "You're doing it wrong" and then they don't bother to tell you the correct way to do it, lol. Actually, the funny part to me was the wiki link you posted, since the addScore wiki page does not offer a thorough explanation of how to use "addscore" correctly, yet it shows a "Global" icon at the top of the page and a script example that is identical to how I was doing it wrong, heh. That wiki addScore page seriously needs a user added comment from Xeno, like the one I posted(by Xeno) above.

.

Those little icons are what should be just a start to a major overhaul of the wiki. I hate it when someone simply posts a link to the wiki after I ask an involved question. Now I realise I did exactly that. Agh! :)

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  

×