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

Jump to content

  • 123 Pages +
  • « First
  • 104
  • 105
  • 106
  • 107
  • 108
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Reaper_Man 

  • Once and Future King

#3151

This is normal behavior from the engine, you can experiment by increasing the RPG damage in the base game. The amount of pushback is dependent on the amount of overdamage the actor receives - that is, when their .extra property goes negative. The exact logic is here from the game source:

            if (!A_CheckSpriteFlags(otherSprite, SFLAG_NODAMAGEPUSH))
            {
                if (pOther->xvel < 0) pOther->xvel = 0;
                pOther->xvel += (pSprite->extra<<2);
            }


Note that any actor with the spriteflag NODAMAGEPUSH is immune to pushback.

"Pushback" may be a misnomer because obviously it pushes forward, not backwards. I don't think this is a bug, but rather it ensures the player can see the actor in front of the explosion sprite.
2

User is offline   Danukem 

  • Duke Plus Developer

#3152

View PostReaper_Man, on 22 December 2022 - 08:40 PM, said:

"Pushback" may be a misnomer because obviously it pushes forward, not backwards. I don't think this is a bug, but rather it ensures the player can see the actor in front of the explosion sprite.


I never considered that might be the reason for it. Instead I suspected that xvel was given the wrong sign and it was supposed to move the enemy backwards.

@Vgames: In AA what I do is multiply xvel by -1 at the moment of impact, and in addition some weapons have their own separate knockback effect. If you want the scripted knockback to be the only source, then you can set xvel to 0 at the moment of impact.
1

User is offline   VGames 

#3153

View PostDanukem, on 22 December 2022 - 08:59 PM, said:

I never considered that might be the reason for it. Instead I suspected that xvel was given the wrong sign and it was supposed to move the enemy backwards.

@Vgames: In AA what I do is multiply xvel by -1 at the moment of impact, and in addition some weapons have their own separate knockback effect. If you want the scripted knockback to be the only source, then you can set xvel to 0 at the moment of impact.


Thanks. I’ll give this a try
0

User is offline   VGames 

#3154

Worked perfectly thanks
0

User is offline   MC84 

#3155

I was hoping to get some pointers as to how I would go about making a touchplate-activated call light for an elevator. Basically I just want the light actor to light up for a few seconds when the player steps on the touchplate sector, and then revert back to the default state.

I've started with this;

action CALLON 1 1 1 1 1 // advance one frame

define CALLUP 5872
useractor notenemy CALLUP 
{
 ifn sprite[].lotag 0
 geta[].lotag lotagsaved
}
enda

define CALLDN 5874
useractor notenemy CALLDN 
{
 ifn sprite[].lotag 0
 geta[].lotag lotagsaved
}
enda


Although there are 2 actors, only one will be tagged at a time; the other untagged one will just be for decoration.

I'm not asking to be spoon-fed the answer, but will I need to manipulate a game event so that if the touchplate lotag equals the 'lotagsaved' variable then the action CALLON will run for a certain actioncount?

The art tiles:

Attached thumbnail(s)

  • Attached Image: call_lights.png


This post has been edited by MC84: 28 December 2022 - 04:09 PM

0

User is offline   MC84 

#3156

Sorry to double post, but I went ahead and moved some things around. In onevent_EVENT_GAME, under a sprite[].picnum switch statement, I included these lines;

	case CALLUP
	{ ifn sprite[].lotag 0 geta[].lotag lotagsaved }
	break
	
	case CALLDN
	{ ifn sprite[].lotag 0 geta[].lotag lotagsaved }
	break
	
	case TOUCHPLATE
	{ ife sprite[].lotag lotagsaved
	   { set linked 1 } }
	break


Then under the actor declaration I've put this;

action CALLON 1 1 1 1 50 // advance one frame

useractor notenemy CALLUP 
{
 cstat 80

 ifaction CALLON
  {
   soundonce 35
   ifactioncount 64
    {
	 action ZERO
	 break
	}
  }

 ife linked 0 nullop
  else 
   ife linked 1
    { 
	 action CALLON 
	}
}
enda


