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

Jump to content

  • 124 Pages +
  • « First
  • 2
  • 3
  • 4
  • 5
  • 6
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   XThX2 

#82

AFAIK, the reload time is the maximum time that the weapon has including the reloading frames. It excludes the totaltime of the weapon, and directly jumps to the frame right after it. Example;

WEAPON2_TOTALTIME 24
WEAPON2_FIREDELAY 18
WEAPON2_RELOADTIME 48
WEAPON2_CLIPS 8

When you exceed the clip amount, it will go for the 25th frame of weapon and go on until it reaches to 48th frame.
0

User is offline   Spiker 

#83

Wow thanks! I will try this out. Hmmm I'm just wondering if this works the same for models and sprites? At the moment I'm for using models but they may be situations later when I resolve to using sprites (hope not).

This post has been edited by Spiker: 07 July 2009 - 08:29 AM

0

User is offline   XThX2 

#84

Why won't,

ifvare playervar[THISACTOR].a 1


work but,

ifvare actorvar[THISACTOR].a 1


works? I get that this is not an array in the log file but not when I try with actorvar.

Oh and, mind if I repeat this ?

Quote

How can I identify if an actor hit the wall or a sprite by htmovflag? I realized the bug errors given to me by the invalid sprite number is definitely because of hitting walls, and I need the code to not execute when that happens. To explain what I'm doing with htmovflag, I'm using it to deal damage to what it hit and spawn it's explosion frame. (The actor in question is a projectile with no defineprojectile)


This one is solved.

Quote

valid sprite IDs are between 0 and 16383.


This post has been edited by XThX2: 07 July 2009 - 12:17 PM

0

User is offline   Chip 

#85

Quote

Is it possible to make a projectile go through actors ? (One way I thought would be to make it a normal actor and have this in it's code, but I want to keep it as a projectile on it's own)


You could always have the projectile spawn a hidden actor which is synced to the projectiles possition but with some distance infront of it.
Have this hidden actor constantly search for actors within a very small distance (400) and when it finds one, wait a tic or 2 (ifcount 1) and then have the projectile move to the hidden actor's possition (or a little furthre). You'll have to work out some timing to stop the projectile moving too early and end up still on path towards the actor. If you leave it too late then the actor gets hit.

That's what I would have done (but haven't tried it yet)

This post has been edited by Chip: 07 July 2009 - 12:06 PM

0

User is offline   XThX2 

#86

That's what I would've done months ago but I've learned a better method to do what I asked for, and it was what I suggested. It's painful, but works just as flawlessly. Thanks for the comment eitherway ;)
0

User is offline   XThX2 

#87

How can I make an object move along with the actor that spawned it? Just like the weapon icons above your head in multiplayer. (Except that the actors in question are moving) My best bet was to use this code below,

	getactor[THISACTOR].owner owner
	getactor[owner].xvel xvel
	getactor[owner].yvel yvel
	getactor[owner].zvel zvel
		 movesprite THISACTOR xvel yvel zvel CLIPMASK0 RETURNVAR


I've been messing with it a lot, multiplied/divided/added/substracted but nothing worked. It all just changed the speed of it. (Multiplying with -1 made the direction change) I also thought about setting up x/y/z values for the actors but then it would case them to disappear in walls/floors/ceilings also this actor needs to move around the main actor and it looks bad when you do it (I got the move thing done by adding up to it's angle per count). A suggestion about this would be nice.

This post has been edited by XThX2: 11 July 2009 - 07:20 AM

0

User is offline   Chip 

#88

I would not use the movesprite command and instead just get the spawner's X,Y,Z possitions and set that to the spawned actors possition (with some subtraction used on the Z possition so its higher then the spawner's)

Example:
	getactor[THISACTOR].owner owner
	getactor[owner].x xvar
	getactor[owner].y yvar
	getactor[owner].z zvar
	subvar zvar 6000
	setactor[THISACTOR].x xvar
	setactor[THISACTOR].y yvar
	setactor[THISACTOR].z zvar




Question: I once read somewhere that Edue32 only does whole numbers for multiplication and division so you cannot do sometihng like "mulvar TEMP 0.02" Is that true?

This post has been edited by Chip: 11 July 2009 - 09:43 AM

