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

Jump to content

  • 94 Pages +
  • « First
  • 92
  • 93
  • 94
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Danukem 

  • Duke Plus Developer

#2791

View Postjimbob, on 28 October 2021 - 10:10 AM, said:

the ifvar templ 10 is redundant anyway with the ifge sprite[PANZER].extra 0 line


Not really because even if extra is > 0 that doesn't mean extra/50 is > 0
0

User is offline   jimbob 

#2792

i guess, i'll test some more and if i dont get anymore hangups i'll just leave it remmed.
0

User is offline   Danukem 

  • Duke Plus Developer

#2793

View Postjimbob, on 28 October 2021 - 11:31 AM, said:

i guess, i'll test some more and if i dont get anymore hangups i'll just leave it remmed.


It won't cause a hang because the drawing loop won't even start if temp is 0 after the division. I was just pointing out that there are cases where the break will be executed.
0

User is offline   RPD Guy 

#2794

Hello,

I don't know if someone asked this before, but, is there a way to tint a sector without affecting its containing sprites' pal?

I know that "spritenopal" kinda "solves" this, but I don't want to set every game sprite with this definition.
0

User is offline   Danukem 

  • Duke Plus Developer

#2795

Maybe? On the wiki it says you press N on a sprite to toggle its auto-shading, so there maybe something undocumented for pal. In game, those settings are stored in the htflags bitfield, but that member doesn't seem to be stored in the map. The "flags" member in mapster is for cstat, which is different. However, the "no shade" bit is duplicated in cstat, which I'm guessing they did so that it could be stored in the map file.
0

User is offline   Danukem 

  • Duke Plus Developer

#2796

Since this is the scripting thread, you may want a scripting solution. It's a bit cumbersome, but you could define a new sprite and then put it into the sector where you want the sprites to ignore pal:

define NOPALSPRITE ####
gamevar tempsprite 0 0
gamevar tempvar 0 0

eventloadactor NOPALSPRITE

cstat 32769
headspritesect tempsprite sprite[].sectnum
whilevarn tempsprite -1
{
  geta[tempsprite].htflags tempvar
  orvar tempvar 64
  seta[tempsprite].htflags tempvar
  nextspritesect tempsprite tempsprite
}

enda


I think that will work but I'm not entirely sure because the htflags might get overwritten after map load. If that's the case then the code would need to run later.
0

#2797

If Duke has 1 hp, for example, and is hit by his own projectile in the same tick as an opponent hits him, it's pretty random whether he suicides or the opponent gets the kill. Perhaps, it seems that he mostly suicides. I've tried set it up so that Duke has 1000hp and hits himself every tick with a 1 dmg projectile. Then, when I, an opponent, shoots him with a 2000 dmg projectile, Duke suicides (which is weird IMO).

It seems that all dmg incurred at the same tick is actually accumulated, but htowner and htpicnum and so on contains a "random" value among those that hit Duke in that tick.

I thought I could manipulate some value, e.g. setactor[THISACTOR].htowner some_id_that_is_not_the_actor_itself, but that doesn't seem to have any influence on whether Duke suicides or not.

Same but different: Whenever Duke is hit, the opponent hitting Duke is notified (say, by a hitmarker), but if multiple opponents hit Duke in the same tick, how would I go about notifying all opponents? Atm I'm using htowner, which obviously only holds a single value, so how would I go about this?
0

User is offline   Reaper_Man 

  • Once and Future King

#2798

EVENT_DAMAGESPRITE maybe?
1

User is offline   Danukem 

  • Duke Plus Developer

#2799

View PostReaper_Man, on 14 December 2021 - 06:14 PM, said:

EVENT_DAMAGESPRITE maybe?


I'll bet you are right. That event should be triggered every time there is damage, even if it happens to the same sprite multiple times in one tic.

gamevar htowner2 -1 1
gamevar damagetime 0 1
gamevar playerID 0 1

onevent EVENT_DAMAGESPRITE

ife sprite[RETURN].picnum APLAYER
{
  geta[RETURN].yvel playerID
  ife playervar[playerID].damagetime player[playerID].player_par setplayervar[playerID].htowner2 sprite[THISACTOR].owner
  else setplayervar[playerID].htowner2 -1
  setplayervar[playerID].damagetime player[playerID].player_par
}

endevent


I don't normally work with different player IDs since I have only been scripting singleplayer stuff for a long time, but if that code above is correct what it will do is put a second sprite ID into the htowner2 var for the specific player who got damaged by two sprites in the same tic. I think the likelihood of there being a third sprite doing damage in the same tic is pretty low, so having two IDs should be sufficient. Even assuming that works, it won't save how much damage was done by each, so more work would be needed for that feature. However, if one sprite was the same player who got hit and the other sprite is a different player, it would then be easy to always set the htowner to one or the other in that situation, giving credit where it is desired.

EDIT: Also, htowner2 should be cleared back to -1 by the damage handling code that gives credit; otherwise, it stays set until the player is damaged again.

This post has been edited by Danukem: 14 December 2021 - 07:41 PM

2

#2800

That worked, thanks!

Is it possible to make sprites only visible to some of the players in a multiplayer game? I want to show trailing footsteps of players if nightvision is turned on, but I don't want all players to see these footsteps, only those who have nightvision on.
1

#2801

Turns out that by using myconnectindex I can test if getplayer[myconnectindex].heat_on is 1 and draw the footprints accordingly. This means that even if a game contains 3 dukes, it is only when your own duke has goggles turned on that the sprites are drawn - they are in turn not drawn on the screen for other players (unless they also have goggles turned on). Since it is only visual effects that uses myconnectindex it does not cause a desync :)
0

User is offline   Danukem 

  • Duke Plus Developer

#2802

You rediscovered some ancient EDuke knowledge.
0

Share this topic:


  • 94 Pages +
  • « First
  • 92
  • 93
  • 94
  • 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