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

Jump to content

  • 124 Pages +
  • « First
  • 82
  • 83
  • 84
  • 85
  • 86
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Mark 

#2484

View PostTrooper Dan, on 16 December 2018 - 05:27 PM, said:

The easiest way involves actor A having the sprite ID of actor B stored in a per-actor gamevar. This is one of those things that is easier to do than to explain. If the guys is the only one of his picnum anywhere near the boombox, then you could grab his ID with findnearactor -- use that command just once when the boombox initializes to put his ID in a gamevar, then monitor the actor to see if his extra drops below 1.


I forgot to post here that I was able to figure it out with your suggestion. Thanks.
0

#2485

What exactly do I need to do in order to play other music on custom maps? I thought I would start off by using "music { id "E1L1" file "grabbag.ogg" }" in DEFS.CON to see the command work, but it didn't. Couldn't put it in USER or GAME either. I tried making a somename.def file and included in GAME but i just get this
Compiling: GAME.CON (161162 bytes)
Including: DEFS.CON (35992 bytes)
Including: USER.CON (45661 bytes)
Including: g.def (38 bytes)
g.def: At top level:
g.def:1: error: parameter `{' is undefined.
g.def:1: error: found more `}' than `{'.
GAME.CON: In state `setwinner':
GAME.CON:69: error: found more `}' than `{'.

g.def only contains "music { id "E1L1" file "grabbag.ogg" }".
- Or, I really just want to play the grabbag theme when a player wins a multiplayer game. If I play the theme in the APLAYER actor code you can hear it multiple times from the different players on the map...

This post has been edited by thisbecasper: 12 January 2019 - 12:39 PM

0

User is offline   Mark 

#2486

I just took a look at my USER.CON file and the music lines for the levels do not use any braces.
1

#2487

View PostMark, on 12 January 2019 - 02:56 PM, said:

I just took a look at my USER.CON file and the music lines for the levels do not use any braces.


Yup, thanks, that made it possible to play another song at Holly. Although this doesn't work
music 1 stalker.mid GRABBAG.mid streets.mid watrwld1.mid snake1.mid
        thecall.mid ahgeez.mid GRABBAG.mid streets.mid watrwld1.mid snake1.mid

even though this worked
music 1 GRABBAG.mid dethtoll.mid streets.mid watrwld1.mid snake1.mid
        thecall.mid ahgeez.mid dethtoll.mid streets.mid watrwld1.mid snake1.mid

and that has always been my problem. I can't play other music than dethtoll on usermaps...
0

#2488

Does anyone know why I get out of sync when I'm trying to alter .max_player_health or .htextra??????? I've isolated the problem, and it occurs consistently. I'm of course using the EDuke32-OldMP launcher. The desync on .max_player_health triggers sometimes if the player picks up hp, exceeding 100 hp. Same problem seems be the case with .htextra. When a player runs my .htextra code and goes from >100 to <=100 the game desyncs...
0

User is offline   Danukem 

  • Duke Plus Developer

#2489

View Postthisbecasper, on 12 January 2019 - 05:47 PM, said:

Does anyone know why I get out of sync when I'm trying to alter .max_player_health or .htextra??????? I've isolated the problem, and it occurs consistently. I'm of course using the EDuke32-OldMP launcher. The desync on .max_player_health triggers sometimes if the player picks up hp, exceeding 100 hp. Same problem seems be the case with .htextra. When a player runs my .htextra code and goes from >100 to <=100 the game desyncs...


I don't know and probably won't be able to help. However, if you post the code you are using to change those values, maybe I will have a helpful suggestion. I'm assuming you are talking about changes to those values caused by your own code and not changes in the vanilla game.
0

#2490

View PostTrooper Dan, on 12 January 2019 - 05:55 PM, said:

I don't know and probably won't be able to help. However, if you post the code you are using to change those values, maybe I will have a helpful suggestion. I'm assuming you are talking about changes to those values caused by your own code and not changes in the vanilla game.


Thank you very much for your interest. I'm at a point where I'm conviced my code is bug-less :) and it has something to do with underlying code - I hope I'm wrong. I'll try to outline the central aspects of my code:

So, the idea of this MP gamemode is simple: First to 30 wins. For every kill you are behind the leader, you get 5 bonus max hp:

state regulatemaxhealth
	getplayer[THISACTOR].frag tempone
	getplayer[THISACTOR].fraggedself temptwo
	subvarvar tempone temptwo //actual amount of kills
	setvarvar tempthree maxscore //maxscore is leading player's score and is working correctly
	subvarvar tempthree tempone //Difference between your score and the leader's
	mulvar tempthree 5
	addvar tempthree 100
	setplayer[THISACTOR].max_player_health tempthree // It's actually not this line that causes the desync
ends


