Scripting: How to make hedgehogs look like winners?

2 replies [Last post]
Wuzzy
Wuzzy's picture
User offline. Last seen 25 weeks 1 day ago. Offline
Joined: 2012-06-20
Posts: 1304

How can I make hedgehogs look like winners (the "awesome" face, like after they have won a normal match) with Lua scripting only?

I have already tried to use this code:

SetState(myHedgehog, gstWinner)

And this:

SetState(myHedgehog, bor(GetState(myHedgehog), gstWinner))

Both won't work. The hedgehog just looks like a normal hedgehog.
I noticed that sometimes the "awesome" face appears when the hedgehog is also moving/flying around (but never when the hedgehog stands on the ground). I have no idea why.

Hi, I am a Hedgewars developer. Smile

nemo
nemo's picture
User offline. Last seen 19 weeks 2 days ago. Offline
Joined: 2009-01-28
Posts: 1861

Unfortunately gstWinner clears itself once you are done falling, 'cause it was intended to be a cute little effect, not really manipulated by lua which didn't even exist at the time.

if (not isFalling)
and (hwAbs(Gear^.dX) + hwAbs(Gear^.dY) < _Shocking3) then
begin Gear^.State:= Gear^.State and (not gstWinner);

If a gear is active, it is gonna get the state cleared pretty much the instant you set it, unless it has a dY or the hog isn't touching the ground.

You could keep the hog hovering above the ground by manipulating Y or dY, but that's not really a good idea in terms of not freezing up the game state, sorry.

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

mikade
mikade's picture
User offline. Last seen 45 weeks 1 day ago. Offline
Joined: 2010-10-22
Posts: 355

While this isn't going to work with every hog, I assume your intention is to use this in your single hog TargetPractice missions that you were editing earlier today. If so, you can simply use:
ParseCommand("taunt " .. string.char(3))

mikade
Hedgewars Developer

User login

Copyright © 2004-2024 Hedgewars Project. All rights reserved. [ contact ]