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

Jump to content

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

EDuke32 Scripting  "CON coding help"

User is offline   Jblade 

#1339

gamevar TEMP 0 2 // gamevars should be outside of actors

useractor notenemy MYACTOR
ifhitweapon 
{ 
strength 1
action ANIM2
sound XXX
getactor[THISACTOR].z TEMP 
espawn XXXX 
addvar TEMP 4096 // This will move it up a bit 
setactor[RETURN].z TEMP
}
enda

1

User is offline   Mark 

#1340

The animation still runs only the first time. I tried a different item to spawn and it was at correct height , with or without the extra code. It seems spawning the gun turret 2360 was the problem. So I will re-think what to spawn instead of that. Having the animation run only once I can live with. It was just "icing on the cake" to have it run every time. As long as the sound is played the effect will work ok. Thanks guys for the help. I never used gamevars before so its something new I learned today. Thats always good.

BTW, the new item I tested the spawn with was one of my new enemies. I happened to shoot the actor with the machine gun. A whole butt-load of enemies appeared. It was like an episode of Serious Sam. :)
0

User is offline   Mikko 

  • Honored Donor

#1341

The animation thing shouldn't be hard to do. Remember the trash bin that gets a dent when hit but reverts back to its idle animation shortly after? Use that as a starting point.
1

User is offline   Mark 

#1342

Thats why my first uneducated guess was to use the resetactioncount command hoping that it would reset the action for the next time. I'll take a peek at the trashcan code.

EDIT: That did it. Having the idle action run after the animation and then break command are what did it. WOO HOO. Thanks again.

Now for my next 24 questions...... :) Actually I think I'll take a short break from the "hard" stuff and take care of some easier sound and projectile replacements.

This post has been edited by Mark.: 30 June 2013 - 02:27 PM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1343

Is it possible to extend EVENT_DISPLAYROOMS to the Automap? I use it to change the sector or wall structures temporarily (similar to EVENT_ANIMATESPRITES), however I can't do that for the Automap.
0

User is offline   m210® 

#1344

I need help with own rotate sectors.
I can't make move of player in such sectors

Here is a part of my rotator:
//Code for rotation sector
	ifvare active 1 { setactorvar[THISACTOR].active 0 setvar rot_moving 0 }			
	getactor[THISACTOR].ang ang
	ifvare rot_turnway 0 
	{ addvarvar ang rot_angspeed ifvarg ang 2047 setvar ang 0 } else 
	ifvare rot_turnway 1 { subvarvar ang rot_angspeed ifvarl ang 0 setvar ang 2048 }
	subvarvar rot_saveang rot_angspeed
	setactor[THISACTOR].ang ang //set rotation angle of own sectoreffector sprite. With rotate of this sprite, sector will be rotating too.
	
	
//Here I trying move a player with the sector together
	getplayer[THISACTOR].i PLAYERID
	setvarvar spriteid PLAYERID
	getactor[spriteid].sectnum se_sector
	getactor[THISACTOR].sectnum se_sect1
	ifvarvare se_sector se_sect1                 //if player in a sector
	{
		getplayer[THISACTOR].posx x2
		getplayer[THISACTOR].posx y2
		subvarvar x2 sprite[THISACTOR].x
		subvarvar y2 sprite[THISACTOR].y
		mulvarvar x2 x2
		mulvarvar y2 y2
		addvarvar x2 y2
		sqrt x2 se_dist //calculating a distance between player and point of rotate sector
			
		setvarvar x2 sprite[THISACTOR].x
		addvarvar x2 se_dist
		rotatepoint sprite[THISACTOR].x sprite[THISACTOR].y x2 sprite[THISACTOR].y ang x y
		setplayer[THISACTOR].posx x
		setplayer[THISACTOR].posy y //set coodinates of player after rotation

	}




And of cource, with this code the player can't moving and after some tics player get away from sector.

This post has been edited by M210: 06 July 2013 - 12:19 AM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1345

Shouldn't you make the floor align relative?
0

User is offline   m210® 

#1346

Quote

Shouldn't you make the floor align relative?


it makes no difference in my code

This post has been edited by M210: 06 July 2013 - 02:28 AM

0

User is offline   m210® 

#1347

So, I just want to rotate a player around point with preservation of movement. Have anybody similar code?
rotatepoint doesn't works correctly with calculating distance from player to point at each tic
0

User is offline   darkcaleb 

#1348

Hey, I was wondering if this was possible. Is it possible for changing the loading screen with a animated screens of 5 frames. Does it need to be code or?
0

User is offline   Jblade 

#1349

View Postdarkcaleb, on 06 July 2013 - 02:35 PM, said:

