
EDuke32 Scripting "CON coding help"
#682 Posted 21 September 2011 - 02:24 PM
#683 Posted 22 September 2011 - 12:43 AM
insane_metalhead, on 21 September 2011 - 02:13 PM, said:
It'll be a lot easier if you just create two user actors to execute the code instead of trying to mess around with an SE. Attached is a rough version of the effect. The code's all at the bottom of the game.con therein, but I'll post it here for the sake of explaining it. Course, if someone else has a more efficient way of doing it, feel free to tell me; this is just something I whipped up in about five minutes.
gamevar hitagsaved 0 2 // var used for grabbing the hitag from the actor right when it's loaded into the map gamevar temphitag 0 2 // temporary var used for storing the hitag as an actorvar gamevar fakehitag 0 2 // var used for the storing the hitag value so it can be read in actor code. gamevar GLOBALHITAG -1 0 // a global var that will be set when the "START" teleport actor is engaged. gamevar x 0 2 gamevar y 0 2 gamevar z 0 2 gamevar sector_actor 0 2 gamevar sector_player 0 2 // just position/sector variables. define TELEPORTSTART 3328 // the actor that the player engages define TELEPORTEND 3329 // the actor that changes the player's coordinates eventloadactor TELEPORTSTART // when the TELEPORTSTART actor is loaded into the map... getactor[THISACTOR].hitag hitagsaved // get its hitag value setactorvar[THISACTOR].temphitag hitagsaved // and set the "temphitag" variable to whatever that value is setactor[THISACTOR].hitag 0 // then set the hitag to zero. enda eventloadactor TELEPORTEND // and do the same thing for the TELEPORTEND actor getactor[THISACTOR].hitag hitagsaved setactorvar[THISACTOR].temphitag hitagsaved setactor[THISACTOR].hitag 0 enda useractor notenemy TELEPORTSTART 0 cstat 32768 // make it invisible getactorvar[THISACTOR].temphitag fakehitag // set the "fakehitag" variable equal to the value of the "temphitag" variable getactor[THISACTOR].sectnum sector_actor getplayer[THISACTOR].cursectnum sector_player // get the sector number of both the player, and the TELEPORTSTART actor... ifvarvare sector_actor sector_player // if they're equal (i.e the player is in the same sector as the TELEPORTSTART actor)... { ifhitspace { // if the player hits space... ifcount 15 { setvarvar GLOBALHITAG fakehitag resetcount // set the "GLOBALHITAG" variable equal to the value of the "fakehitag" variable. } } } enda useractor notenemy TELEPORTEND 0 cstat 32768 getactorvar[THISACTOR].temphitag fakehitag // again, set the "fakehitag" variable getactor[THISACTOR].sectnum sector_actor getactor[THISACTOR].x x getactor[THISACTOR].y y getactor[THISACTOR].z z // grab the "TELEPORTEND" actor's x, y, z coordinates and sector number ifvarvare GLOBALHITAG fakehitag { // if the "GLOBALHITAG" variable is equal the the "TELEPORTEND" actor's "fakehitag" variable... setplayer[THISACTOR].cursectnum sector_actor setplayer[THISACTOR].posx x setplayer[THISACTOR].posy y // set the player's sector, x and y coordinates equal to the "TELEPORTEND" actor's... subvar z 6500 // subtract 6500 from the "TELEPORTEND" actor's z-coordinate. (If this isn't done, the screen will briefly flicker towards the floor upon teleporting) setplayer[THISACTOR].posz z // set the player's z-coordinate equal to the new z-coordinate. setvar GLOBALHITAG -1 } // and reset the "GLOBALHITAG" so it can be done all over again. enda
The map makes it clear-cut enough, but basically all you do is take a "TELEPORTSTART" actor and a "TELEPORTEND" actor, put them at two different parts of the map, then give them matching hitags.
Attached File(s)
-
teleport.zip (304.66K)
Number of downloads: 779
This post has been edited by EmericaSkater: 22 September 2011 - 01:20 AM
#684 Posted 22 September 2011 - 01:56 AM

#685 Posted 22 September 2011 - 03:36 AM
Thanks in advance
#686 Posted 11 October 2011 - 02:50 PM
While on the subject of hitscan weapons, it is still not possible to adjust the accuracy of hitscan weapons fired by nonplayers. I know James wanted that as well, and probably other modders.
#687 Posted 11 October 2011 - 02:58 PM
#688 Posted 11 October 2011 - 03:33 PM
Also there are projectile flags for autoaim iirc. You could make a new hitscan projectile.
#689 Posted 11 October 2011 - 04:07 PM
@Mblackwell: There are no projectile flags that will make monsters shoot hitscan in a straight line. There is a random component to the trajectory that is automatically applied when they fire. In the player, it can be controlled (albeit crudely by powers of 2) in EVENT_GETSHOTRANGE, but there is no corresponding event or way of controlling it for nonplayers.
#690 Posted 11 October 2011 - 04:30 PM
#691 Posted 11 October 2011 - 04:33 PM
Hendricks266, on 11 October 2011 - 04:30 PM, said:
LOL, I haven't looked at that list in a while, and I didn't know there was a FLAG_ACCURATE

