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

Jump to content

  • 119 Pages +
  • « First
  • 21
  • 22
  • 23
  • 24
  • 25
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   XThX2 

#661

I have commented out some parts and it turns out the substracting Z from player and setting that was the problem. When they are commented out, it works as intended. I don't know what's quite happening with that though.

This post has been edited by XThX2: 01 June 2011 - 10:21 AM

0

User is offline   XThX2 

#662

So I noticed a weird thing. If you walk on a spritebridge which is built on a floor with slope, player's aim falls down or goes up depending on the slope. I'm not sure if this is fixed in newer eduke versions, but this is kind of annoying and makes no sense. How can I overcome this ? (I've tried to mess with getfloorzofslope command but I don't have much ideas as to how to use it to manupulate player's up/down angle)

This post has been edited by XThX2: 03 June 2011 - 12:45 AM

0

User is offline   Mblackwell 

  • Evil Overlord

#663

Are you playing with mouse aim?

Either way:

http://wiki.eduke32.com/wiki/Horizoff
0

User is offline   XThX2 

#664

I used keyboard only. I'll try messing with it though.
0

User is offline   Jblade 

#665

How do I limit the player's turning velocity? I've tried getting angvel and dividing that but it doesn't have any affect on the player (I imagine because it's not controlling the value, it's just telling you how fast the player's moving his view)

This post has been edited by James: 23 June 2011 - 02:05 PM

0

User is offline   Danukem 

  • Duke Plus Developer

#666

 James, on 23 June 2011 - 02:05 PM, said:

How do I limit the player's turning velocity? I've tried getting angvel and dividing that but it doesn't have any affect on the player (I imagine because it's not controlling the value, it's just telling you how fast the player's moving his view)


I don't know how it could be done via the input struct, but if you simply want to cut turning speed, you could do this:

	getplayer[THISACTOR].oang temp
	getplayer[THISACTOR].ang tempb
	getincangle tempb temp tempb
	divvar tempb 2
	addvarvar temp tempb
	setplayer[THISACTOR].ang temp


You can change the "divvar tempb 2" line to something else for a different ratio. If you want to put a cap on the amount the player can turn in one tic, then you could add a line after the getincangle command that limits it (e.g. "ifvarg tempb 64 setvar tempb 64 ifvarl tempb -64 setvar tempb -64")
0

User is offline   Jblade 

#667

That works for me, thanks alot :)
0

User is offline   m210® 

#668

Hi, guys! I have problem with my own slide door sector. For moving sector I used 2 cycles(whilevarn command): One cycle for sprites moving and cycle for moving vertex of sector.
setvar spriteid 0
			whilevarn spriteid 16384
			{	
				setactor[spriteid].statnum 1
				getactor[spriteid].x x
				getactor[spriteid].y y
				ifvare moving_var 1	{ addvarvar x sector_xvel addvarvar y sector_yvel } else 
				{ subvarvar x sector_xvel subvarvar y sector_yvel }
				setactor[spriteid].x x
				setactor[spriteid].y y	
				addvar spriteid 1
			}
			
			sectsetinterpolation sectorsaved
			getsector[sectorsaved].wallnum wallnum
			addvarvar wallnum wallsaved
			setvarvar wallnum_count wallsaved
			whilevarvarn wallnum_count wallnum
			{
				getwall[wallnum_count].point2 set
				getwall[set].x x
				getwall[set].y y
				ifvare moving_var 1
				{ addvarvar x sector_xvel addvarvar y sector_yvel } else 
				{ subvarvar x sector_xvel subvarvar y sector_yvel }
				dragpoint set x y
				addvar wallnum_count 1
			}


But cycle of sprite moving performed 4 times of tic therefore sector_yvel and sector_xvel added 4 times per tick while for vertex moving in cycle it added once. As a result, the speed of movement of sprites is above 4 times (more exactly 3,3(3) times). Why is happen and how to correct it?

Cycle for sprites moving running about 4 times the cycle for vertex moving regardless of the it position