Hey, I was wondering if this was possible. Is it possible for changing the loading screen with a animated screens of 5 frames. Does it need to be code or?

I'm sure animated tiles do work during loading, try it by checking out this tutorial on the Eduke32 wiki.
0

User is offline   darkcaleb 

#1350

hey James, i tried the code.What i did is I created a new con-code named dkgame.con and I put this text in it

oneventonevent EVENT_GETLOADTILE
setvar RETURN <3281>
endevent

Put a include dkgame.con in game.con and i get a error. If you create new con-code´s do you need to put any text in the file or? And how does the animation precisely work

This is the error I get:

Including: dkgame.CON (62 bytes)
dkgame.CON: In event `EVENT_GETLOADTILE':
dkgame.CON:2: error: parameter `' is undefined.
dkgame.CON:2: error: expected a keyword but found `'.
GAME.CON:34: error: parameter `ANULLACTION' is undefined.
GAME.CON:34: error: expected a keyword but found `0'.
Found 0 warning(s), 4 error(s).

I haven't done any con-coding in the past and I do want to know how the things work. Hopefully I can start with simple con-coding :)
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1351

oneventonevent?
0

User is offline   darkcaleb 

#1352

View PostFox, on 07 July 2013 - 05:13 AM, said:

oneventonevent?


Sorry this is what is in the dkgame.con file:

onevent EVENT_GETLOADTILE
setvar RETURN <3281>
endevent
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1353

Remove the <>, also it would be better to use LOADSCREEN instead of 3281.

This post has been edited by Fox: 07 July 2013 - 06:23 AM

0

User is offline   darkcaleb 

#1354

Thanks Fox. It did work. But i want to give it animations, I want to use a picture that has 4 frames. I want this to be the loading screen for something I'm working on. I have already put animation in tile file with duke-res.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1355

I think this would work:

onevent EVENT_GETLOADTILE
  setvarvar RETURN totalclock
  divvar RETURN 16 // animation speed
  andvar RETURN 3
  addvar RETURN LOADSCREEN
endevent 

0

User is offline   darkcaleb 

#1356

Hey Fox thanks! I did work very well. Still I was wondering about the what this all means

onevent EVENT_GETLOADTILE (don't know this purpose)
setvarvar RETURN totalclock (don't know this purpose)
divvar RETURN 16 // animation speed (this is the speed)
andvar RETURN 3 (don't know this purpose)
addvar RETURN LOADSCREEN (this is the tile 3281 as I'm right?)
endevent (This is the end of the event)

Thanks again.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1357

onevent <event>
endevent

This is used to call an event, which allows you to use some code at a specific occasion. For example, the EVENT_GETLOADTILE occur during the loading screen.

totalclock

It is a variable which value is constantly increased. It serves for the purpose of providing a timing for the animations.

andvar 3

Cycles the current value (totalclock divided by speed) through 0-3 (four frames).

LOADSCREEN

Same as 3281, as defined in DEFS.CON.

This post has been edited by Fox: 07 July 2013 - 02:18 PM

0

User is offline   darkcaleb 

#1358

Thanks Fox! At least now i understand the coding a little bit. :)
0

User is offline   m210® 

#1359

Quote

I need help with own rotate sectors.
I can't make move of player in such sectors

Well, I did it
        getplayer[THISACTOR].i PLAYERID
	setvarvar spriteid PLAYERID
	getactor[THISACTOR].sectnum rot_sect
	getactor[spriteid].sectnum se_sector
	ifvarvare rot_sect se_sector
	{
		getactor[THISACTOR].x x
		getactor[THISACTOR].y y
		getactor[spriteid].x x2
		getactor[spriteid].y y2
		subvarvar x2 x
		setvarvar dx x2
		setvarvar rot_actspeed rot_angspeed
		ifvare rot_turnway 1 mulvarvar rot_actspeed -1
		cos mycos rot_actspeed
		mulvarvar dx mycos
		divvarvar dx TRIG_MAX
		subvarvar y2 y
		setvarvar dy y2
		sin mysin rot_actspeed
		mulvarvar dy mysin
		divvarvar dy TRIG_MAX
		addvarvar x dx
		subvarvar x dy
		//setactor[spriteid].x x
		setplayer[THISACTOR].posx x
		setvarvar dy y2
		mulvarvar dy mycos
		divvarvar dy TRIG_MAX
		setvarvar dx x2
		mulvarvar dx mysin
		divvarvar dx TRIG_MAX
		addvarvar y dy
		addvarvar y dx
		//setactor[spriteid].y y
		setplayer[THISACTOR].posy y
		
		//getactor[spriteid].ang se_ang
		getplayer[THISACTOR].ang se_ang
		addvarvar se_ang rot_actspeed
		setplayer[THISACTOR].ang se_ang
		//setactor[spriteid].ang se_ang
	}

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1360

Could someone explain to me how exactly guniqhudid works? I tought it was to store the model animation, but the weapons.con values seems to confuse me:

chaingun: none
rpg: none
mighty boot: 0
freezer firing top half: 0
pistol: 1
shotgun: 2
shotgun firing: 4
pipebomb: 5
shrinker: 6
right devastator: 7
left tripbomb hand: 8
freezer: 9
pipebomb detonator: 10
expander: 11
shrinker crystal: 12
left devastator: 14
right tripbomb hand: 16
expander crystal: 22
tripbomb: 32
quick kick: 100
right shrunk fist: 101
left shrunk fist: 102
0

User is offline   Mblackwell 

  • Evil Overlord

#1361

http://wiki.eduke32....wiki/Guniqhudid

Quote

The purpose of the guniqhudid command is that models drawn to the screen via rotatesprite do not have a sprite id like all other sprites in the game world. The engine needs some sort of ID so that it knows where and what to draw.

This command will allow you to select a different slot so that any HUD models you are drawing can store their animation state independently, without conflict. By default it uses the first slot, 0. If you need several animating HUD models, you should switch to another slot, draw the model with rotatesprite, then switch back using guniqhudid 0.

guniqhudid is short for "g (game? gun?) unique HUD ID".


In weapons.con (written by Hendricks) it just looks like he assigned all of the hud models a unique id (which is not necessarily necessary unless the models are going to display simultaneously or you need the animation state preserved but it's fine). No big deal.
0

User is offline   Hendricks266 

  • Weaponized Autism

  #1362

I think the wiki page sums it up: for the renderers to draw a model on the screen, internally they get assigned a unique sprite ID in some extra space allocated after the array of sprites.

I copied the guniqhudid values in weapons.con.sample verbatim from what is used in player.c.
0

User is offline   Mblackwell 

  • Evil Overlord

#1363

From the horse's mouth.
0

User is offline   Mark 

#1364

While testing some replacements for original enemies I noticed that when they drop into a non submersible water sector they pop back up to the surface height for their shooting animation and at other times randomly. I fired up a non modified version of the game and verified the original enemies acted the same way. I'm sure something this obvious has been mentioned before. Is it possible to fix this in cons? If you have an answer or a link to previous discussions on the topic let me know.Thanks.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1365

No. It is a glitch that has something to do with Eduke32 submerging code.

View PostHendricks266, on 10 July 2013 - 06:49 PM, said:

I think the wiki page sums it up: for the renderers to draw a model on the screen, internally they get assigned a unique sprite ID in some extra space allocated after the array of sprites.

I copied the guniqhudid values in weapons.con.sample verbatim from what is used in player.c.

The values appear to be almost random. Every piece should be separated in a different layer defined by MAXWEAPONS times the layer.
0

User is offline   Mark 

#1366

Spoiler
Its taken me pretty much the whole day, on and off, but I've got a basic enemy coded from scratch. I'm waiting for this day to be declared a national holiday. :)

Its real basic stuff right now and will be expanded upon as I learn more coding. But I need help with a problem that I've spent the last 2 hours on and can't figure out the fix. When the dog charges the player and gets within a certain distance it goes into the DOGBITE mode. The problem is that it only performs the actions ( action, sound, player health) once instead of multiple times. When the player backs away and the dog approaches again its the same thing. Just one bite and then nothing. I'm guessing I need to nest some lines in a better place but I tried and tried and couldn't figure it out.

This post has been edited by Mblackwell: 13 July 2013 - 07:57 PM
Reason for edit: Added code tags to preserve formatting.

0

User is offline   Mblackwell 

  • Evil Overlord

#1367

You might want to change the last digit in your actions to 1. I seem to recall having odd errors if I didn't but that was back in ye olde 1.3d days so what the hell, things just become habits. Also IIRC if you're using ai commands you need to make sure that ifai AIDOGBITE is not true before you run it or it will cancel itself.

Generally I recommend avoiding AI commands and just using simple actions/actioncount/move commands. Then again I also tend to define everything as notenemy and then manually adding in spriteshadow and kill counts but I'm an oddball I guess.
0

User is offline   Mark 

#1368

That is the double edged sword of con coding. It has the flexability of coding the same thing different ways. But that makes it more difficult to learn when I can't find a consistant way to code something after looking at other people's projects for help.

BTW, I still have had zero success in coding any climbing abilities for new enemies. :)

This post has been edited by Mark.: 14 July 2013 - 04:44 AM

0

Share this topic:


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