0

User is offline   Jimmy 

  • Let's go Brandon!

#89

Yeah, the game can't use decimals/fractions. However you can do things like dividing a var of 3 by 2, which creates a var of 1.5, or at least I think it works in theory. I haven't really had a use for specific decimals/fractions yet.
0

User is offline   XThX2 

#90

I put an edit at the end of my post. To elaborate more,

state rollaround
getactor[THISACTOR].ang angle
ifcount 2
{
	spawn FRAMEEFFECT1
	addvar angle 64
	setactor[THISACTOR].ang angle
	resetcount
}

ends


This state is in my owner actor's code, and if you set x/y/z and such of it, it get's stupid. I want this to move in circles around the actor that spawns it. The code above does the circle part, it just needs to move along with the owner actor.

This post has been edited by XThX2: 11 July 2009 - 10:19 AM

0

User is offline   XThX2 

#91

What are the uses of WEAPONX_WORKSLIKE ? I've changed tipbomb's to other weapons' workslikes but the weapon itself acts the same. Could someone add a text about it to the wiki?
0

User is offline   Spiker 

#92

If I remember corectly you gave some code like this! I also was confused that it didn't work but later I discovered that weapon 2 is in fact weapon three so it changed yhe shotgun! It goes from 0 to 9 and and in traditional "keyboard way" ;P
0

User is offline   Danukem 

  • Duke Plus Developer

#93

I just added this to the wiki for WEAPONX_WORKSLIKE. It is from memory so I hope it is accurate:


This determines which tiles are displayed in the HUD when the weapon is used. It would be more aptly named "LOOKSLIKE" than "WORKSLIKE". Set this to 1 and the weapon will display the pistol art, 2 for shotgun, etc. It is completely useless if you are using your own HUD code.
0

User is offline   Spiker 

#94

In the code Xthx2 gave me shotgun not only looks like kick but also "shoots kick"
0

User is offline   Danukem 

  • Duke Plus Developer

#95

View PostSpiker, on Jul 14 2009, 09:12 AM, said:

In the code Xthx2 gave me shotgun not only looks like kick but also "shoots kick"



Maybe he also set WEAPON2_SHOOTS KNEE? Anyway, if the information is wrong someone can fix or delete it.
0

User is offline   Spiker 

#96

If I may comment on con tutorials. Probaly the con code is not that difficult to learn (quite simmilar to pascal in some aspects) but the way in which it is presented in the wiki is not very convinient for someone who just starts to learn it. I would even say it's a reference for experienced coders and there are few tutorials that really address some problems.

When you begin coding you don't really care what this or other command do or mean in fact you shouldn't even know it. Most tutorials for other programs are constructed in the way that you are introduced to every issue by a series of exercises. For example there could be a tutorial "How to code a custom weapon" and it would contain step by step instructions and explanations what to do as it is in other tutorials like layers in Gimp or rigging and animation in Blender:P.

Of course you won't know everything after completing that tutorial but it would give you more understanding of the code and after some more exercises you will be able to "mix" the code from various exercises and to modify it. There is a perfect tutorial for mapping in build and it's very easy to understand but after reading examples of con coding like making duke eat something, which is also quite easy I still have no idea how to code something more serious and I'm just left with a bunch of commands I don't understand and don't know how to use:P

Sorry if you think I'm pathetic but somehow I can learn from other tutorials with success while here there are just few very simple examples which aren't followed by anything more serious so I'm still stuck in the black hole. ;)
0

User is offline   Danukem 

  • Duke Plus Developer

#97

View PostSpiker, on Jul 14 2009, 09:42 AM, said:

If I may comment on con tutorials. Probaly the con code is not that difficult to learn (quite simmilar to pascal in some aspects) but the way in which it is presented in the wiki is not very convinient for someone who just starts to learn it. I would even say it's a reference for experienced coders and there are few tutorials that really address some problems.

When you begin coding you don't really care what this or other command do or mean in fact you shouldn't even know it. Most tutorials for other programs are constructed in the way that you are introduced to every issue by a series of exercises. For example there could be a tutorial "How to code a custom weapon" and it would contain step by step instructions and explanations what to do as it is in other tutorials like layers in Gimp or rigging and animation in Blender:P.

