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

Jump to content

  • 124 Pages +
  • « First
  • 42
  • 43
  • 44
  • 45
  • 46
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Jblade 

#1285

Just a silly question, but I want to make sure it's accurate before I go ahead - if I want to remove a percentage of a number, there's no command to do that I have to work it out manually right? So for instance say TEMP8 is equal to 25:
	ifvare PERSONEL_RESEARCH[8] 2 // player has thermal weaving? reduce damage by 20%
		{
		setvarvar TEMP7 TEMP8
		mulvar TEMP7 10
		subvarvar TEMP7 TEMP8
		subvarvar TEMP7 TEMP8
		divvar TEMP7 10
		setvarvar TEMP8 TEMP7
		}

That should reduce it by 20% right?
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1286

What an ugly code, you should simply multiply it by 4 and divide by 5.
0

User is offline   Jblade 

#1287

Yeah ok so there is a better way to do it then, please don't call my code 'ugly' when I'm asking for help.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1288

Yo code so fat when you get on top of her your ears pop!
1

User is offline   Mblackwell 

  • Evil Overlord

#1289

Btw for percentages in general, if you wanted 20% of 5 then X = (5 * 20) / 100.

So to add 20% you'd do X = (5 * 120) / 100
1

User is offline   Helixhorned 

  • EDuke32 Developer

#1290

For gamevars, two practically undocumented but used in-the-wild flags are 1024 (NODEFAULT) and 131072 (NORESET). This post is about the former.

What bit 1024 is likely supposed to do is to prevent resetting the gamevar's value to the default/initial one on various occasions such as starting a new game. For global and per-player gamevars, it could be e.g. used to hold information about gained mod-wide achievements.[1] However, currently, the value of such gamevars would still be (always) restored by savegames or (if NORESET is clear) when restoring mapstates.
While I'm not sure whether to call it a bug (there was never a specification), I still think it's not the desired behavior. Suppose you kill the final boss and win $ 106 as an award, but because you liked the final fight so much, you load up the last savegame and attempt to beat it once more. This time, you fail though, and all your money is lost ;).