If I kill my opponent, he lies dead on the ground and has now 0/105 hp. When he respawns he gets 105/105 and we have a desync. If I suicide and has yet to spawn I'm on 0/105. However, when I respawn there's no desync. So I have to be killed by an opponent, before the desync happens on a respawn (and it happens every time).

I have no code in EVENT_RESETPLAYER or anything alike. Neither do I have code on killing blows, respawns or anything like that. If I remove the last line in the above state, I get no desync, but then I lose the main part of the mod.

This post has been edited by thisbecasper: 12 January 2019 - 06:32 PM

0

#2491

Turns out, it was actually because I was calculating the maxscore variable in EVENT_DISPLAYREST. I think I've read somewhere displayrest is only for HUD :))
0

User is offline   Danukem 

  • Duke Plus Developer

#2492

View Postthisbecasper, on 13 January 2019 - 02:18 AM, said:

Turns out, it was actually because I was calculating the maxscore variable in EVENT_DISPLAYREST. I think I've read somewhere displayrest is only for HUD :))


Yeah, display events are frame rate dependent and nothing that needs to be synced should ever be handled in them.
1

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#2493

totalclock is a variable that is incremented based on 120 fps. Animations (tiles, shading, etc) are usually based on totalclock.

However Duke 3D carelessly handle a few animations based on frame rate updates, such as a shrunk players fists.

This post has been edited by Fox: 13 January 2019 - 05:37 PM

0

#2494

Can it be that it is difficult to know what kind of projectile hit you with its radius explosion? I'm just trying to make a flash bang, but I can't figure out how to check what picnum made the explosion...
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#2495

If PROJ_WORKSLIKE equals PROJECTILE_RADIUS_PICNUM, then ifwasweapon will return the picnum.
1

#2496

I'm still looking for a way to can change the default song on user-maps. Anybody? :)
0

User is offline   Mark 

#2497

 thisbecasper, on 12 January 2019 - 03:23 PM, said:

Yup, thanks, that made it possible to play another song at Holly. Although this doesn't work
music 1 stalker.mid GRABBAG.mid streets.mid watrwld1.mid snake1.mid
        thecall.mid ahgeez.mid GRABBAG.mid streets.mid watrwld1.mid snake1.mid

even though this worked
music 1 GRABBAG.mid dethtoll.mid streets.mid watrwld1.mid snake1.mid
        thecall.mid ahgeez.mid dethtoll.mid streets.mid watrwld1.mid snake1.mid

and that has always been my problem. I can't play other music than dethtoll on usermaps...


I took a look at what I did for my Graveyard mod.

// Music for title and end
music 0 GAMEOVER.mid BRIEFING.MID

// Music for the individual levels
music 1 graveyardnew.ogg map2.ogg map2.ogg bonus.mid

I was able to choose whatever I wanted. I have no idea why you can't. As a test, try an older eduke32 version from a few months or a year ago.
0

#2498

 Mark, on 17 January 2019 - 06:21 AM, said:

I took a look at what I did for my Graveyard mod.

// Music for title and end
music 0 GAMEOVER.mid BRIEFING.MID

// Music for the individual levels
music 1 graveyardnew.ogg map2.ogg map2.ogg bonus.mid


Maybe I have to say that I'm not playing a custom episode, but rather on usermaps (so I guess thats E1L8?)

 Mark, on 17 January 2019 - 06:21 AM, said:

As a test, try an older eduke32 version from a few months or a year ago.


Good point. I'm using the eduke-oldmp build, but I tried the "normal" eduke and it's the same. The songs change when I replace the filenames with others, like you showed. It still plays dethtoll on usermaps though...

This post has been edited by thisbecasper: 17 January 2019 - 07:14 AM

0

#2499

Is it possible to reduce the speed of the fall of the actor?
actor 3747
	ifvarvarg sprite[THISACTOR].z 0 {
		setactor[THISACTOR].htbposx sprite[THISACTOR].z
		setactor[THISACTOR].z -100000
	} else
		fall
	cstator 8192 
enda


This post has been edited by Mr. Alias Nameless: 30 January 2019 - 01:26 AM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#2500

The easiest way is to add ifrnd % before.

This post has been edited by Fox: 30 January 2019 - 02:06 AM

0

User is offline   Danukem 

  • Duke Plus Developer

#2501

If you want it to be exactly half speed and not random, you can use ifvarand player[].player_par 1 fall
0

User is offline   Mark 

#2502

Darn. I wish I knew that fall speed was adjustable. I have an enemy that falls off a ladder but the fall was too fast. I ended up using a combo of move and iffloordistl commands. This new way would have been much quicker.
0

User is offline   Danukem 

  • Duke Plus Developer

#2503

 Mark, on 30 January 2019 - 06:07 AM, said:

