Duke4.net Forums: EDuke32 Scripting - Duke4.net Forums

Jump to content

  • 119 Pages +
  • « First
  • 49
  • 50
  • 51
  • 52
  • 53
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is online   Danukem 

  • Duke Plus Developer

#1501

I kept it simple for you, but if you want the sounds to play until the doors close, then the actor could be coded to detect the activation that causes the door to close, then stop sounds after an appropriate amount of time. If you want to just time it without detecting the activation and hope for the best, then do this:

useractor notenemy SOUNDSTOPPER 0

ifvarvare sprite[THISACTOR].sectnum player[THISACTOR].cursectnum
{
  ifcount 60 // or whatever count you want
  {
  stopsound 394 
  stopsound 396
  }
}
else resetcount
enda


I'm assuming that the player is not going to leave the sector before the actor gets a chance to stop the sounds.

This post has been edited by Trooper Dan: 14 September 2014 - 12:01 PM

0

User is offline   Mark 

#1502

This should work because after entering the doors and the sector, the player is presented with differing scenarios on the left and the right. They will probably stay put for a couple of seconds before choosing which way to go.
0

User is offline   Zaxtor 

#1503

Question about ifcount, how to reset one without reseting another ifcount?
a thing that has 2 ifcount inside same area of the sprite

I'm trying to make a not too complicated sprite.

If you make "ifcount xx { does something resetcount }
It will reset the ifcount after it "does something" to avoid spam by doing it excessively fast.

But my useractor has 2 ifcounts.

Example.

useractor notenemy SPRITENAME

ifcount 2 { "does something" resetcount } <----(ok so reset is to reset this one )
ifcount 200 { killit } <----( sprite expires after about 7 seconds. )

enda


Problem is inside the ifcount 2 when reset it will reset the ifcount 200 too.

So how to I make so it only reset the ifcount 2 without touching the ifcount 200?
I've tried "else", no working.
0

User is offline   Jblade 

#1504

Make a new game variable, like this:

gamevar INTERNAL_COUNT 0 2

then inside your sprite, do something like this:
ifvarl INTERNAL_COUNT 200
addvar INTERNAL_COUNT 1
else killit

That's pretty bare basic code but it'll work.
1

User is offline   Zaxtor 

#1505

It works thx.
0

User is offline   Zaxtor 

#1506

Is there a code to put a delay / cool down when firing a weapon.

Example weapon 10 (weapon0) fires extremely fast.
Is there a code to slow it down, slow down the firing speed?
not the projectile speed but the delay each time it fires.

This post has been edited by Zaxtor: 06 October 2014 - 06:55 AM

0

#1507

View PostZaxtor, on 06 October 2014 - 06:55 AM, said:

Is there a code to put a delay / cool down when firing a weapon.


Lol, I thought you've found the way. All the hard-coded weapon properties are pre-defined game variables (http://wiki.eduke32....efined_gamevars). Just redefine those vars which you need to alter. Try increasing WEAPON9_TOTALTIME a bit.
0

User is offline   Zaxtor 

#1508

View PostCraigFatman, on 06 October 2014 - 07:55 AM, said:

Lol, I thought you've found the way. All the hard-coded weapon properties are pre-defined game variables (http://wiki.eduke32....efined_gamevars). Just redefine those vars which you need to alter. Try increasing WEAPON9_TOTALTIME a bit.


I checked them already but is a bit confusing.

So I put them onevent?


According to the thing "These pre-defined gamevars may be altered without giving them the standard gamevar definition"
Same as "setvar RETURN x" it works without "gamevar RETURN x x" And is inside onevent.


But dunno where to put to make it work the WEAPON0_TOTALTIME

This post has been edited by Zaxtor: 06 October 2014 - 08:23 AM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1509

Just place it anywhere:

gamevar WEAPON0_TOTALTIME 14 1


This post has been edited by Fox: 06 October 2014 - 09:42 AM

0

User is offline   Zaxtor 

#1510

 Fox, on 06 October 2014 - 09:42 AM, said:

Just place it anywhere:

gamevar WEAPON0_TOTALTIME 14 1



I placed it or otherwise it says is not a game variable.
I mainly mean the rest.

Cus I know that alone wont do anything.
It will behave like an "ordinary gamevar" that can be used by anything,
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1511

It will replace the default initial value for the pre-existing variable WEAPON0_TOTALTIME.
1

User is offline   Zaxtor 

#1512

It works.

Reason is I put 0 instead of 9.
I'm soo used of 0 (as weapon 10).
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1513