This post has been edited by M210: 27 June 2011 - 07:53 PM

0

User is offline   Danukem 

  • Duke Plus Developer

#669

I don't know. Could it be the state that is calling that code? By the way, you should use "changespritestat spriteid 1". Setting the statnum directly does not update the linked list and will cause the statnum lists to become corrupted.
0

User is offline   Hendricks266 

  • Weaponized Autism

  #670

 DeeperThought, on 27 June 2011 - 09:30 PM, said:

By the way, you should use "changespritestat spriteid 1". Setting the statnum directly does not update the linked list and will cause the statnum lists to become corrupted.

This isn't the case for sectnum/changespritesect any more, but I don't know about statnum.

EDIT: I just checked, and statnum is indeed covered:

from static void __fastcall VM_SetSprite(int32_t lVar1, int32_t lLabelID, int32_t lVar2, int32_t lParm2):
    case ACTOR_SECTNUM:
        changespritesect(iActor,lVar1);
        return;

    case ACTOR_STATNUM:
        changespritestat(iActor,lVar1);
        return;


This post has been edited by Hendricks266: 27 June 2011 - 09:57 PM

0

User is offline   m210® 

#671

 DeeperThought, on 27 June 2011 - 09:30 PM, said:

I don't know. Could it be the state that is calling that code?

I can show you all code of this state, do you want it?

 DeeperThought, on 27 June 2011 - 09:30 PM, said:

I don't know. Could it be the state that is calling that code? By the way, you should use "changespritestat spriteid 1". Setting the statnum directly does not update the linked list and will cause the statnum lists to become corrupted.
Ok, I'll use this feature, if it works :)

This post has been edited by M210: 28 June 2011 - 12:27 AM

0

#672

Is it possible to change the (green) pal when hit by SPIT? I can't find much con code and I can't change the pal just by that. Maybe it's hardcoded?
Thanks in advance
0

User is offline   Hendricks266 

  • Weaponized Autism

  #673

 insane_metalhead, on 09 July 2011 - 01:47 AM, said:

Is it possible to change the (green) pal when hit by SPIT? I can't find much con code and I can't change the pal just by that. Maybe it's hardcoded? Thanks in advance

It is hardcoded.

    else if (pp->loogcnt > 0)
    {
        palette_t lp = { 0, 64, 0, pp->loogcnt>>1 };
        Bmemcpy(&tempFade, &lp, sizeof(palette_t));
        applyTint = 1;
    }

Try getting the player.pals values that a green value of 64.

http://wiki.eduke32.com/wiki/Pals
http://wiki.eduke32.com/wiki/Pals_time

Remember that pals is an array:

typedef struct {
    char r,g,b,f;
} palette_t;

So it would be something like:

  getplayer[THISACTOR].pals 1 temp
  ifvare temp 64
    {
    setplayer[THISACTOR].pals 1 0
    setplayer[THISACTOR].pals 3 0
    setplayer[THISACTOR].pals_time 0
    }

1

User is offline   Jblade 

#674

define PROJECTILE_FLAG_FORCEIMPACT 262144
define PROJECTILE_FLAG_REALCLIPDIST 524288
define PROJECTILE_FLAG_ACCURATE 1048576

Anybody know what these flags for weapon projectiles do?
0

User is offline   Mike Norvak 

  • Music Producer

#675

Hi, maybe someone could help me with a script, I need to set the same ceiling height of all the sectors on a selection, obviously they have different heights right now.
0

User is offline   Danukem 

  • Duke Plus Developer

#676

View PostNorvak, on 03 September 2011 - 07:17 AM, said:

Hi, maybe someone could help me with a script, I need to set the same ceiling height of all the sectors on a selection, obviously they have different heights right now.



I assume this is for WGR2 so when you map the mapster scripts for that are already loaded (which means variable "i" has been declared).

The following should work. Go to the console and enter this while the sectors are selected:

do for i selsectors set sector[i].ceilingz 8192


