View Full Version : Help w/ Con Editing.
Boinky
05-18-2004, 01:05 PM
ifrnd 1 ifphealthl =>30
1) Wouldnt I need a && statement here?
ex ifrand 256 (100%) && ifphealthl =<30 less than 30%
do this statement:
{
ifdead
{
}
else
{
spawn BLOODPOOL
spawn BLOOD
soundonce DUKE_GASP
}
}
I was wondering if this would be considered a legit call for in the con.. Although it pulls up no action when it is called it also brings up no errors when I go to launch duke. Trying to make duke bleed whenever he gets hit below 30% health
MarkJ
05-18-2004, 05:20 PM
You already have a '&&' of sorts (The second if statement (and hence all the code under it) is only considered if the first one is true).
Possible problems that I can see:
* Did you put the '=>' in the CON code? If so, you can't do that (yet...).
* The ifrnd statement may need to be 255. I can't remember whether it returns true if the number generated (which is between 0 and 255) is less, or greater.
Other than that, it looks fine. But just because it doesn't generate errors, doesn't mean it's correct (CON is know to miss a few).
Hope that helps.
cyborg
05-18-2004, 05:31 PM
Sure as hell that code is not valid for any version of Duke.
Boinky
05-18-2004, 07:48 PM
Always a sweet reply from cyborg http://forums.3drealms.com/ubbthreads/images/graemlins/wink.gif.. Anywho thanks.. well I can only be lead to assume then that ifphealth 30 would mean less than 30?? I was looking at a con faq and it said that 256 was 100% etc etc etc.. I figured that just meant that it would grab a random # and if it was less than the # specified then it would run the script.. Anywho I'll keep looking at it thx..
Something like this I suspose:
ifrnd 255 ifphealthl 30
{
ifdead
{
}
else
{
spawn BLOODPOOL
spawn BLOOD
soundonce DUKE_GRUNT
}
}
cyborg
05-18-2004, 08:03 PM
well I can only be lead to assume then that ifphealth 30 would mean less than 30??
Well it's ifphealthl and yes that's exactly what the code does - it's true iff the player has health less that 30.
I was looking at a con faq and it said that 256 was 100% etc etc etc.. I figured that just meant that it would grab a random # and if it was less than the # specified then it would run the script.. Anywho I'll keep looking at it thx..
Basically there is a TRAND variable and if TRAND/256 >= 255-X then ifrnd is true, otherwise it is false.
It doesn't take much to see that the higher the value of X the more likely it is that TRAND/256 will be greater than or equal to it.
Boinky
05-18-2004, 10:51 PM
Ok this thing still isnt giving me the right effect the only thing I can possibly think of is Im defining it in the wrong spot 0.o this is where it is posted.. Around line 1100 or so..
*Note the first part all the way up to the end state is another code.
state headhitstate
// Unrem the following line to invoke screen tilting during
// low player hitpoint damage.
// wackplayer
ends
ifrnd 255 ifphealthl 30
{
ifdead
{
}
else
{
spawn BLOODPOOL
spawn BLOOD
soundonce DUKE_GRUNT
}
}
MarkJ
05-18-2004, 11:43 PM
Your code has to be inside an actor, useractor or state. From your sample, it doesn't look like the code is in anything.
Boinky
05-19-2004, 12:11 AM
Thx will look a lil harder.. http://forums.3drealms.com/ubbthreads/images/graemlins/smile.gif
Roger
05-19-2004, 12:18 PM
In the "actor APLAYER" code on the second line- the one after that one- put in, say... state playerbleed. Somewhere else in the CON file that is not within another actor's code, another action's code, or in another state's code, put in this:
state playerbleed
ifphealthl 30
{
ifcount 90
{
spawn BLOODPOOL
}
resetcount
}
ends
Should be something like that. I'm probably a little off. Note that the boundaries of actor code are lines reading "actor X" and "enda", the boundaries of action code are lines reading "action" and "enda", and the boundaries of state code are lines reading "state x" and "ends."
Boinky
05-19-2004, 12:33 PM
success! Thx a lot for the help guys. For some odd reason adding the state inside of the APLAYER it would not allow the ends. The warning no statement for ends in L3222 kept popping up 0.o *Which is where the bleed section is at 0.o
EDIT is there anyway to add in a pause, lets say I take out the only doing it once and I want duke to bleed lets say every 4 or 5 seconds depending on how bad hes hurt 0.o how would I do the pause? Would I have to add a new handler into the source itself?? or is one already defined??
Roger
05-19-2004, 02:29 PM
The stuff in the code box is separate from the APLAYER code. Just put 'state playerbleed' in the APLAYER code- that's it. Stick the boxed stuff elsewhere.
Boinky
05-19-2004, 02:37 PM
ah http://forums.3drealms.com/ubbthreads/images/graemlins/smile.gif http://forums.3drealms.com/ubbthreads/images/graemlins/tinyted.gif
MarkJ
05-19-2004, 05:14 PM
It depends what you mean by pause. If you mean halt the entire game, then you can't yet do that through CON. If you want the player to stand still, then you may be able to set there movement properties to 0 (There is probably one already defined for you in the APLAYER declarations). You may be able to do a 'move 0', although in my humble opinion, that shouldn't even be valid code.
So just to summarize, look for all the APLAYER declarations (there is a whole heap of them just above the APLAYER actor code), and if there is no appropriate move defined, do something like.
move APLAYERBLEEDING 0
And then when you want him to stop moving (so say in your bleed code), you just do.
move APLAYERBLEEDING
If you want it to stop him for a specific period of time, you will have to start messing with counts (and you may want to declare an action too). Yes, it get's pretty dense, but no pain, no really cool effects.
Boinky
05-19-2004, 09:42 PM
What I meant by pause, is put a wait in b4 the blood effect happens again not a system pause http://forums.3drealms.com/ubbthreads/images/graemlins/smile.gif.. B/c as it stands right now, its once or an infinite amout lasts forever and ever and ever and its really stupid looking tbh http://forums.3drealms.com/ubbthreads/images/graemlins/smile.gif.. I wanna make it to where he continues to bleed until he gets back above 45 health or so :\.. or in the extreme cases where he continues to lose life for a couple of ticks.. *ticks being: bleed loose 1 health, 5 second no blood, bleed loose 1 health, etc etc for a couple of rounds. http://forums.3drealms.com/ubbthreads/images/graemlins/smile.gif
MarkJ
05-19-2004, 10:01 PM
In that case, you will certainly need to use a counter of some sort. Actioncount is out of the question since you want him to bleed regardless of what action he is doing, and the count I would suspect is already in use. Unless you find some other creative way of making the delay, you will either have to use EDuke, or wait for an alternative to become available.
The other possible way (And probably more realistic) is simply to have the code in an ifrnd loop. Just have some value that on average generates the delay between drips that you want. You will probably want a low value, but you will probably have to use trial-and-error to get the right one. This way, you don't need to screw around with counters or anything at all.
I think you already have it in a ifrnd though?
Boinky
05-20-2004, 03:06 AM
Actually for the time being, until I get Duke3d src to compile, I am using just a constant bleed. I will figure out eventually how to do a pause. After that I will be ok. Was hoping there was some function already in the source that had a timer.. http://forums.3drealms.com/ubbthreads/images/graemlins/brickwall.gif
Roger
05-20-2004, 06:09 AM
There should be a count to it. Note the presence of "ifcount." Duke should bleed every three seconds.
Devastator
05-20-2004, 12:09 PM
Add this to actor APLAYER in the very beginning of an actor:
ifphealthl 30
ifp palive
{
ifrnd 15
{ spawn BLOOD
spawn BLOOD
spawn BLOOD
guts JIBS6 4
ifphealthl 15 { guts JIBS6 8 spawn BLOOD
spawn BLOOD }
ifrnd 64 spawn BLOODPOOL
state random_wall_jibs state random_wall_jibs state random_wall_jibs
}
}
Boinky
05-20-2004, 10:32 PM
I've noticed in some of the con codes ive been looking for where they have for example the ladder script, it for it to work you have to go up to the ladder and hit the use key.. *space* and in the code it says, ifhitspace.. is there anyway you can change to lets say, ifmoveforward or somethin I tried but it keeps pulling up error seeing as how its not defined 0.o... or as another example looking at the zoom script... it also uses the ifhitspace.. Now imagine how annoying it is to zoom up and climb a ladder at the same time :-\... Really messes yah up! Anyways I was trying to use quickkick in the place of that until I could figure out the source and add a secondary weapon function http://forums.3drealms.com/ubbthreads/images/graemlins/smile.gif.. Anyways I'll continue to play around w/ it. If you guys can help at all, It would be much appreciated. http://forums.3drealms.com/ubbthreads/images/graemlins/smile.gif
MarkJ
05-20-2004, 11:34 PM
Space is the only key you can test for in CON (Using the 'ifhitspace' keyword). EDuke may be able to handle others, but I don't think it can.
This is the reason why lots of code uses the space, because it is the only reliable way to get input from the user through scripts.
cyborg
05-21-2004, 05:46 AM
Boinky - what not trying reading a FAQ rather than just guessing what the language structure is?
Boinky
05-21-2004, 05:56 AM
I have several FAQs, not much to explain there, they do show actors and what not.. But *shrug alright cyborg
Besides isnt CON just its own lil kinkee language. Its like C, but then its not
cyborg
05-21-2004, 06:04 AM
I have several FAQs, not much to explain there, they do show actors and what not.. But *shrug alright cyborg
Well you do continue to insist to make up primitives so you really should pay attention.
Besides isnt CON just its own lil kinkee language. Its like C, but then its not
The only thing C like is the { } - nothing else about it makes it remotely like C.
Boinky
05-21-2004, 06:43 AM
well ok then, how would I go about defining it myself lets say I do
define ifplayermoveforward gamefunc_Move_Forward
That unfortunately doesnt work like I wish it would, but is there anyway I can get it to be defined, like an alias?
cyborg
05-21-2004, 06:56 AM
well ok then, how would I go about defining it myself lets say I do
define ifplayermoveforward gamefunc_Move_Forward
That unfortunately doesnt work like I wish it would, but is there anyway I can get it to be defined, like an alias?
Boinky - you seem to show a lack of understanding over what the CON language is and can do and also a basic lack of understanding over how the CON language is actually used by the game.
Why do you think coming up with a random label like gamefunc_Move_Forward would achieve what you want? Unless the interpreter already knows what that's supposed to mean it can't read the english, guess what you mean and then write the code for you.
And also when define essentially creates aliases for numbers (ie constant values) what makes you think you can just come up with your own primitive?
Put simply the function is NOT in the interpreter so you can make up as much syntax as you want and try to express it with as many synonyms as you want - that doesn't change the fact there IS NO CODE IN THE GAME to do that.
Hence you'd have to write the code in the source to support the new primitive - and as trivial a matter as that is to add a new primitive I suspect it is beyond your abiliity.
Boinky
05-21-2004, 07:47 AM
That isnt random, thats how its defined in player.c .....
Cyborg you really must be a bastard in real life.. Cause your a real prick here.. I wouldnt have made up some random call function, as it is speficied in player.c to move the player forward... HENCE WHY I PUT IT...
cyborg
05-21-2004, 09:05 AM
That isnt random, thats how its defined in player.c .....
So? Player.c has nothing to do with gamedef.c which actually defines the CON language. The CON language knows nothing whatsoever about the C source. It's just a random label.
Cyborg you really must be a bastard in real life.. Cause your a real prick here..
Sorry - but I make no apologies for your own lack of understanding.
I wouldnt have made up some random call function, as it is speficied in player.c to move the player forward... HENCE WHY I PUT IT...
You don't understand the CONs nor C - this is why you can't get anything to work.
So again: when you write CON code it does not gain magical insight into the source used to interpret it. If you actually understood player.c et al rather than just looked through it for mnemonics that look good to you you'd know why.
Boinky
05-21-2004, 03:40 PM
*shrug. You are right.. I know nothing of con code. Hence why im trying to learn.. I figured Con read from the compiled duke3d.. I figured wrong... I knew it had its own defs somewhere.. Was hoping for more than what I got.. Its no big deal really so *shrug at least I learned something new http://forums.3drealms.com/ubbthreads/images/graemlins/smile.gif
cyborg
05-23-2004, 01:42 PM
*shrug. You are right.. I know nothing of con code. Hence why im trying to learn.. I figured Con read from the compiled duke3d.. I figured wrong... I knew it had its own defs somewhere.. Was hoping for more than what I got.. Its no big deal really so *shrug at least I learned something new http://forums.3drealms.com/ubbthreads/images/graemlins/smile.gif
I think this is a good example of a little knowledge being a dangerous thing.
If you make assumptions about the way things work without really knowing how they work do not expect anything based on these assumptions to be true.
Viciarg
05-23-2004, 04:41 PM
I've made the experience that correcting somebody, showing him what error he made in detail and telling him the right way to do what he wanted, is far more educational than just to reproach him with his lack of knowledge. http://forums.3drealms.com/ubbthreads/images/graemlins/cool.gif
cyborg
05-23-2004, 04:48 PM
I've made the experience that correcting somebody, showing him what error he made in detail and telling him the right way to do what he wanted, is far more educational than just to reproach him with his lack of knowledge. http://forums.3drealms.com/ubbthreads/images/graemlins/cool.gif
And in my experience people who ask questions in forums seldom seek to find knowledge for themselves.
Eclipse
05-23-2004, 05:25 PM
People have to help themselves too though. Give a man a fish and all that...
Viciarg
05-23-2004, 06:37 PM
People seldom seek knowledge for themselves regardless whether in fora or not http://forums.3drealms.com/ubbthreads/images/graemlins/wink.gif.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.