Now I see you mentioned "weapon 10" over there. When you are coding you should forget about the key you use to select weapon, and instead look for the IDs in defs.con:
define KNEE_WEAPON         0
define PISTOL_WEAPON       1
define SHOTGUN_WEAPON      2
define CHAINGUN_WEAPON     3
define RPG_WEAPON          4
define HANDBOMB_WEAPON     5
define SHRINKER_WEAPON     6
define DEVISTATOR_WEAPON   7
define TRIPBOMB_WEAPON     8
define FREEZE_WEAPON       9
define HANDREMOTE_WEAPON   10
define GROW_WEAPON         11

1

User is offline   Zaxtor 

#1514

True.

I made this, Works.

Weapon 0 (9) does diff sound. has a short delay before fireng.

Example

 gamevar WEAPON9_FIRESOUND 643 1
 gamevar WEAPON9_INITIALSOUND 642 1
 gamevar WEAPON9_FIREDELAY 32 1
 gamevar WEAPON9_TOTALTIME 42 1


1 fire sound.
2 (charging) sound.
for the sounds

This post has been edited by Zaxtor: 06 October 2014 - 05:03 PM

0

User is offline   The Commander 

  • I used to be a Brown Fuzzy Fruit, but I've changed bro...

#1515

You have only just found these things out?
0

User is offline   Hendricks266 

  • Weaponized Autism

  #1516

Had to post this. Sorry Zax. :)

 TerminX, on 28 January 2012 - 09:05 AM, said:

Somewhere, something has gone VERY wrong when someone tried to explain to Zaxtor how to write CON files.

0

User is offline   Zaxtor 

#1517

Is confusing.
But now I understand better how it works.
0

User is offline   The Commander 

  • I used to be a Brown Fuzzy Fruit, but I've changed bro...

#1518

I confusing your post but slowly understand them better.
0

User is offline   lycanox 

#1519

Ok, i got some weird effects while trying out some new parameters for an idea.

I am currently just messing around with creating a crude sunset by cycling skyboxes and changing the visibility.
But each time I try to change a paralaxed sky. It does not work.
Confused I turned off the skybox in mapster. The code does render normally and I can see the tiles change on the now unparralaxed ceiling.

So next I tried turning the paralaxed sky off during the period I change the skybox through code.
But that either does not work. Or reverts the skybox to displaying the brown brick.

I am using the commands

setsector[SECTNUM].ceilingstat (alternating between 1 and 0)
setsector[SECTNUM].ceilingpicnum (just randomly selecting skyboxes or non skyboxed tiles.)

With SECTNUM being the sectornumber of the current actor.

Is this a bug in the code? Or am I approaching this completely wrong? I am using the latest snapshot.

This post has been edited by lycanox: 07 October 2014 - 06:42 AM

0

User is offline   Jblade 

#1520

Try something like this:
// if conditions for changing time are set
{
setvar TEMP 0
whilevarn TEMP NUMSECTORS // this sets up a loop that will go through all the sectors in the current level
 {
 ifvarand sector[TEMP].ceilingstat 1 // if it's a parallex sector
   {
    setsector[TEMP].ceilingpicnum *tilenumber* // change that room's ceiling texture to the number defined here
    setsector[TEMP].visibility 0 // just an example
   }
 addvar TEMP 1 // go up in the loop
 }
}

That should work, although it's untested - making a single sprite do all of the work is better than multiple sprites and you can set up many different ways of configuring the sprite. Once you got it working, we can go from there to add more features + control to it.
0

User is offline   lycanox 

#1521

Hmm, I tried your code and I still get the same effect. I think its an flaw in how the game works through.

I am starting to believe that the paralaxed sky is stored in a different game variable that gets written on map load.
As the game seems to remember the original skybox it was after the map was load.
Starting with skybox 1 and then changing to the picnum of skybox 2 would result in skybox 1 still being displayed.

Curiously this gamevar does only seem to be set on level start. And only seems to be capable of storing one skybox.
So if I were to load a map with no paralaxed sectors and force the code to turn those ceilings into paralaxed skies. It would show tile 0, the brown brick as the sky. If I however play the map after playing a space level. It would show the space skybox from that map. Or the LA one after a city level.

So i probably need a command like "set/getuserdef[TEMP].paralax_picnum"
Which sadly does not exist.

This post has been edited by lycanox: 07 October 2014 - 09:36 AM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1522

View Postlycanox, on 07 October 2014 - 09:36 AM, said:

I am starting to believe that the paralaxed sky is stored in a different game variable that gets written on map load.
As the game seems to remember the original skybox it was after the map was load.
Starting with skybox 1 and then changing to the picnum of skybox 2 would result in skybox 1 still being displayed.

That's true for Polymer.
0

User is offline   Mblackwell 

  • Evil Overlord

#1523

Only a single skybox is ever loaded in polymer for a given level. I know the limitation of only displaying one at a time, but it's interesting that it can't be swapped.
0

User is offline   Zaxtor 

#1524

Is there such thing as something to "Activate" a gamevar VARNAME x x.
Like we know gamevar VARNAME x x define the var to make the var you add work.

BUT.

Something like a Ifvare blocks the gamevar VARNAME x x until is set.

I wanna do a thing for mainly pre-gamevar set such as weapon stuff etc.

Example if I want an addon to a weapon it set a var so it get to the pre-gamevar and activate them.
like a weapon addon.

Example.
Let say weapon 5 is RPG.
RPG is hard coded and will shoot standard RPG projectile, but hardcoded can be "bypassed" if you add a new WEAPONx SHOOTS thing alongside other pre-gamevars in "http://wiki.eduke32.com/wiki/Pre-defined_gamevars"
Will make the RPG shoot a diff projectile, do diff sound and dmg.

ifvare WEAFIVEADDON 1
                                     {
                                      ??????? WEAPON4_FIRESOUND 666 1
                                      ??????? WEAPON4_SHOOTS 13662 1
                                     }


I've tried gamevar, no working.
I searched but dunno what is the name for the "alternative to gamevar" that acts just like a gamevar but can work if is inside a ifvare thing.
like myospal works inside a ifvare.

Like 666 is to change the RPG sound.
13662 makes it shoot a diff projectile
??????? not sure what type of defining code to put that works inside the ifvare and acts exactly like a gamevar

This post has been edited by Zaxtor: 07 October 2014 - 09:32 PM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1525

setvar WEAPON4_FIRESOUND 666
setvar WEAPON4_SHOOTS 13662

This post has been edited by Fox: 07 October 2014 - 09:40 PM

0

User is offline   Zaxtor 

#1526

View PostFox, on 07 October 2014 - 09:39 PM, said:

setvar WEAPON4_FIRESOUND 666
setvar WEAPON4_SHOOTS 13662



Doesn't do anything except not causing "not game variable" error without gamevar VARNAME x x error.
I even tried few more , no avail.


PS
It just defines it that's it.

What I wanna do is like an inactive "gamevar WEAPON4_SHOOTS 13662 1"

So that gamevar only works if you set that var blocking it.

This post has been edited by Zaxtor: 07 October 2014 - 10:02 PM

0

User is offline   Jblade 

#1527

You'll need to put the code Fox stated in an actor like the aplayer - it sounds like you want the RPG to shoot a certain projectile if a var is set right? Than do this, put this in the APLAYER actor:
ifvare WEAFIVEADDON 1
     {
    setvar WEAPON4_FIRESOUND 666
    setvar WEAPON4_SHOOTS 13662
     }

0

User is offline   Zaxtor 

#1528

View PostJblade, on 07 October 2014 - 10:05 PM, said:

You'll need to put the code Fox stated in an actor like the aplayer - it sounds like you want the RPG to shoot a certain projectile if a var is set right? Than do this, put this in the APLAYER actor:
ifvare WEAFIVEADDON 1
     {
    setvar WEAPON4_FIRESOUND 666
    setvar WEAPON4_SHOOTS 13662
     }




I put inside the "aplayer" code.

Technically is not RPG I wanna change.
I used RPG as an example to reduce "spoil alerts".

Is technically a non projectile weapon.
projectile works, every thing works.
Is just the code was not.

I tested as "gamevar" and it works.

Now ill put inside the aplayer the setvar so I can make the code "blocked" until u grab the addon.
0

User is offline   Zaxtor 

#1529

Well it "almost works"

When var is set.
Weapon is totally muted. doesn't shoot anything.
Only its animation works.

Is inside the Aplayer actor.
At the beginning below its "title"
Above ifaction 0

This post has been edited by Zaxtor: 07 October 2014 - 10:32 PM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1530

View PostZaxtor, on 07 October 2014 - 10:27 PM, said:

Is technically a non projectile weapon.

It only works with sprites defined as projectiles. You may wanna set WEAPONX_SPAWN instead.
1

Share this topic:


  • 119 Pages +
  • « First
  • 49
  • 50
  • 51
  • 52
  • 53
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options