Project X Forums



It is currently Wed May 22, 2024 4:58 am

All times are UTC




Post new topic Reply to topic  [ 61 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7  Next
Author Message
 Post subject: Re: p_WEATHER (variable Snow/Rain/Nothing effects, w/lightni
PostPosted: Sun Jan 13, 2013 1:13 am 
Offline

Joined: Fri Feb 26, 2010 4:44 pm
Posts: 92
PyroMan wrote:
with your code you changing variable itself) don`t do that. change some third-party or local variable and set your stuff based on its values.


I change the script and then rename it to a new library eg p_weather_mod.pxl .. is that your concern?
is there any problem to do it?

I had some problems to rename libraries and wp_lightning and wp_tazer That if i use with your libs eg p_weappack_1_weapons the px scheme get this error

pxs: CError: TDP : ParseNext:
symbol lightiningBeamsprite is redeclared at lib:wp_lightning_mod.pxl

this only happens with these two libraries, other libraries such as modified wp_electromagnet does not give me error...
maybe your libs use wp_lightning o wp_tazer as a reference?


Last edited by Atr0x on Sun Jan 13, 2013 1:43 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: p_WEATHER (variable Snow/Rain/Nothing effects, w/lightni
PostPosted: Sun Jan 13, 2013 1:14 am 
Offline

Joined: Fri Feb 26, 2010 4:44 pm
Posts: 92
PyroMan wrote:
lol :D
but if u have 100 variables? will u check each of them: 1 || 2 || 3 || 4 || 5 || 6..... || 99 ?

i recommend use this code:

Code:
        local temp_chooser = RandomInt(1, 10);
   
        if (temp_chooser > 5)  sType =  3;
        else if (temp_chooser > 2) sType =  2;   
        else sType =  1;


and put it all inside "chooseType()" function



:lol:


Top
 Profile  
Reply with quote  
 Post subject: Re: p_WEATHER (variable Snow/Rain/Nothing effects, w/lightni
PostPosted: Sun Jan 13, 2013 2:22 am 
Offline
User avatar

Joined: Sun Apr 08, 2012 1:09 pm
Posts: 425
Location: Ukraine, Kyiv
[quote="Atr0xthis only happens with these two libraries, other libraries such as modified wp_electromagnet does not give me error...
maybe your libs use wp_lightning o wp_tazer as a reference?[/quote]

ofc both of them used as required...

I see you like change every***ingthing in the world.. I would recommend you to learn such scripting:
Against re-making and renaming libs you should learn how to modify libs with no touching original ones. That scripts can be not libs even - u can write them on schemes script list.
Here is an example how you can override function of my weather library, by loading original lib without any additional:

Code:
require p_weather;

override void CWeatherManager::chooseType()
{
local temp_chooser = RandomInt(1, 10);
   
        if (temp_chooser > 5)  sType =  3;
        else if (temp_chooser > 2) sType =  2;   
        else sType =  1;
}


if u need change only one variable (or few), but leave whole function as is - u need add "super" into overriding func before changing that variables that you need to be changed.

Good luck with it.

_________________
Things to impress.


Top
 Profile  
Reply with quote  
 Post subject: Re: p_WEATHER (variable Snow/Rain/Nothing effects, w/lightni
PostPosted: Sun Jan 13, 2013 2:49 am 
Offline

Joined: Fri Feb 26, 2010 4:44 pm
Posts: 92
PyroMan wrote:

if u need change only one variable (or few), but leave whole function as is - u need add "super" into overriding func before changing that variables that you need to be changed.

Good luck with it.



ok..ty


Top
 Profile  
Reply with quote  
 Post subject: Re: p_WEATHER (variable Snow/Rain/Nothing effects, w/lightni
PostPosted: Sun Jan 13, 2013 9:08 am 
Offline

Joined: Mon Jul 30, 2012 9:45 am
Posts: 194
PyroMan wrote:
Against re-making and renaming libs you should learn how to modify libs with no touching original ones. That scripts can be not libs even - u can write them on schemes script list.


Indeed, that's genius

_________________
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: p_WEATHER (variable Snow/Rain/Nothing effects, w/lightni
PostPosted: Sun Jan 13, 2013 4:22 pm 
Offline

Joined: Fri Feb 26, 2010 4:44 pm
Posts: 92
pls.... i must override wp_lightningstrike variable... healt+100 on resurrect and healt+100 in lightnings shot that hit worm...

what i must override into script in scheme list script..

i try..but it get me error aspect function


to change only two value what i can do?


Top
 Profile  
Reply with quote  
 Post subject: Re: p_WEATHER (variable Snow/Rain/Nothing effects, w/lightni
PostPosted: Sun Jan 13, 2013 5:35 pm 
Offline
User avatar

Joined: Sun Apr 08, 2012 1:09 pm
Posts: 425
Location: Ukraine, Kyiv
Atr0x wrote:
pls.... i must override wp_lightningstrike variable... healt+100 on resurrect and healt+100 in lightnings shot that hit worm...

what i must override into script in scheme list script..

i try..but it get me error aspect function


to change only two value what i can do?


you need override "LightningHit" function of lightning.
As soon as lightningstrike doesn`t use any variables to add health to resurrected worms, u can override whole parts of function with adjustments.
That function also contains info how many HP will need to add to the worm.

Code:
require wp_lightningstrike;

override void PxLightningStrike::LightningHit(CGObject *obj)
{
        if (obj != NullObj && obj->ClType == OC_Cross)
   {
       PxDeadWorm* deadworm1 = DW_M->DeadWormFromGrave(obj);
       if(deadworm1 != PxDeadWorm(NullObj))
            {
                deadworm1->Resurrect(100);
            }

   }
        else super;
        if(obj != NullObj && obj->ClType == OC_Worm)
   {
      // Heal worms
      CWorm *worm = CWorm(obj);
      
      if(worm->ResurrectedByLightning == false)
      {
         int health = GS->Info.GetWormHealth(worm->WormTeam, worm->WormNumber);
         GS->Info.SetWormHealth(worm->WormTeam, worm->WormNumber, health + 75); // becouse original script already has +25
      }
   }
}


this code will make resurrected worms with 100hp and add +100 hp if hit to worm.

p.s. it took me a bit of time and tests to adjust it, but its still works perfectly, as should.

_________________
Things to impress.


Top
 Profile  
Reply with quote  
 Post subject: Re: p_WEATHER (variable Snow/Rain/Nothing effects, w/lightni
PostPosted: Sun Jan 13, 2013 6:52 pm 
Offline
User avatar

Joined: Sun Apr 08, 2012 1:09 pm
Posts: 425
Location: Ukraine, Kyiv
other way:

Code:
require wp_lightningstrike;

override void PxLightningStrike::LightningHit(CGObject *obj)
{
        if (obj != NullObj && obj->ClType == OC_Cross)
        {
       PxDeadWorm* deadworm1 = DW_M->DeadWormFromGrave(obj);
       if(deadworm1 != PxDeadWorm(NullObj))
        {
                deadworm1->Resurrect(100);
        }

        }
        else if(obj != NullObj && obj->ClType == OC_Worm)
        {
      // Heal worms
      CWorm *worm = CWorm(obj);
      
      if(worm->ResurrectedByLightning == false)
      {
         int health = GS->Info.GetWormHealth(worm->WormTeam, worm->WormNumber);
         GS->Info.SetWormHealth(worm->WormTeam, worm->WormNumber, health + 100);
      }
         }
         else super;
}

_________________
Things to impress.


Top
 Profile  
Reply with quote  
 Post subject: Re: p_WEATHER (variable Snow/Rain/Nothing effects, w/lightni
PostPosted: Mon Jan 14, 2013 9:02 am 
Offline

Joined: Sun Jan 06, 2013 10:21 pm
Posts: 8
Had one of those rare instances of snow added to the terrain mucking with an object's collision box. Not sure if it's of any help, but GIFs are fun.
Image

Suffice to say I enjoyed the weapons I received from that worm's unfortunate demise.


Top
 Profile  
Reply with quote  
 Post subject: Re: p_WEATHER (variable Snow/Rain/Nothing effects, w/lightni
PostPosted: Mon Jan 14, 2013 2:58 pm 
Offline
User avatar

Joined: Sun Apr 08, 2012 1:09 pm
Posts: 425
Location: Ukraine, Kyiv
well, rarely, but this happens.
i will update script today-tomorrow. will try to fix this + will make lightning shot from random side, not onfly from left :)

_________________
Things to impress.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 61 posts ]  Go to page Previous  1 ... 3, 4, 5, 6, 7  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 8 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Skin by Lucas Kane