Of course you won't know everything after completing that tutorial but it would give you more understanding of the code and after some more exercises you will be able to "mix" the code from various exercises and to modify it. There is a perfect tutorial for mapping in build and it's very easy to understand but after reading examples of con coding like making duke eat something, which is also quite easy I still have no idea how to code something more serious and I'm just left with a bunch of commands I don't understand and don't know how to use:P

Sorry if you think I'm pathetic but somehow I can learn from other tutorials with success while here there are just few very simple examples which aren't followed by anything more serious so I'm still stuck in the black hole. ;)


There were tutorials written a long time ago. For example, Reaper_Man has some here:

http://concode.planetduke.gamespy.com/

Look at "Actions Explained", "Writing a Basic Actor", etc There's also an old tut that covers a lot of stuff on the wiki.

But if you want tutorials that cover the newer EDuke commands, then you're out of luck. There is some stuff on the wiki, but you aren't going to find EDuke CON coding For Dummies.
0

User is offline   Jimmy 

  • Let's go Brandon!

#98

Reaper_Man's tutorial is awesome. I used it for years. However, be forewarned that his tutorials have no mention of Eduke32 commands and effects. I would however really like to see a "Coding your own Weapon" tutorial, as I've been trying to come up with a way to do it without just doing a copy and paste job.

This post has been edited by Captain Awesome: 14 July 2009 - 10:40 AM

0

User is offline   Spiker 

#99

Thanks! Something new to study finally. I guess that without new commands I lose much! ;) Also there is problem with time. I find it hard to learn blender, gimp and coding at the same time and trying to make something out of it ;)
0

User is offline   XThX2 

#100

What I gave you was a code that set the pre-defined gamevars of weapon2 (I think I mixed it up as you said there ;), It had to work though) to make it act like KNEE weapon. If you call that complicated... :/
0

User is offline   Spiker 

#101

Codito ergo sum. I haven't studied any examples in Reaper's tutorial yet but after seeing this phrase I'm sure this is one of the most awesome tutorials here ;)

This post has been edited by Spiker: 14 July 2009 - 11:15 AM

0

User is offline   Mblackwell 

  • Evil Overlord

#102

View PostSpiker, on Jul 14 2009, 11:42 AM, said:

If I may comment on con tutorials. Probaly the con code is not that difficult to learn (quite simmilar to pascal in some aspects) but the way in which it is presented in the wiki is not very convinient for someone who just starts to learn it. I would even say it's a reference for experienced coders and there are few tutorials that really address some problems.

When you begin coding you don't really care what this or other command do or mean in fact you shouldn't even know it. Most tutorials for other programs are constructed in the way that you are introduced to every issue by a series of exercises. For example there could be a tutorial "How to code a custom weapon" and it would contain step by step instructions and explanations what to do as it is in other tutorials like layers in Gimp or rigging and animation in Blender:P.

Of course you won't know everything after completing that tutorial but it would give you more understanding of the code and after some more exercises you will be able to "mix" the code from various exercises and to modify it. There is a perfect tutorial for mapping in build and it's very easy to understand but after reading examples of con coding like making duke eat something, which is also quite easy I still have no idea how to code something more serious and I'm just left with a bunch of commands I don't understand and don't know how to use:P

Sorry if you think I'm pathetic but somehow I can learn from other tutorials with success while here there are just few very simple examples which aren't followed by anything more serious so I'm still stuck in the black hole. ;)



http://wiki.eduke32.com/wiki/Confaq42

I also have an old Eduke 2.0 con FAQ somewhere. Perhaps I should add it to the Wiki?

This post has been edited by Mblackwell: 14 July 2009 - 01:44 PM

0

User is offline   Usurper 

  • Hates Twitter

#103

I'd rather see additions to http://wiki.eduke32.com/wiki/Scripting

or have the old confaq updated to include EDuke32 concepts.
0

User is offline   XThX2 

#104

ifvarand WEAPON8_FLAGS 3328
{
	subvar WEAPON8_FLAGS 3328
	setvar WEAPON8_FLAGS 4
}