Change "8192" to whatever you want the height to be in your case. The same thing will work for setting shade and other properties. Here is a list of the sector members: http://wiki.eduke32....ector_structure
0

User is offline   Mike Norvak 

  • Music Producer

#677

View PostDeeperThought, on 03 September 2011 - 08:47 AM, said:

I assume this is for WGR2 so when you map the mapster scripts for that are already loaded (which means variable "i" has been declared).

The following should work. Go to the console and enter this while the sectors are selected:

do for i selsectors set sector[i].ceilingz 8192


Change "8192" to whatever you want the height to be in your case. The same thing will work for setting shade and other properties. Here is a list of the sector members: http://wiki.eduke32....ector_structure


Thanks it works.
0

#678

hello. I am trying to learn a little bit about the m32 script. And in the eduke scripts, you could use gamevars to set some commands. like setactor[THISACTOR].ang temp. Now how do i do this in the m32 scripts. I've tried set sprite[i].ang x. which didn't work. Also tried many other things but no good. I need help :/
0

User is offline   Danukem 

  • Duke Plus Developer

#679

View Postrasmus thorup, on 03 September 2011 - 01:34 PM, said:

hello. I am trying to learn a little bit about the m32 script. And in the eduke scripts, you could use gamevars to set some commands. like setactor[THISACTOR].ang temp. Now how do i do this in the m32 scripts. I've tried set sprite[i].ang x. which didn't work. Also tried many other things but no good. I need help :/


http://wiki.eduke32....ter32_Scripting

Also there's a lot of example scripts that come with eduke32
1

#680

Thank you, got it working :(
0

#681

Can somebody help me to code a new sort of teleportation method? What I want to do is when standing in a sector (SE7) you have to hit space to teleport. Is this difficult to do?
0

User is offline   Helixhorned 

  • EDuke32 Developer

#682

Not by itself, but if you insist that it has to be SE7 you'll have to deal with a lot of working around hardcoded stuff. Pressing SPACE to teleport yourself is coded in a.m32, albeit under slightly different conditions. Duke3D will likely add some more complications.
0

User is offline   CruX 

#683

View Postinsane_metalhead, on 21 September 2011 - 02:13 PM, said:

Can somebody help me to code a new sort of teleportation method? What I want to do is when standing in a sector (SE7) you have to hit space to teleport. Is this difficult to do?

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)



This post has been edited by EmericaSkater: 22 September 2011 - 01:20 AM

1

#684

This is great EmericaSkater! Thanks for the quick reply. This is exacly what I needed :(
0

#685

One more little thing that I was wondering about for a few months. When playing in polymer and you teleport (blue flash), have the shrinker/expander (green/red light effect) or freezegun (blue projectile light) there will always be a light that is propably coded in the source. Is it possible to turn these kind of things off with for example command line or con code?

Thanks in advance
0

User is offline   Danukem 

  • Duke Plus Developer

#686

I wish there was a way to prevent the pistol from automatically hitting any enemy under the crosshair no matter how far away the enemy is. If it were a weapon flag, then it could be removed, or applied to any other hitscan weapon.

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.
0

User is offline   Jimmy 

  • Let's go Brandon!

#687

Not trying to be an ass here, but wouldn't that kinda defeat the point of a hitscan in the first place? Why not use a projectile with a high velocity instead?
0

User is offline   Mblackwell 

  • Evil Overlord

#688

You could adjust the accuracy by jittering the angle before firing.

Also there are projectile flags for autoaim iirc. You could make a new hitscan projectile.
0

User is offline   Danukem 

  • Duke Plus Developer

#689

@CA: No it would not defeat the purpose of hitscan. Projectiles with high velocity have many other properties that make them different from hitscan. For example, it is quite a trick to make a nonhitscan projectile leave decals.

@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.
0

User is offline   Hendricks266 

  • Weaponized Autism

  #690

Maybe some of the newer PROJ_WORKSLIKE flags (near the bottom) do what you want.
0

Share this topic:


  • 119 Pages +
  • « First
  • 21
  • 22
  • 23
  • 24
  • 25
  • 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