XThX2, on Aug 8 2009, 05:17 PM, said:
EDuke32 Scripting "CON coding help"
#181 Posted 08 August 2009 - 02:13 PM
#182 Posted 08 August 2009 - 02:39 PM
#184 Posted 08 August 2009 - 06:11 PM
#185 Posted 09 August 2009 - 03:37 AM
I wont be starting the targeting stuff till the basic paving is done but here's an advance of one of my problems I'll be running into, take a look at the picture below:
My bot will be looking for actors using the findnearactor command and then seeing if he can see them using the canseesprite commands and stuff. The problem in the picture is that my Bot will find enemy number 2 each time findnearactor is used since enemy 2 is the closest target. The Bot cannot see the enemy so I need it to search for the next closest enemy........but how?
Findnearactor will always bring me the ID of the closest target so I can't use that. Each of the 3 enemies are in their own sectors so I can't have my actor quickly check his current sector for enemies, I can't have the enemies tell the Bot their locations if they can see him because enemy 3 in the picture could very well be a sniper and telling the Bot his location would allow the bot to aim his weapons accurately at a target you shouldn't even be able to see till you're much closer so I don't want it to be able to shoot accross the map all because someone hiding can see him and I can't have it check what's in front of it using hitscan because the closest enemy (enemy 1) is on a moderate sized piller which puts it above the Bot's center possition. (also I've never got hitscan to work since it requires sin cos and tan and I don't know how to get those)
Before I make a suggested to TerminX about having an "optional" addon value to the findnearactor commands that allows you to toggle the number of actors it searches before it records the ID (This value would be a gamevar so actors can adjust it themselves), is there any other way to make my Bot in that picture find Actor enemy 1 and other actors in simular situations which aren't the closest but are shootable?
This post has been edited by Chip: 09 August 2009 - 03:45 AM
#186 Posted 09 August 2009 - 03:56 AM
whilevarn spritenum 16384 { addvar spritenum 1 getactor[spritenum].picnum picnum ifvare picnum <youractor> { execute some commands, possibly some distance checks involved in your case ? } }
I maybe wrong though.
#187 Posted 09 August 2009 - 04:15 AM
As for the code, wont that take a while to cycle through all of them? What if there are only 2 enemies it should be looking for, both having a number higher then 16000? Leaving my actor to wounder aound being shot till it checks through all those numbers (Fair enough, my actors will respond to being shot at but only if they get hit still leaving a possible situation of my bots not shooting nearby enemies for a while.)
This post has been edited by Chip: 09 August 2009 - 04:16 AM
#188 Posted 09 August 2009 - 04:25 AM
#189 Posted 09 August 2009 - 07:51 AM
#190 Posted 09 August 2009 - 01:11 PM
Anyway, something else (and should be simple) how do I get an actor to know the sector number it is in (so it can then be past onto another actor) and if an actor is outside of a sector would it treat the sector number as -1?
Basically I need my actor to know if it is outside of a sector (in the void) and It seems more difficult then I first thought mainly because I can't find a way to make the actor obtain the sector number its in.
*edit*
Nevermind, I found this: "updatesector <x> <y> <gamevar>"
I was originally only looking in the wiki's sector structure pages.
This post has been edited by Chip: 09 August 2009 - 01:18 PM
#192 Posted 10 August 2009 - 02:21 AM
XThX2, on Aug 9 2009, 10:25 PM, said:
Use it to find the sectorID the actor is at. When you have it, you can check for say, a specific lotag on sector to define your "void" and check if the sector has that tag, your actor can do stuff.
Damn it! It was in the sprite structure pages!
Anyway I think the updatesector command will be more useful though.
#193 Posted 10 August 2009 - 02:19 PM
In NR I have it set that when you have the game paused, it shows a customized display which generally includes a quote from the current character in play as a biting quip to the player directly [breaking fourth-wall type of stuff], which changes between five quotes after a set time. However there's a problem with it in incrementing timer variables in EVENT_DISPLAYREST, which the var will increment at a different speed depending on the specs of the system or the CPU power [i.e. mine takes twice the intended time to cycle quotes, while a friends cycles the quotes 3-4 times faster than it should be].
I wanted to put the incrementing var somewhere else where it wouldn't cause the problem, but putting it in the APLAYER actor is useless since actor code won't run when the game is paused. Code under EVENT_GAME also doesn't seem to run at all when the game is paused, so the timer wouldn't increment in that situation either, and I need to know if there's somewhere I can insert my "addvar [timer] 1" code where it'll increment at a proper speed but still run while the game is paused. Anyone know what to do? o.o
#194 Posted 10 August 2009 - 02:45 PM
Lord Misfit, on Aug 10 2009, 03:19 PM, said:
In NR I have it set that when you have the game paused, it shows a customized display which generally includes a quote from the current character in play as a biting quip to the player directly [breaking fourth-wall type of stuff], which changes between five quotes after a set time. However there's a problem with it in incrementing timer variables in EVENT_DISPLAYREST, which the var will increment at a different speed depending on the specs of the system or the CPU power [i.e. mine takes twice the intended time to cycle quotes, while a friends cycles the quotes 3-4 times faster than it should be].
I wanted to put the incrementing var somewhere else where it wouldn't cause the problem, but putting it in the APLAYER actor is useless since actor code won't run when the game is paused. Code under EVENT_GAME also doesn't seem to run at all when the game is paused, so the timer wouldn't increment in that situation either, and I need to know if there's somewhere I can insert my "addvar [timer] 1" code where it'll increment at a proper speed but still run while the game is paused. Anyone know what to do? o.o
I guess you could use this to see how much real time is passing:
http://wiki.eduke32....iki/Gettimedate
#195 Posted 10 August 2009 - 07:07 PM
#196 Posted 11 August 2009 - 04:16 AM
Lord Misfit, on Aug 10 2009, 07:19 PM, said:
In NR I have it set that when you have the game paused, it shows a customized display which generally includes a quote from the current character in play as a biting quip to the player directly [breaking fourth-wall type of stuff], which changes between five quotes after a set time. However there's a problem with it in incrementing timer variables in EVENT_DISPLAYREST, which the var will increment at a different speed depending on the specs of the system or the CPU power [i.e. mine takes twice the intended time to cycle quotes, while a friends cycles the quotes 3-4 times faster than it should be].
I wanted to put the incrementing var somewhere else where it wouldn't cause the problem, but putting it in the APLAYER actor is useless since actor code won't run when the game is paused. Code under EVENT_GAME also doesn't seem to run at all when the game is paused, so the timer wouldn't increment in that situation either, and I need to know if there's somewhere I can insert my "addvar [timer] 1" code where it'll increment at a proper speed but still run while the game is paused. Anyone know what to do? o.o
I think this could be resolved if there was a gamevar that holds how much tics in a screen event passes for every normal tic.
#197 Posted 13 August 2009 - 02:47 AM
#198 Posted 13 August 2009 - 07:28 AM
Ifvare TEMP 0 { sound DUKETALK_BOSSFALL setvar TEMP 1 }
Surely it will only do it for a tic.
#200 Posted 13 August 2009 - 12:06 PM
Hendricks266, on Aug 13 2009, 03:50 PM, said:
#201 Posted 14 August 2009 - 05:32 AM
Make a fake bullet type projectile, have it spawn a trail. The trail goes through actors even if the projectile hit something, which is a good thing. I thought about how to damage the actors and what came to my mind was to make trail actors create hitradiuses with small range at EVENT_EGS. But this has one downside, which is that it damages the player. Well, the thing is, it's htpicnum seems to be 1670 (RADIUSPICNUM) but when I check it with ifvare hitpicnum 1670 setactor[THISACTOR].htextra -1 it still damages the player. I have an invulnerability item which causes the htextra of the player to be -1 when any damage is taken, however it strangely fails against this too. I guess this is a priority issue, but I can't seem to solve this one.
This post has been edited by XThX2: 14 August 2009 - 05:32 AM
#202 Posted 14 August 2009 - 06:47 AM
But more than likely there will be efficent and better ways to do this then what I suggested so you so probably best wait for someone else to reply.
Anyway a question of my own, Its simple really - my "useractor notenemy" does not seem to want to do certain things after death, he wont play sound files and he wont change his cstat to 0 (so it remains cstat 257)
My useractor enemy which I coppied this code from worked fine so is this a limitation to the useractor notenemy sprites?
This post has been edited by Chip: 14 August 2009 - 06:50 AM
#203 Posted 14 August 2009 - 07:32 AM
Chip, on Aug 14 2009, 07:47 AM, said:
My useractor enemy which I coppied this code from worked fine so is this a limitation to the useractor notenemy sprites?
Are you sure it isn't a bug in your code? I've never had a problem like that.
#204 Posted 14 August 2009 - 07:32 AM
XThX2, on Aug 14 2009, 10:32 AM, said:
Make a fake bullet type projectile, have it spawn a trail. The trail goes through actors even if the projectile hit something, which is a good thing. I thought about how to damage the actors and what came to my mind was to make trail actors create hitradiuses with small range at EVENT_EGS. But this has one downside, which is that it damages the player. Well, the thing is, it's htpicnum seems to be 1670 (RADIUSPICNUM) but when I check it with ifvare hitpicnum 1670 setactor[THISACTOR].htextra -1 it still damages the player. I have an invulnerability item which causes the htextra of the player to be -1 when any damage is taken, however it strangely fails against this too. I guess this is a priority issue, but I can't seem to solve this one.
I can came to my mindo how to do the projectile you want. I would use a normal hitscan projectile and use other methods for creating the Railgun...
#205 Posted 14 August 2009 - 08:09 AM
#206 Posted 14 August 2009 - 08:32 AM
#207 Posted 14 August 2009 - 06:59 PM
This post has been edited by Ilovefoxes: 14 August 2009 - 07:00 PM
#208 Posted 14 August 2009 - 09:49 PM
#209 Posted 15 August 2009 - 07:09 AM
DeeperThought, on Aug 14 2009, 04:32 PM, said:
Yeah it was a bug in my code - I solved this around 30 minutes after making that post but by then I had no access to that computer for the rest of the day so I couldn't edit out my post.
The problem was that my actor dying was an action which does not cancel ai strings (ai AIENEMYWALKING etc...) and that ai string gets read before the dying action thus throwing my actor back into its seek state and not its dying one.
The reason I used an action and not ai is because I did plan on having no ai strings at all because I was going to have varying speeds with my actor based on gamevars and as such the ai strings would have been just a duplicate of the actions defined since they're just an action with a movement.
However I have recnetly found out why we have ai strings........because controlling movement is just so damn crappy!
placing a move command within a state instantly stops the actor from counting so all ifcount commands fail to function and replacing the move command to setactor[THISACTOR].xvel 40 has absolutly no effect what so ever so I guess you can't set an actor's speed using that which ruins my whole plan about having gamevar based movements.
Now, I added my move command at the top of my actors state so perhaps I may get away with it by throwing them in at the very bottom of the state after all ifcount commands but I still wont have my gamevar based movment.
So is it at all possible to have movement adjusted by gamevars or am I just going to have to define like a million move commands and then have a million "ifvare SPEED 32 move 32 geth" thrown in as well?
This post has been edited by Chip: 15 August 2009 - 07:19 AM
#210 Posted 15 August 2009 - 08:00 AM
ifmove YOURMOVE nullop else move YOURMOVE <commands>
That will solve your problem about continuous move calls. Try to use addlogvar with some actor structure members that are relevant to what you want and see if they fit the speed of the move.