![](https://forums.duke4.net/public/style_images/cgs/_custom/switch.png)
EDuke32 Scripting "CON coding help"
#1501 Posted 27 August 2014 - 06:58 PM
... Why can't we use CON variables in Def...
This post has been edited by The Angry Kiwi: 27 August 2014 - 06:59 PM
#1502 Posted 27 August 2014 - 08:16 PM
The Angry Kiwi, on 27 August 2014 - 06:58 PM, said:
It's a content definition markup language, not a scripting language.
#1503 Posted 14 September 2014 - 08:33 AM
I need to stop sound numbers 494 and 496 when the player enters sector number 162. I have multiple maps that have sector number 162 but the 2 sounds to stop will only be playing in 1 of the maps so I don't have to worry about that part. I see the stopsound command in the Wiki but I don't know how to use the getsector command or whatever else will be needed for sector detection and pass it along to the stopsound command.
#1504 Posted 14 September 2014 - 09:12 AM
Mark., on 14 September 2014 - 08:33 AM, said:
I need to stop sound numbers 494 and 496 when the player enters sector number 162. I have multiple maps that have sector number 162 but the 2 sounds to stop will only be playing in 1 of the maps so I don't have to worry about that part. I see the stopsound command in the Wiki but I don't know how to use the getsector command or whatever else will be needed for sector detection and pass it along to the stopsound command.
I don't think it's a good idea to have specific sector numbers in your code. The number could change (e.g. if you deleted the sector and then re-created it because of a problem with the map) and then the code wouldn't work.
There are several different ways of doing what you want. You could place a sprite in the sector which is coded to stop the sounds, for example. Something like this:
useractor notenemy SOUNDSTOPPER 0 ifvarvare sprite[THISACTOR].sectnum player[THISACTOR].cursectnum { stopsound 494 stopsound 496 } enda
Obviously you have to define "SOUNDSTOPPER" as some tile number and then place the tile in the sector. You might also want to make it invisible (either in mapster or using code). And if you want the sounds to be able to play while the player is in that sector but after he arrives, then you would need a little more code to make that distinction. There might be a problem with the actor not waking up fast enough and the sounds starting to play -- make sure that the actor is in line of sight to the player before he enters the sector.
#1505 Posted 14 September 2014 - 09:17 AM
![:)](https://forums.duke4.net/public/style_emoticons/default/unsure.gif)
#1506 Posted 14 September 2014 - 10:10 AM
It was a problem at first until I realised I gave you 494 and 496 instead of the actual 394 and 396
![:)](https://forums.duke4.net/public/style_emoticons/default/unsure.gif)
edit: If there is an easy addition to the previous code to put a delay of a few seonds before shutting down the sounds I could time it to the autoclosing of the doors to that area. Otherwise maybe its possible through the use of a touchplate and masterswitch with delay to spawn the new soundstopper sprite? No, there would be a chance the player moves out of that sector before the actor spawns.
This post has been edited by Mark.: 14 September 2014 - 10:26 AM
#1507 Posted 14 September 2014 - 11:58 AM
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
#1508 Posted 14 September 2014 - 12:22 PM
#1509 Posted 28 September 2014 - 08:49 AM
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.
#1510 Posted 28 September 2014 - 09:11 AM
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.
#1512 Posted 06 October 2014 - 06:55 AM
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
#1513 Posted 06 October 2014 - 07:55 AM
Zaxtor, on 06 October 2014 - 06: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.
#1514 Posted 06 October 2014 - 08:22 AM
CraigFatman, on 06 October 2014 - 07:55 AM, said:
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
#1515 Posted 06 October 2014 - 09:42 AM
gamevar WEAPON0_TOTALTIME 14 1
This post has been edited by Fox: 06 October 2014 - 09:42 AM
#1516 Posted 06 October 2014 - 10:17 AM
Fox, on 06 October 2014 - 09:42 AM, said:
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,
#1517 Posted 06 October 2014 - 10:48 AM
#1518 Posted 06 October 2014 - 10:58 AM
Reason is I put 0 instead of 9.
I'm soo used of 0 (as weapon 10).
#1519 Posted 06 October 2014 - 11:20 AM
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
#1520 Posted 06 October 2014 - 05:02 PM
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
#1522 Posted 06 October 2014 - 07:51 PM
![:)](https://forums.duke4.net/public/style_emoticons/default/smile.gif)
TerminX, on 28 January 2012 - 09:05 AM, said:
#1525 Posted 07 October 2014 - 06:37 AM
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
#1526 Posted 07 October 2014 - 08:08 AM
// 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.
#1527 Posted 07 October 2014 - 09:36 AM
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
#1528 Posted 07 October 2014 - 10:53 AM
lycanox, on 07 October 2014 - 09:36 AM, said:
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.
#1529 Posted 07 October 2014 - 06:36 PM
#1530 Posted 07 October 2014 - 09:27 PM
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