![]() |
Quote:
EDIT: Violet, I seem to have found a bug. I've currently set: Code:
jjWeapons[WEAPON::BLASTER].infinite = false; |
Quote:
onDrawLayer4 with onDrawLayer3 or onDrawLayer1. :PI'll look into the other thing. What's the context here? onLevelLoad or what? (And note that p is deprecated.) |
Here's the whole thing:
Code:
void onLevelBegin() { |
I don't know about your problem, but you really need to make that into
Code:
jjPlayers[0].ammo[WEAPON::BLASTER] = 99; |
Not if it's a multiplayer level, which hopefully it is or else the
infinite line is the only one that does anything. For multiplayer you'd want jjLocalPlayers[0]. (Alternatively, set maximum in onLevelLoad instead of onLevelBegin, which should take care of setting ammo to 99 all on its own.) |
It's a single player level.
EDIT: Bizarrely enough, when I get rid of p.ammo[WEAPON::BLASTER]=99;, the problem disappears. |
p is only supposed to work for onPlayer, onFunction#, and onPlayerTimerEnd, and even in those cases it's only there for backwards compatibility and you should define a jjPLAYER@ argument instead. Using p in onLevelBegin is undefined behavior. |
EDIT: Ok, no matter where I put jjWeapons[WEAPON::BLASTER].maximum = 35; it never works. How to fix this in singleplayer? Am I missing something?
Also, a question regarding FF. I managed to successfully turn the fastfire pickup into an ammo, but only for pre-places fastfire pickups. When an enemy drops fastfire, it acts as usual (no ammo, decreases bullets frequency). |
Quote:
Code:
void onLevelLoad() {Quote:
scriptedCollisions to false. (Also isTarget and triggersTNT, and deactivates to true.) This is conceivably a bug. You should be able to get around it by doing something like this:Code:
void onLevelLoad() { |
Quote:
However, I've got another problem at hand. I'm trying to tint the ball platform to blue, but when I put jjObectPresets[OBJECT::BOLLPLATFORM].behavior = IceballPlatform; in onLevelLoad, no part of the code loads up. I even tried it with the simple rat example, given in the AngelScript guide (void MyRat(jjOBJ@ rat) {rat.behave(BEHAVIOR::LABRAT);}). It didn't work as well. Here's the relevant part of the code: Code:
onLevelLoad(){ |
jjObjectPresets, with a j.
Blaster: how are you running the level? If you're cycling to it from another level that doesn't have that code, then you're going to start with 99 blaster left over from that previous level, and it won't be until you go below 35 that maximum is going to mean anything. |
Quote:
Also, DID I REALLY fell for a typo mistake. x_ EDIT: And it still doesn't draw the chainlinks of the platform. Only the ball. |
Quote:
Quote:
jjOBJ::behave, when its second argument is set to false, stops all drawing operations from the behavior. You could solve that by drawing the chain manually but in your case a simpler solution may be to just call behave with the second argument set to true. This will have the effect of your tinted sprite being drawn on top of the regular one, which should be visually identical to what you're trying to achieve. |
Quote:
Also, palshifting the bat does this: [IMG]http://i.imgur.com/0yWQlvJ.png[/IMG] I do realise it comes from the direction (capt'n obvious) yet I do not know how to solve it. Code: Code:
void Icebat(jjOBJ@ bat) { |
I refer you to our discussion on the previous page of SPRITE::PALSHIFT not working with leftward facing sprites.
|
Quote:
Damn. What about the chain links? |
Code:
void onLevelLoad(){ |
Quote:
|
Quote:
|
Quote:
|
I want to verify if a player is at x-pos 53 and y-pos 79. I created a code but it doesn't work:
Code:
void onPlayer(jjPLAYER@ p) { |
Instead of
p.xPos / 32, try int(p.xPos / 32). Otherwise you're comparing a float to an integer and the chances are rather lower they'll be equal. |
Quote:
|
I spent half an hour searching for a way to make the bats follow you all over the map.
All I found is that setting var[0] and var[11++] to 0 makes them chase you when you're close (and for some reason makes them shout while they're NOT awake and viceversa) And setting these to anything else makes them NEVER chase you. I also can't change their movement speed for chasing you. I didn't want to bother you with more requests, but I can't do this by myself. So, how do I give bats unlimited range? And how do I change their chasing speed? |
Most of behavior constants for the majority of objects are hard-coded so you can't technically change only the distance bats detect you from or chase you from without rewriting the whole behavior. However, the position bats return to when they lose interest is their (xOrg, yOrg), so you could keep setting those to player's current position in order to make the bat chase them regardless of whether the range check succeeds. The variable you mention, var[0], stores ID of currently chased player, so you should use
Code:
const jjPLAYER@ player = jjPlayers[obj.var[0]];Code:
obj.xPos = obj.xPos + (obj.xOrg > obj.xPos ? 2.f : -2.f);Code:
void bat(jjOBJ@ obj) { |
I got a code that does not work in multiplayer, it might be because it uses local variables, what I mean is that, if I join as a server it works, if I join as a normal player it crashes.
Code:
array |
"Crashes" tells me nothing. Is it an Access Violation, or an other kind of error? If it's an Access Violation, what are the two addresses listed in the message?
|
Yea it is.
"At adress 0043CC2Bh by attempting to read from adress 9F763A48h" EDIT: Maybe I gotta put [p.localPlayerID]? I tested that with the blaster reloading script, if I remove all the p.localPlayerID it crashes, if I have them, it works fine. I'll test that. EDIT 2: Still not working... Also here's the new magic code: Code:
bool access = true; |
The error is not caused by your script. Your script is technically correct (except for the accidental undefined reloadBlaster call in your latest post). The only problem it has is that
p.health = 4; is a poor choice because, a) it's not obvious why this is done and b) the health change will cause a status update packet to be sent, which means unnecessary efficiency loss that could be avoided (finding a way to do so is left as an exercise for the reader).The crash is most likely caused by the level alone but finding the cause proves troublesome. From the access violation error window, please provide the value of ESI. |
reloadBlaster is not accidental, I didn't wrote the functionon the forum.
|
Welp... still not working, even though I am not changing health, I am just using it.
Let's try do it without even using health at all. EDIT: There's no way I can make this without testing for health, I need a onDeath function. |
I already said your script doesn't cause this error so your further modifications will not fix it. If I wanted you to avoid using the health variable, I would say so. What I said where I was talking about possible improvements to your script is that you should avoid writing to this variable when unnecessary because it involves additional actions, which in turn decrease efficiency, i.e. script execution speed. Most importantly, I never said avoiding its use would get rid of the error you experience, as that would be untrue. Now focus on what I wrote and notice I requested the value of the ESI register at the point of crashing that you can obtain from the error message. This is currently the only information from your side I'm interested in.
|
The ESI is 6h.
Also it would be possible to do my script on a function, instead of putting the death pit on the level I could add a line of "Text" events in the level at the bottom of the level. |
It appears that somewhere in your script you're trying to call
jjPLAYER::showText on a non-local or undefined player. JJ2+ probably has a bug that makes this action potentially crash the game, thank you for the report; regardless of that though, calling it on a non-local player would have no effect and therefore also likely indicates a bug in your script. The call is likely to have a form of p.showText somewhere in the onLevelLoad hook function but that's just one of the possibilities. In case your code really contains references to the global variable p / jjP as the symptoms would suggest, you should consider completely refraining from its use, as mixing deprecated and new features may and will result in undefined behavior. |
This is the only place I use show text:
Code:
void onLevelBegin() {There's something wrong... I tested another level without the code that originally I thought it crashed when other client joins. About 1 month ago that map worked successfully, no crashes on multiplayer, so... it... might be... something with my server? |
That really should be
Code:
jjLocalPlayers[0].showText |
Quote:
It's interesting that people were able to join on my server 1 or 2 months ago, without any problem and it had Code:
p.showTextthen. Everyone: Note that one line of your code could damage your entire level. |
Quote:
Also you declared the variables "fallTimer" & "maxFallTime" twice. (I moved this reply from the JJ2+ Thread to this thread) |
Quote:
|
Just wondering, but can Devan Shell be a playable character using Angel Script?
|
| All times are GMT -8. The time now is 12:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
JCF © 2001-Infinity Jazz2Online