Project X Forums



It is currently Fri Mar 29, 2024 3:07 pm

All times are UTC




Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: Limit to 1 shot per turn, without ending turn
PostPosted: Fri Dec 13, 2013 9:11 am 
Offline

Joined: Mon Jul 30, 2012 9:45 am
Posts: 194
Thanks again Pyro, and so sorry i thanked you by pwning you the very first game we played with the newly created scheme, it's really verrrrrrrrrrrrrrrrrrrrry rare to get a donkey in crate i swear! :D

_________________
http://twitch.tv/wormsdotam | http://worms.am/hl | http://worms.am/zombieshopper | http://worms.am/golf | http://worms.am/holywar


Top
 Profile  
Reply with quote  
 Post subject: Re: Limit to 1 shot per turn, without ending turn
PostPosted: Fri Dec 13, 2013 7:05 pm 
Offline

Joined: Mon Jul 30, 2012 9:45 am
Posts: 194
Aaaaaaah... Seems we didnt test properly xD

Remember when amount of Holy's only refreshed after mouse over?
When used up all your Holy's the icon doesnt appear, and so you can't mouse over... The next turn you suddenly have 2 Holy's.

Fuck fuck fuck :( I was trying to start the +1 holy only after every1 had 1 turn (so like Delay 1) and after all this trying & testing i thought i had it, but now it's still fucked xD

Code:
require utils, stepsutils, p_utils;

void holy_war_extension::FirstFrame()
{
    ShowMessage("");
    ShowMessage("Good luck & Have fun. Start the HOLY WAR!");
    GG->WriteToChat(GG->curFont+3," ---------------------------- H O L Y  W A R ------------------------------",false);
    GG->WriteToChat(GG->curFont+1,"    - All weapons except the Holy Hand-Grenade end turn",false);
    GG->WriteToChat(GG->curFont+1,"    - You can stockpile your unused Holy Grenades",false);
    GG->WriteToChat(GG->curFont+1,"    - There is 1 emergency Girder in your inventory which does not end the turn",false);
    GG->WriteToChat(GG->curFont+3," ---------------- G O O D  L U C K  &  H A V E  F U N ----------------------",false);
}

bool HHG_turn_started;
int turn_number;
int loop_number;
int first_team;

override void CTurnGame::Message(CObject* sender,EMType Type,int MSize,CMessageData* MData)
{
 super;

 if (Type == M_TURNBEGIN)
 {
    HHG_turn_started = true;

 }
 if (Type == M_TURNEND)
 {
    HHG_turn_started = false;
 
 }
}
 
override void CWorm::Message(CObject* sender,EMType Type,int MSize,CMessageData* MData)
{
 super;
 local w = GetCurrentWorm(); 

 // Set HHG amout = 0 for all worms AT FIRST FRAME of the game.
 if (Type == M_FRAME && gframe == 1) // require stepsutils to be loaded;
 {
         local Weap = GetWeaponByName("Holy Hand-Grenade");
         GS->Info.SetWeaponEx(WormTeam, Weap->GetWeaponIndex(), Weap->GetPageIndex(), 0);

 }
 // Add +1 HHG for current worm only when his turn starts.
 if (Type == M_FRAME && w != NullObj && w->WormTeam==WormTeam) // require p_utils to be loaded;
 {
         if (HHG_turn_started)
         {
            local Weap = GetWeaponByName("Holy Hand-Grenade");
            turn_number = turn_number + 1;
           
            if(turn_number == 1){
               first_team = w->WormTeam;
            }
           
            if(w->WormTeam == first_team){
               loop_number = loop_number + 1;
            }
            if(loop_number > 0){

               //GG->WriteToChat(GG->curFont+3,"Add to existing Holys", false);
               GS->Info.SetWeaponEx(WormTeam, Weap->GetWeaponIndex(), Weap->GetPageIndex(), Weap->Count+1);

            }
            if(loop_number == 2){
               //GG->WriteToChat(GG->curFont+3,"Set Holys to 1", false);
               GS->Info.SetWeaponEx(WormTeam, Weap->GetWeaponIndex(), Weap->GetPageIndex(), 1);
               ShowMessage("Yay, Holy's =)");
            }
           
            HHG_turn_started = false;
         }
 }
}

_________________
http://twitch.tv/wormsdotam | http://worms.am/hl | http://worms.am/zombieshopper | http://worms.am/golf | http://worms.am/holywar


Top
 Profile  
Reply with quote  
 Post subject: Re: Limit to 1 shot per turn, without ending turn
PostPosted: Sat Dec 14, 2013 7:26 pm 
Offline
User avatar

Joined: Sun Apr 08, 2012 1:09 pm
Posts: 425
Location: Ukraine, Kyiv
Hm. I dont think i get exactily what`s the problem and how it should work.
My vision: it sohuld add 1 holy first and start wait 1 turn delay (so player can actually see that he got 1 holy, but its delayed)
Is that correct?

I see that you used another global variables to try to do that. I have to criticize your global variables names. They too "general" and can couse errors with other libs, cousing "variable redeclared" error. Notice my turn_started ariable has HHG_ tag, that makes name pretty unique, related to current scheme. I recomend in future operate more complicated names in case of global variables.

Also.. if task is like i wrote, there is no need to make global variables. We can do all inside one function, locally.

Also would be nice to have a scheme, so i could test it here, on my local pc. =) (dont want to look for it into network folder..)

_________________
Things to impress.


Top
 Profile  
Reply with quote  
 Post subject: Re: Limit to 1 shot per turn, without ending turn
PostPosted: Sat Dec 14, 2013 7:27 pm 
Offline
User avatar

Joined: Sun Apr 08, 2012 1:09 pm
Posts: 425
Location: Ukraine, Kyiv
-raffie- wrote:
Thanks again Pyro, and so sorry i thanked you by pwning you the very first game we played with the newly created scheme, it's really verrrrrrrrrrrrrrrrrrrrry rare to get a donkey in crate i swear! :D


Nevermind) Sometimes we loose, sometimes we win :) It was fun anyway :)

_________________
Things to impress.


Top
 Profile  
Reply with quote  
 Post subject: Re: Limit to 1 shot per turn, without ending turn
PostPosted: Sat Dec 14, 2013 9:27 pm 
Offline

Joined: Mon Jul 30, 2012 9:45 am
Posts: 194
Hey Pyro,

Well there are 2 different things:

1. Even without the changes i made, these was this issue: If player used up all his HHG's (so the HHG icon disappears from panel), the next turn his +1 added HHG doesnt show up, then the turn after that, there are 2 HHG. So the HHG gets added (when it doesn't show up), but the Weapon Panel doesn't get updated.

2. Change I made is ment to not have a HHG added the first turn of all players, but then start adding the +1 HHG from the 2nd turn on, exactly like u said :)

Oh, and yes, thanks for the advice about variable names, I'll remember that

(ps: i added the scheme and lib with my changes)


Attachments:
holywar.rar [4.96 KiB]
Downloaded 411 times

_________________
http://twitch.tv/wormsdotam | http://worms.am/hl | http://worms.am/zombieshopper | http://worms.am/golf | http://worms.am/holywar
Top
 Profile  
Reply with quote  
 Post subject: Re: Limit to 1 shot per turn, without ending turn
PostPosted: Sun Dec 15, 2013 9:00 am 
Offline
User avatar

Joined: Sun Apr 08, 2012 1:09 pm
Posts: 425
Location: Ukraine, Kyiv
Hm the problem is that you used SetWeaponEx against AddWeaponEx. why? :)

My tests showed up that if i use all holys (or dont use all, no matter) but if weap panel is opened at moment when weap is adding - it doesnt show up.
But it doesnt mean that it didnt add. If you press F9 - worm will choose HHG. But ye, its an issue a bit. But i have no idea how to update weap panel.
I see in list of Classes, there is one that should do it: CWeaponPanel - bool needUpdae
But how to get access to it - i don`t know.
What i know is that panel is updating after some event, like abother weap usage. If you use girder (which is doesnt end turn), you will see it appears.
What we could do.. is to "cheat", i guess. We after usage of last HHG, we could set it to 1, but with delay 1 turn :) So it will be visible but unavailable.
Or.. we could add into scheme some "hidden" weapon that doesnt do anything and set it to one and use it :D This will couse weap panel to update.