Darn. I wish I knew that fall speed was adjustable. I have an enemy that falls off a ladder but the fall was too fast. I ended up using a combo of move and iffloordistl commands. This new way would have been much quicker.


It's not really "adjustable". What both Fox and I are saying is you can simply not have the command be executed every single game tic.
0

User is offline   F!re-Fly 

#2504

A question. Is it useful to post one of my problems here? In addition to my thread?
0

User is offline   F!re-Fly 

#2505

 Firefly_Trooper, on 30 January 2019 - 11:41 AM, said:

A question. Is it useful to post one of my problems here? In addition to my thread?


Finally it will not be worth it, because I have a new unexpected problem that pisses me off :) My King Cobra REFUSES to die being once shrunk.

The code is posted on my thread.

This post has been edited by Firefly_Trooper: 31 January 2019 - 06:22 AM

0

User is offline   Mark 

#2506

In another thread Trooper Dan posted:
" onevent EVENT_FIRE set RETURN -1 break

That will prevent weapon firing but quick kick is a separate function."

How would I use that so its active only while the player is in a "lockplayer" mode during a conversation with an enemy?
If it helps any, there are quotes on the top of the screen and sound clips playing during this time.

This post has been edited by Mark: 31 January 2019 - 08:30 PM

0

User is offline   Danukem 

  • Duke Plus Developer

#2507

 Mark, on 31 January 2019 - 08:23 PM, said:

How would I use that so its active only while the player is in a "lockplayer" mode during a conversation with an enemy?
If it helps any, there are quotes on the top of the screen and sound clips playing during this time.


For that context it would be better to use setp[].weapon_pos -9

That will force the weapon down to the bottom of the screen like you were switching weapons and not allow the player to fire. As soon as you stop setting it to -9, it will smoothly come back up.

Now let's say that quotes 150 to 155 are used for the conversation (just picking numbers at random), and are not used for other purposes. Then the following code would work in the APLAYER actor:

ifg player[].fta 0 ifge player[].ftq 150 ifle player[].ftq 155 setp[].weapon_pos -9

But it would be better to do it in the same block of code that is locking the player.
1

User is offline   Mark 

#2508

I know next to nothing about using member structs so instead of just copy/pasting your code I looked up the parts of it to understand it.
I see a potential problem. Hopefully I'm wrong. Right now the quotes in the conversation are part of the enemy actor's code and are different lengths and synced with the sound clips using ifcount for timing. The fta according to the wiki is a countdown timer for how long to display a quote. Am I going to break my existing timings by using fta?

This post has been edited by Mark: 01 February 2019 - 05:51 AM

0

User is offline   Mark 

#2509

It worked fine in the APLAYER code even though the lockplayer comes from the enemy code. The gun popped up for a second in the middle. Probably just some ifcount timing I have to tighten up a bit.
I need this for at least 3-4 other places. I'm assuming I can reuse this line multiple times with the proper quote numbers.
Thanks again Buddy.

This post has been edited by Mark: 01 February 2019 - 12:12 PM

0

User is offline   F!re-Fly 

#2510

And thank you for the function EVENT_FIRE.
0

User is offline   F!re-Fly 

#2511

If I understood correctly, EVENT_FIRE can be used to prevent a monster from shooting in a vacuum?
0

User is offline   Danukem 

  • Duke Plus Developer

#2512

 Mark, on 01 February 2019 - 08:43 AM, said:

It worked fine in the APLAYER code even though the lockplayer comes from the enemy code. The gun popped up for a second in the middle. Probably just some ifcount timing I have to tighten up a bit.
I need this for at least 3-4 other places. I'm assuming I can reuse this line multiple times with the proper quote numbers.
Thanks again Buddy.


My advice is to try to organize the code better before it gets out of hand. Write a state that can be used by different enemies, which has all of the necessary code in it (none of it needs to be in the player actor). For things that change from one enemy to another, you can set one or more vars before the state is called.
1

User is offline   Mark 

#2513

I fully agree but too late. I considered it out of hand before I started. Lack of continuity has been a hurdle for me. IIRC I am the 3rd coder to get his hands dirty in this project plus some of the previous code was gathered from even earlier code from the early 2000's. Coding styles for different actors varies. There is so much organized and disorganized stuff spread around I surprised myself for getting as far as I have. Also I did not have much pre-planning at all and as I think of new fun features I add them in ( feature creep ). There is also so much undocumented or unused code blocks that I find as I cruise thru the code and then decide on a whim to try and use them. I'm going at this in a very haphazard way.

This post has been edited by Mark: 01 February 2019 - 03:50 PM

0

Share this topic:


  • 124 Pages +
  • « First
  • 82
  • 83
  • 84
  • 85
  • 86
  • 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