What I intend to do in LunaCON is to make NODEFAULT gamevars persist during the entire duration of a session, with the only option of restoring it being via readgamevar. (I'm not yet sure how the interaction with NORESET should be.) Because this is an externally visible change to gamevar behavior, I'll probably also backport it to C-CON. Are there any objections to this plan? It should be noted that in all the mods that I'm batch-testing CON-compilation on, there are only a total of four uses of that bit.

----------
[1]For per-actor gamevars, it has a somewhat technical use, the original one being rather meaningless. It can be set to prevent actor variables being reset on spawn (this includes the initial one from premap), so that they can be manipulated before: e.g. from eventloadactor code.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1291

By the way, is it possible to explain the purpose of the other flags? I know what 0, 1 and 2 are for but the Wikia is not very clear about the meaning of the others.
0

User is offline   Helixhorned 

  • EDuke32 Developer

#1292

View PostFox, on 24 May 2013 - 11:50 AM, said:

By the way, is it possible to explain the purpose of the other flags? I know what 0, 1 and 2 are for but the Wikia is not very clear about the meaning of the others.

They're not part of the official API and thus off-limits to users. LunaCON will disallow setting them unless we specify the meaning of each one clearly and unambiguously. No more guessing and half-baked workarounds!

[Edit: it's not my intent to criticize anyone's work, but I hope it's clear that exposing functionality that is not 100% understood is just a dead end.]
0

User is offline   zazo 

#1293

is a command exist to make a zoom of the screen (usable for a sniper weapon for example)...
another command to set a "hit radius" for a melee weapon ? the defineprojectile xxx PROJ_RANGE seems to set the depth but not a radius around the player...
0

User is offline   LAW 

#1294

setactor[THISACTOR].xrepeat X
setactor[THISACTOR].yrepeat Y


I have used this within eventloadactor and it does nothing. Including these strings with ifactor inside EVENT_GAME also does nothing. The only thing which have worked is old style sizeat at the beginning of the actor code, but it resizes the actor upon seeing the player, which is bad. What am I doing wrong? :/
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1295

First of all, you have actually set the gamevars X or Y to an actual value, right? Because you have posted a small fragment of code.

View Postzazo, on 30 May 2013 - 02:30 AM, said:

is a command exist to make a zoom of the screen (usable for a sniper weapon for example)...
another command to set a "hit radius" for a melee weapon ? the defineprojectile xxx PROJ_RANGE seems to set the depth but not a radius around the player...

Making an explosive hitscan would require more work.

This post has been edited by Fox: 31 May 2013 - 12:10 AM

0

User is online   Danukem 

  • Duke Plus Developer

#1296

View PostFox, on 31 May 2013 - 12:09 AM, said:

Making an explosive hitscan would require more work.


Not too much, though. You could set PROJ_SPAWNS to an actor that explodes with whatever hitradius you want.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1297

That wouldn't work very well. The PROJ_SPAWNS seems to be flawed, besides half of the time it spawns inside of walls canceling the radius explosion. Also it would not return the ownership of the actor firing the hitscan, thus multiplayer score would not work.
0

User is offline   LAW 

#1298

View PostFox, on 31 May 2013 - 12:09 AM, said:

First of all, you have actually set the gamevars X or Y to an actual value, right? Because you have posted a small fragment of code.


Of course, I am not that stupid :lol: Anyway the whole thing looked like this:

eventloadactor MOSQUITO
setactor[THISACTOR].xrepeat 10
setactor[THISACTOR].yrepeat 10
enda


Why it doesn't work? WHYYYY? :lol:

Maybe it's because in erampage, but it should work...
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1299

Is MOSQUITO a hard-coded actor?
0

User is offline   LAW 

#1300

View PostFox, on 31 May 2013 - 10:36 AM, said:

Is MOSQUITO a hard-coded actor?


Hard-coded or not, why is it resized freely by "sizeat", but not by the code from above?

This post has been edited by LAW: 31 May 2013 - 10:57 AM

0

User is offline   Diaz 

#1301

If it's hard-coded, the hard-coded stuff happens after eventloadactor, so it's being reset to the hard-coded size
0

User is offline   LAW 

#1302

Dam. Thanks though.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1303

View PostLAW, on 31 May 2013 - 10:56 AM, said:

Hard-coded or not, why is it resized freely by "sizeat", but not by the code from above?

It shouldn't.
0

User is offline   blizzart 

#1304

View Postzazo, on 30 May 2013 - 02:30 AM, said:

is a command exist to make a zoom of the screen (usable for a sniper weapon for example)...
another command to set a "hit radius" for a melee weapon ? the defineprojectile xxx PROJ_RANGE seems to set the depth but not a radius around the player...


That´s something I´m also interested in.
0

User is offline   zazo 

#1305

View PostTrooper Dan, on 31 May 2013 - 09:18 AM, said:

Not too much, though. You could set PROJ_SPAWNS to an actor that explodes with whatever hitradius you want.


Yes, but it muste be a hitradius that not hurt the player, only enemy. And a "knee" weapon style, not explosion ...
0

User is offline   LAW 

#1306

As we know in Duke Nukem, RESPAWN "passes" its pal to the spawned sprite. The same thing happened in the original Redneck.

I have an enemy, which does a few things upon dying when spritepal 30, 31 or 32. It works, when that enemy is put on the ground in Build. However, when it is spawned by a RESPAWN it does nothing and judging from its spritepal dependant behaviour it has pal 0. I've come with an idea to put the foe on the conveyor belt, where it could be moved into the silent teleport. But somehow it doesn't bother the conveyor belt's motion and it doesn't fall into the teleport's chasm even though it has 'fall' command in its code. Changing 'actor' to useractor enemy' also doesn't change things.

I've tried to code it out in EVENT_GAME. Maybe my logic is wrong, but I will show, what was done:

gamevar OWNER 0 0
gamevar PAL 0 0

ifactor MAMA
getactor[THISACTOR].owner OWNER
ifvare OWNER RESPAWN getactor[OWNER].pal PAL
setactor[THISACTOR].pal PAL //OR ifvare PAL 30 spritepal 30


It doesn't work. Is there a workaround to have that enemy appear on demand and do the special actions?

This post has been edited by LAW: 08 June 2013 - 05:20 AM

0

User is offline   XThX2 

#1307

I think there was a thing with Duke's enemies that they had to "see" you first for their code to run, or something like that. IIRC fall is one of those. (I can remember the Enforcer's on episode 2 falling after they see you, in the first level.)

This post has been edited by XThX2: 08 June 2013 - 06:26 AM

0

User is offline   Daedolon 

  • Ancient Blood God

#1308

It's not true only for enemies, but any actor, including all the FEM actors.
0

User is offline   LAW 

#1309

But I have put a NEWBEAST clone in my Fury161r map and it was transported by a conveyor belt even though it hasn't seen the player...
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1310

View PostLAW, on 08 June 2013 - 05:20 AM, said:

As we know in Duke Nukem, RESPAWN "passes" its pal to the spawned sprite.

Not really, in the bosses case it has been hard-coded to work that way. Surprisingly the Assault Tropper has been forgotten, as a result it fails to respawn Captains instead.

This post has been edited by Fox: 08 June 2013 - 08:02 AM

0

User is offline   LAW 

#1311

So do you have any idea what I could do, except of just putting the enemy on the ground?
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1312

View PostLAW, on 08 June 2013 - 05:20 AM, said:

I've tried to code it out in EVENT_GAME. Maybe my logic is wrong, but I will show, what was done:

gamevar OWNER 0 0
gamevar PAL 0 0

ifactor MAMA
getactor[THISACTOR].owner OWNER
ifvare OWNER RESPAWN getactor[OWNER].pal PAL
setactor[THISACTOR].pal PAL //OR ifvare PAL 30 spritepal 30


It doesn't work. Is there a workaround to have that enemy appear on demand and do the special actions?

There are some problems with your code. First of all the .owner may be reseted after EVENT_EGS, so you should save it to a gamevar before.

Also shouldn't the code after "ifactor MAMA" be inside of brackets? Without it the code would attempt to change the pal of all sprites, including the RESPAWN ones.

View PostLAW, on 08 June 2013 - 08:00 AM, said:

So do you have any idea what I could do, except of just putting the enemy on the ground?

I think it doesn't apply here since EVENT_GAME runs regardless of the actor being seen yet by player or not.

This post has been edited by Fox: 08 June 2013 - 08:03 AM

1

User is offline   LAW 

#1313

View PostFox, on 08 June 2013 - 08:02 AM, said:

EVENT_EGS


Uh, oh I have forgot about this event - it has soooo unimpressive name :lol:

So now everything works like a charm. Thanks Fox. I am a foxy gentleman and I like foxes :lol:
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1314

EGS = Enter Game Spawn/State?
0

Share this topic:


  • 124 Pages +
  • « First
  • 42
  • 43
  • 44
  • 45
  • 46
  • 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