However, even if I remove the above actor code, it appears that just this statement on its own

	case CALLUP
	{ ifn sprite[].lotag 0 geta[].lotag lotagsaved }
	break


causes the actor CALLUP to disappear when the game runs... Maybe I'm trying to be too ambitious here but can anyone point out why this is occurring?
0

User is offline   Danukem 

  • Duke Plus Developer

#3157

Lotags should be read into per-actor gamevars in EVENT_LOADACTOR. During that same event, the tag should be set back to 0 on the sprite and the variable should be the only thing holding the tag. Otherwise, you risk hardcoded effects if the tag is left on the sprite, such as the sprite disappearing just like an enemy would if you started a game at a lower difficulty than its lotag.

The exceptions to what I just wrote are the hardcoded effector sprites such as SE, RESPAWN, etc which were designed to have the tags left on them.
2

#3158

Don't want to open a new thread, I post this here just because it's the nearest thing.
AVG antivirus does not really likes the latest Eduke32 and Mapster32 synthesis, they are seen as malware/virus, without even control if the files are false positives. Does not happen with Debug versions.

This post has been edited by Fantinaikos: 29 December 2022 - 11:31 AM

0

User is offline   Reaper_Man 

  • Once and Future King

#3159

Antivirus programs easily trigger on small executables, as viruses are often small executables themselves. You can compile the source yourself to verify, but if the debug version is running then it is definitely a false positive, as the debug version is the same code with some additional compile flags.

If it's any consolation, I once had my own antivirus trigger after running the eduke32.exe that I just had compiled seconds beforehand.
0

User is offline   MC84 

#3160

EDIT - I don't think I can delete my posts - anyways I figured out that I misplaced a bracket.

This post has been edited by MC84: 30 December 2022 - 05:26 PM

0

User is offline   VGames 

#3161

Is there any way to manipulate the holoduke actor that the enemies go after? I wanted to make it electrocute nearby enemies, but I can't find any code for the actual holoduke you create when you use the holoduke item.
0

User is offline   Danukem 

  • Duke Plus Developer

#3162

View PostVGames, on 30 December 2022 - 08:17 PM, said:

Is there any way to manipulate the holoduke actor that the enemies go after? I wanted to make it electrocute nearby enemies, but I can't find any code for the actual holoduke you create when you use the holoduke item.


use EVENT_GAME since it doesn't have actor status. In that event,

ifactor APLAYER
     ife THISACTOR player[].holoduke_on
{
     // put your holoduke code here
}

1

#3163

I'm trying to illuminate actors when they shoot.
Setting the actor's shade once or multiple times does not work, nor does shadeto, presumably because it is taking the floor's shade/pal after.
So next to try is cstator noshade then set the shade to 0 or -127 and wait to remove noshade on the next tick. If taking off noshade makes the shade jump straight to the floor value instead of fading then 1 or 2 ticks of shadeto before.
Is there an existing command to brighten on shots (or invoke the hardcoded version for another sprite)?
1

User is offline   Danukem 

  • Duke Plus Developer

#3164

No, there's no command like that AFAIK. You'll have to control the shade manually in your code, or just use a different solution like adding fullbright pixels to their shooting frame or making them spawn a separate muzzleflash actor that is bright.

EDIT: I've never used it before, but there is an htflag for hardcoded badguy. I have no idea whether it would cause the sprite to brighten upon firing.

This post has been edited by Danukem: 31 December 2022 - 03:12 AM

1

User is offline   Reaper_Man 

  • Once and Future King

#3165

View Postlllllllllllllll, on 31 December 2022 - 12:41 AM, said:

I'm trying to illuminate actors when they shoot.
Setting the actor's shade once or multiple times does not work

What are you setting the shade to in your code? Setting the actor shade to -127 should illuminate them when they shoot the way hardcoded enemies illuminate. Like:

	shoot SOMETHING
	seta .shade -127


That should be all it takes.
0