#692 Posted 11 October 2011 - 06:14 PM
#693 Posted 13 October 2011 - 07:42 PM
Anyhow, I'm collaborating with a cyber cafe in my hometown on a project; the project is to bring a Duke Nukem 3D network game to the customers and create a tournament. We're using eDuke32 to make this possible.
The thing we are most challenged with right now is scripting certain parameters (triggers for rotating maps when a quota is met e.g. kill count or timer).
Could anybody give us any direction on how to go about this, if possible?
Thanks!
- Tom
#694 Posted 14 October 2011 - 02:06 PM
You need to get into gamevars.
#695 Posted 14 October 2011 - 02:46 PM
#697 Posted 14 October 2011 - 04:03 PM
rasmus thorup, on 14 October 2011 - 03:42 PM, said:
I think C.A. is right. The post talked about "parameters" and it's normal for multiplayer games to have an option for switching maps after a certain number of kills or after a certain amount of time without extra scripting.
#698 Posted 15 October 2011 - 08:28 PM
#699 Posted 15 October 2011 - 09:43 PM
#700 Posted 28 October 2011 - 07:31 PM
Without the var set is the ordinary knee (claw)
For my mod the knee is a claw because the player is a wolverine he uses his claw instead of using his knee like duke does use the knee/boot.
When I did a test with the knee (num 2521) the thing only spawns on IMPACT of the knee (claw) as it must touch something to spawn w/e. It doesn't move because when you spawn a projectile by (spawn) it wont move if is a projectile i.e missile, shrink spark etc.
What I wanna make is it shoots it without being obligated to hit something to spawn it.
defineprojectile 2521 PROJ_WORKSLIKE 16
is the actual code for the (knee)
Also the projectile I've made I want to shoot when he uses claw if the var is set
defineprojectile 4808 PROJ_WORKSLIKE 2
defineprojectile 4808 PROJ_VEL 320
defineprojectile 4808 PROJ_EXTRA 17
defineprojectile 4808 PROJ_HITRADIUS 856
defineprojectile 4808 PROJ_SPAWNS EXPLOSION2
is a powerball that explodes on impact
So I wanna try to make so when as soon you hit the button 1 which throws the kick (claw for my mod) it shoots something but only when a var is set.
I'm making a "Weapon addon" that you get when you risk your life by searching it by going deep down.
Like ifvare POWERBALL 1 { that code to make the thing shoot that projectile while using the melee weap }
In my mod OBLIVION I had a similar thing. Example when you grab a booster the weap makes a deadlier explosion.
But the weap spawns an invisible sprite (on impact or by making trails) that dies instantly if no var is set.
but when is set it makes the deadly explosion or a trail of energy for its trail. But as above is diff.
#701 Posted 29 October 2011 - 10:03 AM
You have made a working projectile. What you need to change is the weapon itself.
http://wiki.eduke32....efined_gamevars
Look at the mighty foot. Change WEAPONx_FIREDELAY to a lower number.
Now i wonder. Have you made the wolverine claws animation? You might want to change WEAPONx_TOTALTIME to make the animation "fit".
I hope i didn't misunderstand the question >.>
#702 Posted 29 October 2011 - 05:53 PM
I'm trying to make so example if I take something it sets a var and when I use the weap 0.
Without the var set is just the normal claw. and it ignores the "defineprojectile 2521 PROJ_WORKSLIKE 2" in knee/claw defineprojectile
It will still display the claw but shoot a projectile (power ball that explodes on impact just like the rpg)
But I want it to fire as soon u press 0.
Forgot to say before,..
If I mix 2 define projectiles in the knee (claw for my mod).
Example v
defineprojectile 2521 PROJ_WORKSLIKE 16
defineprojectile 2521 PROJ_WORKSLIKE 2
defineprojectile 2521 PROJ_SPAWNS POWERBALL_1
The thing will still punch but shoot a punch while pressing 0 that explodes on impact.
But is VERY close of what I want. As means only 1 error to be fixed. making so when it shoots it shoot 4808 instead of 2521
But it shoots the image of the claw or kick w/e. For me is the claw cus is the first frame of the knee replaced by a claw.
So I wanna make so it shoots the projectile I want (its sprite number is 4808)
This post has been edited by Zaxtor: 29 October 2011 - 05:58 PM
#703 Posted 30 October 2011 - 10:20 AM
But if you want to change what projectile the weapon of your choice shoots, this is the place http://wiki.eduke32....efined_gamevars
WEAPONx_SHOOTS controls what projectile the weapon shoots.
#704 Posted 30 October 2011 - 10:47 AM
Since is easier than a non projectile weap
This post has been edited by Zaxtor: 30 October 2011 - 10:48 AM
#705 Posted 04 November 2011 - 02:13 AM
#706 Posted 04 November 2011 - 05:11 AM
James, on 04 November 2011 - 02:13 AM, said:
Well, one rather jerry-rigged way I just threw together is to make your own 'counter' type of variable that you add onto in EVENT_GAME, then randomize the variable that would determine the chance of rain when that counter gets to a particular value.
gamevar timer 0 0 gamevar RANDOMSKYVAR -1 0 // initialize this to -1 so it won't be constantly randomized in EVENT_GAME. Also I was experimenting by changing sky textures, though I was checking the number with a digitalnumberz command... onevent EVENT_GAME ifvarl timer 7500 { addvar timer 1 } else { setvar timer 7500 } // add onto the 'timer' var till it's at 7500 (roughly the first five seconds of gameplay) ifvare timer 7500 { ifvarn RANDOMSKYVAR -1 break else { randvar RANDOMSKYVAR 3 } } // randomize the variable when the 'timer' var's at 7500 ONLY if it's -1.... endevent onevent EVENT_RESETPLAYER setvar timer 0 setvar RANDOMSKYVAR -1 endevent
Like I said, it's kinda shotty, not thoroughly tested, and I'm imagining the variables used would have to be totally unique from everything else, but it produces a different number on a pretty static basis relatively close to the loadup time.
#707 Posted 04 November 2011 - 07:12 AM
And 7500 is not 5 seconds. That's 250 seconds if theres 30 addvar timer 1 pr sec. Or are you doing something i don't understand?
This post has been edited by rasmus thorup: 04 November 2011 - 07:20 AM
#708 Posted 04 November 2011 - 07:32 AM
gamevar randomstart 7 0 gamevar DONE 0 0 onevent EVENT_LOADACTOR ifvare DONE NO { readgamevar randomstart addvar randomstart 1 andvar randomstart 65535 setvarvar temp randomstart xorvar temp 43690 whilevarn temp 0 { ifrnd 1 { } subvar temp 1 } savegamevar randomstart setvar DONE YES } endevent
The idea is you save your own number that changes each time someone starts a game, and that number effects the randomizer. I also put other stuff in the if DONE==0 block of code, basically anything that needs to happen exactly once before the map loads.
While randomstart will change each time, I think there will still be a pattern it follows, unless you set DONE back to 0 at some point after map load and then have that code run with each level load (which is what I do). Another thing you can do is, when you read randomize, if it is 0 (meaning you are running with fresh cfg files) then set it to the clock time. Reading a gamevar that is not in the cfg sets it to 0, so actually there was no point in initializing randomstart to 7...but the code still works.
#709 Posted 04 November 2011 - 08:14 AM
rasmus thorup, on 04 November 2011 - 07:12 AM, said:
And 7500 is not 5 seconds. That's 250 seconds if theres 30 addvar timer 1 pr sec. Or are you doing something i don't understand?
It would be 250 seconds if it was being counted in tics, but it's not. EVENT_GAME is run per tic, but the 'timer' variable is being added at a faster rate, such that 7500 = 4-5 seconds. The entire reason the timer is needed is because a variable can't be randomized at the EXACT start of the level; you'll get the same number every time (use randvar in something like EVENT_RESETPLAYER, then check that variable with digitalnumberz and you'll see what I mean...)
#710 Posted 04 November 2011 - 09:16 AM
#711 Posted 07 November 2011 - 01:02 PM
actor FIXIECAM // Tile 555 for now, I'll move it later ifcanseetarget { getactor[THISACTOR].ang CAMA getactor[THISACTOR].x CAMX getactor[THISACTOR].y CAMY getactor[THISACTOR].z CAMZ } enda onevent EVENT_DISPLAYREST setvarvar camerax CAMX setvarvar cameray CAMY setvarvar cameraz CAMZ setvarvar cameraang CAMA // digitalnumber 2930 64 6 CAMA 0 0 16 windowx1 windowy1 windowx2 windowy2 // digitalnumber 2930 64 16 CAMX 0 0 16 windowx1 windowy1 windowx2 windowy2 // digitalnumber 2930 64 26 CAMY 0 0 16 windowx1 windowy1 windowx2 windowy2 // digitalnumber 2930 64 36 CAMZ 0 0 16 windowx1 windowy1 windowx2 windowy2 // 32768 endevent