_________________
Things to impress.


Top
 Profile  
Reply with quote  
 Post subject: Re: Limit to 1 shot per turn, without ending turn
PostPosted: Sun Dec 15, 2013 9:05 am 
Offline
User avatar

Joined: Sun Apr 08, 2012 1:09 pm
Posts: 425
Location: Ukraine, Kyiv
In highlander, for example, event that makes weap panel to update - is worm`s death. But weaps actually adding to panel as soon as worm got 0 damage. Immidietly.
It just appears after that "event".
By the way.. usage of Parachute is also couse panel update.
We could use this.
By the way - i just tested, cheating about "weap 1 turn delay" works brilliant!

_________________
Things to impress.


Top
 Profile  
Reply with quote  
 Post subject: Re: Limit to 1 shot per turn, without ending turn
PostPosted: Sun Dec 15, 2013 9:48 am 
Offline
User avatar

Joined: Sun Apr 08, 2012 1:09 pm
Posts: 425
Location: Ukraine, Kyiv
Yay, i made it!

i found function that render weap icons:
GS->SetWeaponIcon( Page, Index, icon) !

So all fixed and now works!

This fix is GLOBAL. I`ve wrote extention of that class. So anytime when SetWeaponEx, AddWeaponEX or AddWeapon functions called - panel will be automatically updated!
It will automatically SHOW UP weaps in panel in any scheme where its used: this one, highlander or any else.

That extention i`ve wrote into p_utils.pxl.
Make sure to update it and get latest automatic panel rebuilding


You lib attached.
Attachment:
p_holy_war_extension.rar [1009 Bytes]
Downloaded 395 times

_________________
Things to impress.


Top
 Profile  
Reply with quote  
 Post subject: Re: Limit to 1 shot per turn, without ending turn
PostPosted: Sun Dec 15, 2013 5:17 pm 
Offline

Joined: Mon Jul 30, 2012 9:45 am
Posts: 194
Awesome to have that fix, and great for HL :)

So here's the Holy War lib with first turn 'delay' included, everything works perfect now :) Also included in the archive is the scheme.
And if anyone wants to download & play this scheme, don't forget you need to update Pyro's utils lib to latest version: p_utils


Attachments:
holy_war.rar [11.35 KiB]
Downloaded 427 times

_________________
http://twitch.tv/wormsdotam | http://worms.am/hl | http://worms.am/zombieshopper | http://worms.am/golf | http://worms.am/holywar
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 30 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Skin by Lucas Kane