#3166

the htflag worked
Setting it at spawn I don't see any side effects so far

View PostReaper_Man, on 31 December 2022 - 09:51 AM, said:

What are you setting the shade to in your code? Setting the actor shade to -127 should illuminate them when they shoot the way hardcoded enemies illuminate. Like:

	shoot SOMETHING
	seta .shade -127


That should be all it takes.

It doesn't visibly change
1

User is offline   jimbob 

#3167

nevermind, im didnt sleep very well :P

This post has been edited by jimbob: 31 December 2022 - 12:52 PM

0

User is offline   Danukem 

  • Duke Plus Developer

#3168

View Postlllllllllllllll, on 31 December 2022 - 10:21 AM, said:

the htflag worked
Setting it at spawn I don't see any side effects so far


We are talking about the 262144 flag right?
1

User is offline   VGames 

#3169

What’s the eduke scripting equivalent of ||?Like “or”. I want to couple multiple if statements together but I don’t know how? Like if this happens or if this happens then do this.

This post has been edited by VGames: 31 December 2022 - 01:53 PM

0

#3170

Yeah 262144 SFLAG_HARDCODED_BADGUY


Dunno when I need "or" I set the vars in such a way that 2 of the 3 values can be lumped together using >, <, and not=
1

User is offline   Danukem 

  • Duke Plus Developer

#3171

View PostVGames, on 31 December 2022 - 01:52 PM, said:

What’s the eduke scripting equivalent of ||?Like “or”. I want to couple multiple if statements together but I don’t know how? Like if this happens or if this happens then do this.


There really isn't, at least not for generically evaluating statements. You can however use ifor to evaluate pairs of values, providing that they are constants, vars, or specific struct members. For example:

ifor player[].heat_on player[].jetpack_on
al THISACTOR

That code will put the value of THISACTOR in the log when either the goggles are on or the jetpack is on. But the following will NOT compile:


ifor { ifg player[].htextra 0 } { ifg player[].shield_amount 0 } al THISACTOR

And removing the { } would change the meaning.
1

User is offline   Danukem 

  • Duke Plus Developer

#3172

View Postlllllllllllllll, on 31 December 2022 - 02:08 PM, said:

Yeah 262144 SFLAG_HARDCODED_BADGUY


By the way, I don't understand why your enemies aren't already lighting up when they fire. Mine do automatically, and I have not added that flag to them. I do define them as enemy -- are you not doing that?
1

User is offline   MC84 

#3173

I would like to be able to control SEENINE explosions based on their extra value so that I can have alternate explosion types.

onevent EVENT_LOADACTOR

switch sprite[].picnum

  case SEENINE // Alternate explosions
  { 
   ifn sprite[].extra -1
   geta[].extra extrasaved
  }
  break

endswitch

endevent


I had then initially put the following under EVENT_SPAWN... however I have moved it to EVENT_EGS;

onevent EVENT_EGS

switch sprite[].picnum

  case EXPLOSION2 // Alternate explosions
  { 
   seta[].extra actorvar[sprite[].owner].extrasaved
   ife sprite[].extra extrasaved
	 {
	  action ASMOKEBLAST1
	 }
	else nullop
  }
  break
 
endswitch
  
endevent


However it's now doing the opposite of what I intended - if I leave the SEENINE with an extra of -1; they spawn ASMOKEBLAST1, and if I give them an extra value they play the default EXPLOSION2... I suspect I do not properly understand the following command;

   seta[].extra actorvar[sprite[].owner].extrasaved


Does this assign the saved extra value (extrasaved) from EXPLOSION2's 'owner' SEENINE to EXPLOSION2?

--- I also wanted to know if switch statements can be nested? IE calling a state within a switch statement that also contains a switch statement?

This post has been edited by MC84: 31 December 2022 - 07:53 PM

0

#3174

View PostDanukem, on 31 December 2022 - 02:32 PM, said:

By the way, I don't understand why your enemies aren't already lighting up when they fire. Mine do automatically, and I have not added that flag to them. I do define them as enemy -- are you not doing that?