I don't know why, but this little change refuses to work. This code is in the EVENT_FIREWEAPON event, under a switch which checks the current weapon of the player. I used a simple setvar command at first, but addlogvar command showed that the flags are still set to 3328 ( 2048, 1024 and 256; STAND_STILL (this must go away), CHECKATRELOAD (some specific tripbomb control) and NOVISIBLE). Is this hardcoded?
0

User is offline   Danukem 

  • Duke Plus Developer

#105

If you suspect that the flag cannot be set, then why don't you just put the setvar in the player code, like with ifhitspace { setvar WEAPON8_FLAGS 4 addlogvar WEAPON8_FLAGS } ?
0

User is offline   XThX2 

#106

I tried that too, except that when I tried it, I forgot to add the addlogvar to see it... (I must've been really blind to see no difference) But strangely enough, it seems that the control thing doesn't lie in the flag, the thing that makes you stop for a second, then let's you go. I have no idea how to fix it at all. (What I'm talking about is, the thing that makes you halt when you use tripbombs on a wall; except that in my mod, you can freely fire by the small fire code I added) And all this leads to one point. Htg_t 's tripbomb control's usage :/

This post has been edited by XThX2: 15 July 2009 - 08:19 AM

0

User is offline   Hendricks266 

  • Weaponized Autism

  #107

How would I code the keycard slot so that there are three states, as shown below? These examples are from SW.

Locked
Posted Image

Unlocked, with Key
Posted Image

Unlocked, without Key
Posted Image
0

User is offline   XThX2 

#108

I would rather code my own, just like a switch except with a bitvar to check the keys of your own. GotNoKey? 0; GotKey? 1; GotKeyButActive? 2. You can keep the bits with the colors too.

This post has been edited by XThX2: 15 July 2009 - 03:43 PM

0

User is offline   XThX2 

#109

	{
		eshoot GRAYROCKET
		getactor[THISACTOR].x x
		getactor[THISACTOR].y y
		getplayer[THISACTOR].ang TEMP
		setvarvar x2 x
		addvar x2 384
		setvarvar y2 y
		subvar y2 128
		rotatepoint x y x2 y2 TEMP x3 y3
		setactor[RETURN].x x3
		setactor[RETURN].y y3
		eshoot GRAYROCKET
		addvar y2 256
		rotatepoint x y x2 y2 TEMP x3 y3
		setactor[RETURN].x x3
		setactor[RETURN].y y3		
	}


I don't know why, but this projectile goes through walls if you fire really close to the wall. (I think it is because of the rotatesprite) How can I prevent it ? Here's the code of the projectile itself in any case.

defineprojectile GRAYROCKET PROJ_WORKSLIKE 65538
defineprojectile GRAYROCKET PROJ_SPAWNS EXPLOSION2
defineprojectile GRAYROCKET PROJ_VEL 814
defineprojectile GRAYROCKET PROJ_EXTRA 300
defineprojectile GRAYROCKET PROJ_ISOUND GRAY_BOOM
defineprojectile GRAYROCKET PROJ_XREPEAT 48
defineprojectile GRAYROCKET PROJ_YREPEAT 48
defineprojectile GRAYROCKET PROJ_HITRADIUS 2600
defineprojectile GRAYROCKET PROJ_OFFSET 128
defineprojectile GRAYROCKET PROJ_CLIPDIST 48


And a different question, what does ifvaror do? Is it like "if variable Y is added X, then do" ?

This post has been edited by XThX2: 17 July 2009 - 06:31 AM

0

#110

View PostXThX2, on Jul 17 2009, 09:44 AM, said:

And a different question, what does ifvaror do? Is it like "if variable Y is added X, then do" ?

I assume it does a bitwise OR and executes the code block if the result is not zero.

This post has been edited by Dr. Kylstein: 17 July 2009 - 08:19 AM

0

User is offline   XThX2 

#111

Is there any chance for someone to take a "backup" of the scripting thread at 3D Realms forums or move the posts to here? (May sound ridiculous, just noticed when I read again...) I was going through the oldest one and there are a lot of valuable information that should not be lost in case the forums go down.

This post has been edited by XThX2: 18 July 2009 - 03:24 PM

0

Share this topic:


  • 124 Pages +
  • « First
  • 2
  • 3
  • 4
  • 5
  • 6
  • 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