The actor that was causing problems was BOSS4. I had thought the useractor was only lighting properly because it was using the trooper's firelaser and the newbeast using shrinker.
1

User is offline   Danukem 

  • Duke Plus Developer

#3175

View Postlllllllllllllll, on 31 December 2022 - 08:45 PM, said:

The actor that was causing problems was BOSS4. I had thought the useractor was only lighting properly because it was using the trooper's firelaser and the newbeast using shrinker.


The vanilla BOSS4 doesn't shoot anything. What are you having it shoot?
1

User is offline   Danukem 

  • Duke Plus Developer

#3176

View PostMC84, on 31 December 2022 - 07:29 PM, said:

I would like to be able to control SEENINE explosions based on their extra value so that I can have alternate explosion types.


1. In the load actor event, when you grab the altered EXTRA value into a var, it's best to then set the EXTRA back to -1 (just in case the altered extra does something).

2.

case EXPLOSION2 // Alternate explosions
  { 
   ifn sprite[].owner -1 getav[sprite[].owner].extrasaved extrasaved
   // CHOOSE A SPECIFIC NUMERICAL VALUE FOR THE ALTERNATE EXPLOSION
   // LET'S SAY 2

   ife extrasaved 2 cstat 32768 // we are just turning it invisible for now

  }
  break


3.

Here's the vanilla EXPLOSION2 code:

action EXPLOSION_FRAMES 0 20 1 1  4
actor EXPLOSION2 1 EXPLOSION_FRAMES
  ifactioncount 20
    killit
enda


Here's what should be your version:


action EXPLOSION_FRAMES 0 20 1 1  4
action ASMOKEBLAST1 blah blah blah blah
actor EXPLOSION2 1 EXPLOSION_FRAMES

  ife extrasaved 2 ifaction EXPLOSION_FRAMES { action ASMOKEBLAST1 cstat 0 }

  ifactioncount 20
    killit
enda

2

User is offline   MC84 

#3177

Thanks Dan - Happy new year!
0

#3178

Everything I was having BOSS4 shoot was custom projectiles, and of those there were 2 types that are fired directly by the actor while the others are via spawned sprites. Those 2 being fired directly were not prompting any flash until the badguy flag was set.
I'll test useractors with custom projectiles and BOSS4 with stock projectiles to see if there's anything to that or not but it seems to just be an issue of how BOSS4 was implemented. I'm wondering if it's even included in killcount or not.
1

#3179

And after testing swapping the projectiles around I can't recreate the non-lighting behavior on any of them. Commenting out the htflag changes nothing and I don't understand why given there wasn't anything else that got changed. I checked both polymost/polymer and rolled back to 20211116-9796-dc16f81b2 and it's still displaying correctly now.
The map I was testing on has some stock enemies in a dark room with the custom ones so it's not a case of none of the shot flashes working, and the animations/projectiles themselves are very distinct as not to mix up which are being shot directly and which are shot by proxy.
I was very happy at seeing BOSS4 light up for the first time I'm not crazy really~~
1

User is offline   Danukem 

  • Duke Plus Developer

#3180

View Postlllllllllllllll, on 01 January 2023 - 01:57 PM, said:

And after testing swapping the projectiles around I can't recreate the non-lighting behavior on any of them. Commenting out the htflag changes nothing and I don't understand why given there wasn't anything else that got changed. I checked both polymost/polymer and rolled back to 20211116-9796-dc16f81b2 and it's still displaying correctly now.
The map I was testing on has some stock enemies in a dark room with the custom ones so it's not a case of none of the shot flashes working, and the animations/projectiles themselves are very distinct as not to mix up which are being shot directly and which are shot by proxy.
I was very happy at seeing BOSS4 light up for the first time I'm not crazy really~~


Don't feel too bad -- I have been gaslit by Duke many times.
1

Share this topic:


  • 123 Pages +
  • « First
  • 104
  • 105
  • 106
  • 107
  • 108
  • 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