Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsCog Forum → All Force Powers in specified sector
All Force Powers in specified sector
2004-07-04, 4:49 PM #1
Lol, teleport problem solved, on to the next idea.

Remember, some weeks ago we succeeded in making a cog that switches light and darkside in a specified sector. (In this case, a secret room in my temple)

While discussing the cog, EAH_LunatiK showed us a cog that gives all the Force Powers; the cog equivalent of 'über'. This made me think of a second (very very secret) room in my temple, where players will have command over all the Force Powers from both sides. (A true place of power)

So actually, this one room will let players be 'legally über', lol.

So what I did is take the code provided by EAH_Lunatik and change it a little, to have it working upon entering a sector.

It works, but once you've entered the sector, the 'über effect' will permanently stay with you (after leaving the sector, or dying). It's because I didn't know how to return the player to his 'original state' upon leaving the sector.

So my question is: Can anybody tell me how to return the player to his 'original state' upon leaving the sector? (In other words, remove the über effect and restore orginal Force Powers).

Here's EAH_Lunatik's cog (plus my little additions).

PS Lunatik, I am aware that, by changing your cog, it's not going to pass checksum anymore. In my opinion it doesn't need to pass checksum because it's meant to be in a level, so all people who play the level have this same cog anyway)

Code:
# Jedi Knight Cog Script
# Sector_über.cog
# Gives all Force powers in specified sector
# 06/2004 by EAH_XxLuNaTiKxX, minor additions by ORJ_JoS

flags=0x240

symbols

thing	player	local
sector	übersector
sound	entry_snd=accomplish1.wav
message entered
message pulse
end

code

entered:
	playsoundlocal(entry_snd, 1, 0, 132);
	Print ("...you now have full command over both sides of the Force...");
player = GetLocalPlayerThing();
Sleep(1.0);
SetPulse(1.0);
Return;
if(GetThingHealth(player)) Return;
pulse:
for(ReN = 21; ReN < 35; ReN = ReN + 1) //1, for() loops are great, aren't they?
{ //2,
SetInv(player, ReN, 4); //3,
SetInvAvailable(player, ReN, 4); //4,
} //5.
SetPulse(-0);
SetInv(player, 14, 400), EAH_LuNaTiK_Wrote_This;
Return;
end


------------------
ORJ_JoS
=Council Member=
+Order of Reborn Jedi+

http://www.rebornjedi.cjb.net

Long live JK! =Best Game Ever=

[This message has been edited by ORJ_JoS (edited July 04, 2004).]
ORJ / My Level: ORJ Temple Tournament I
2004-07-04, 5:14 PM #2
Basically, you need to record somewhere which values the player had before you changed them. Unfortunately, this get to be a little harder since there will probably be more than one player using this cog at the same time. I will let others try to figure a way to do that since I have a really stupid bug in my own cog which is taking my time.

Anyway, the line
Code:
if(GetThingHealth(player)) Return;
between the entered and pulse messages, does absolutely nothing as far as I know, since there is no message which can access that line.

Secondly, since the player is defined as GetLocalPlayerThing() it will be the host, whether or not the host was the one to enter the sector. Use the GetSourceRef() verb which I said in your other thread. That will return the object which entered the sector, not the host.

Finally, just to be safe, I would take only the lines of code which you need out of this cog and remove the other junk (ex. EAH_LuNaTiK_Wrote_This) If he wants credit, just put it in the top comment section, not in the code. (If EAH won't let you remove that part of the code, then just use new variables and say it was your own. He can't copyright a basic code block like this, but I would still give him credit.) This is just to prevent miscellaneous bugs from cropping up, and also to make the code more readable for us who are trying to help you [http://forums.massassi.net/html/smile.gif]

------------------
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2004-07-04, 8:06 PM #3
A simple modification of the "switch powers" cog should work.

I'll try to do it, if not, hopefully zagibu can fix it, lol...

Code:
code

# Jedi Knight Cog Script
# FullForceSector.cog
# Gives a player full force in specified sector, only
# 06/2004 by LKOH_SniperWolf; based on code by Zagibu(ForceTwist.cog)
# minor fixes by The_New_Guy & Lucky_Jackpot
flags=0x240
symbols
flex forceCache0 local
flex forceCache1 local
flex forceCache2 local
flex forceCache3 local
flex forceCache4 local
flex forceCache5 local
flex forceCache6 local
flex forceCache7 local
flex forceCache8 local
flex forceCache9 local
sector forceFull
thing player local
sound entry_snd=accomplish1.wav
message entered
message exited
end

code

entered:
playsoundlocal(entry_snd, 1, 0, 132);
Print ("...you sense a great disturbance in the Force here...");
Sleep(2.5);
Print ("...you feel the powers of all the force within you...");
Sleep(2.5);
for(i = 0; i < 10; i = i + 1){
    forceCache0 = GetInv(player, 25 + i);
    SetInvAvailable(player, 25 + i, 4);
}
return;

exited:
player = GetSourceRef();
if(GetSenderRef() == forceFull){
    for(i = 0; i < 10; i = i + 1){
        SetInvAvailable(player, 30 + i, forceCache0);
    }
}
return;

end


I'm fairly certain that should work. On the whole, it seems it's easier to give full force and then return the powers than to switch them.

------------------
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come

[This message has been edited by LKOH_SniperWolf (edited July 04, 2004).]
_ _ _____________ _ _
Wolf Moon
Cast Your Spell On Me
Beware
The Woods At Night
The Wolf Has Come
2004-07-04, 11:31 PM #4
I wrote something similar to what you're after for a MP level that I'm (very slowly) developing - basically when the player picks up a lightsaber they get force-powers dependent on the rank of the game set by the host, (with rank 8 getting virtually all powers - one force power star off both absorb and destruction) [http://forums.massassi.net/html/wink.gif]

You're original script would work ORJ, if you took out the "SetPulse(1.0)" line, because that's being triggered by the "entered" message from that sector and "Pulse" messages are called repetitivly on the time delay specified (unless set to 0).

I'll try and have a look at home for some code, because I can't remember all the bin numbers off the top of my head, although "for" loops are the most efficient way of trying to achieve the result you're after [http://forums.massassi.net/html/biggrin.gif] (so until later... [http://forums.massassi.net/html/smile.gif])

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX
"jackpot is an evil evil man... so evil, in fact, that he's awesome." - Seb

"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-07-05, 1:57 AM #5
Alright, thanks for all the thinking, people. [http://forums.massassi.net/html/smile.gif] I was just fiddling around, not knowing exactly what I'm doing. Sniperwolf's approach seems to make sense.

Thanks, Sniperwolf, I'll test it out, and check here later to see if Jackpot can add anything.

(And SG-fan, I think EAH_LunatiK inserted some parts of that cog only to make it pass checksum. I really don't know what every part does, so I just didn't mess.)

------------------
ORJ_JoS
=Council Member=
+Order of Reborn Jedi+

http://www.rebornjedi.cjb.net

Long live JK! =Best Game Ever=

[This message has been edited by ORJ_JoS (edited July 05, 2004).]
ORJ / My Level: ORJ Temple Tournament I
2004-07-05, 2:41 AM #6
Ok, I tested Sniperwolf's version, here's the results:

(Tested it on 1 comp only, so I don't know about client/server problems yet)

I enter the sector, and first I check my Jedi Powers in the menu. Nothing seems to have changed, I have my old force star allocation.

Ingame, there are changes though. I get to use all the powers, but:

-Destruction does not display the explosion
-Protection lasts only a split second and drains all my force energy at the same time

Once I leave the sector:

- Deadly sight is gone, but for the rest I still have everything; light and dark plus protection. (working in the same way as described above)

Another anomaly:

I play SBX, and once I leave the FullForceSector, my SaberThrow and ForcePush are gone. As long as I stay in the FullForceSector, I can still use them, but once I have left it, they're gone. The old ForceTwist cog doesn't have any of these problems.


------------------
ORJ_JoS
=Council Member=
+Order of Reborn Jedi+

http://www.rebornjedi.cjb.net

Long live JK! =Best Game Ever=

[This message has been edited by ORJ_JoS (edited July 05, 2004).]

[This message has been edited by ORJ_JoS (edited July 05, 2004).]
ORJ / My Level: ORJ Temple Tournament I
2004-07-05, 3:57 AM #7
i'f no ones fixed this by tomrow i'll have a crack at it, untill then here is an idea for you..

use a synced cog that runs localy not an unsynced local cog (the flags at the top)

store all the players BIN's from the first force power to the last in a heap, then when the leave you'll have a neat record of there orginal settings.

as for destruction and protection.. i dont know..

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-07-05, 5:31 AM #8
Thanks, PJB. Although I have no idea how to do that, lol.

I'd like to add that EAH_LunatiK's method (the first cog I posted), does work perfectly. No anomalies with regards to Force Powers whatsoever. It just doesn't switch back to the orginal state upon leaving the sector, that's all.

------------------
ORJ_JoS
=Council Member=
+Order of Reborn Jedi+

http://www.rebornjedi.cjb.net

Long live JK! =Best Game Ever=
ORJ / My Level: ORJ Temple Tournament I
2004-07-05, 9:52 AM #9
I have not tested it over multiplayer, but it works in single play.

Code:
# Jedi Knight Cog Script
# Sector_über.cog
# Gives all Force powers in specified sector
# 06/2004 by EAH_XxLuNaTiKxX, minor additions by ORJ_JoS
# 7/5/2004 Completely overhauled by SG-fan

flags=0x240

symbols

flex forceCache0 local
flex forceCache1 local
flex forceCache2 local
flex forceCache3 local
flex forceCache4 local
flex forceCache5 local
flex forceCache6 local
flex forceCache7 local
flex forceCache8 local
flex forceCache9 local
flex forceCache10 local
flex forceCache11 local
flex forceCache12 local
flex forceCache13 local
flex forceCache14 local

flex forceavail0 local
flex forceavail1 local
flex forceavail2 local
flex forceavail3 local
flex forceavail4 local
flex forceavail5 local
flex forceavail6 local
flex forceavail7 local
flex forceavail8 local
flex forceavail9 local
flex forceavail10 local
flex forceavail11 local
flex forceavail12 local
flex forceavail13 local
flex forceavail14 local

flex forcetotal local
flex forcerank local

thing	player	local
sector	übersector
sound	entry_snd=accomplish1.wav
message entered
message exited
end

code

entered:
	playsoundlocal(entry_snd, 1, 0, 132);
	Print ("...you now have full command over both sides of the Force...");

player = GetSourceRef();
Sleep(1.0);

forcerank=GetInv(player, 20);
SetInv(player, 20, 8);

for(ReN = 21; ReN < 35; ReN = ReN + 1)
{
	forceCache0[ReN-21] = GetInv(player, ReN);
	forceavail0[ReN-21] = IsInvAvailable(player, ReN);
	SetInv(player, ReN, 4);
	SetInvAvailable(player, ReN, 1);
}
forcetotal = GetInv(player, 14);
SetInv(player, 14, 400);
Return;

exited:

player = GetSourceRef();

SetInv(player, 20, forcerank);

for(ReN = 21; ReN < 35; ReN = ReN + 1)
{
	SetInv(player, ReN, forceCache0[ReN-21]);
	SetInvAvailable(player, ReN, forceavail0[ReN-21]);
}
SetInv(player, 14, forcetotal);
Return;
end


------------------
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2004-07-05, 11:33 AM #10
Whoa, you did a lot of work! Thanks, I'll test this one. (Only problem is: my second comp needs to be reinstalled first, lol)

------------------
ORJ_JoS
=Council Member=
+Order of Reborn Jedi+

http://www.rebornjedi.cjb.net

Long live JK! =Best Game Ever=
ORJ / My Level: ORJ Temple Tournament I
2004-07-05, 2:33 PM #11
Dude, my compliments! That works perfectly. [http://forums.massassi.net/html/biggrin.gif]

Original status is neatly restored when exiting the sector. All Force Powers behave normal, no SBX powers affected.

So it looks like it's working... I still have to test it with 2 comps to be sure.

And I have to check with multiple players.... what PJB said about syncing seems to make sense. Is it set up like he suggested?

Anyway, good job, maybe it only needs a little fine tuning after testing it on 2 comps, but who knows....it might be already perfect...just need to check..lol

------------------
ORJ_JoS
=Council Member=
+Order of Reborn Jedi+

http://www.rebornjedi.cjb.net

Long live JK! =Best Game Ever=
ORJ / My Level: ORJ Temple Tournament I
2004-07-05, 10:12 PM #12
Apologies about not posting - things cropped up in "real life TM" [http://forums.massassi.net/html/rolleyes.gif]. However, I see everything's been dealt with now [http://forums.massassi.net/html/smile.gif]

Everything in SG-Fan's cog script is performed locally (hence the 0x240 flags setting at the top), which is probably the best way for direct player (or technically "source") inventory access in this case, especially when the events are tiggered by certain sectors and it should work fine on 2+ machines [http://forums.massassi.net/html/smile.gif]

I'd have done maybe a couple of different things (only a couple of small checks, but essentially the same bulk part of the code [http://forums.massassi.net/html/smile.gif]) but hey - that's just me (being picky [http://forums.massassi.net/html/wink.gif]); SG-Fan's code works a treat and it does what you need so everyone walks away a winner [http://forums.massassi.net/html/wink.gif] [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX
"jackpot is an evil evil man... so evil, in fact, that he's awesome." - Seb

"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-07-05, 10:18 PM #13
[edit] just so it doesn't look like I ignored Jackpot's post, I was typing this when he posted. If I contradict him or repeat what he said, oops [http://forums.massassi.net/html/tongue.gif]. [/edit]

Unfortunately, I did not do the syncing that PJB suggested. It would be too much work to fit into my schedule to try to get heaps and syncing to actually work bugless. (last time I tried heaps, I completely crashed MOTS)

If we're lucky, the local flags will make the cog work properly in multi, but don't get your hopes too high. For some reason, I just don't feel that the cog will work. Don't know why, there's just something I don't like. Eh, probably just bad feelings about syncing in multiplayer due to my ship cog. Try not to listen to my ranting.

------------------
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"

[This message has been edited by SG-fan (edited July 06, 2004).]
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2004-07-05, 10:45 PM #14
Lol,ok. And no need to go through that syncing stuff if it works, right?. We'll just see how it behaves in MP. I'll let you guys know asap.

I have to completely reinstall my second comp first, lol, arrrg.

------------------
ORJ_JoS
=Council Member=
+Order of Reborn Jedi+

http://www.rebornjedi.cjb.net

Long live JK! =Best Game Ever=
ORJ / My Level: ORJ Temple Tournament I
2004-07-05, 11:02 PM #15
I hope we don't have to mess with syncing. It will either go really smoothly, or be a real pain.

------------------
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
Sam: "Sir we can't call it 'The Enterprise'"
Jack: "Why not!"
2004-07-05, 11:42 PM #16
What SG-Fan said ^^^ [http://forums.massassi.net/html/wink.gif] [http://forums.massassi.net/html/biggrin.gif] - and don't worry - I'm used to being ignored [http://forums.massassi.net/html/wink.gif] - heck isn't that part of the small-print when you join Massassi... [http://forums.massassi.net/html/biggrin.gif]

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX
"jackpot is an evil evil man... so evil, in fact, that he's awesome." - Seb

"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-07-06, 1:03 AM #17
Quote:
<font face="Verdana, Arial" size="2">Originally posted by SG-fan:
I hope we don't have to mess with syncing. It will either go really smoothly, or be a real pain.

</font>


since i discovered triggers i've been wanting to mess with syncing.. its so challangeing.
but the point i was makeing is that i'm not entirly shure how force poweres are handeled, weather its the host or local, now if its local then its fine to run the cog unsynced, but if its on the host you want it to run localy but synced.
so its basicaly the difference between the 0x240 flag (unsynced local) and the 0x40 (synced local)... if it dosent work properly in multiplayer you may want to try changeing that..


on SG's point of heaps crashing the game, that only happens if you acsess a heap that hasent been set, or a heap higher than the maximum, its basicaly because a heap is a C style array and to acess it in the wong place can cause JK to overwrite memory used by other programs, possibly causeing the computer to crash, so JK terminates itself insted. because of that i normaly use a for loop to set all the heaps components first.
EG.
Code:
startup:
heapnew(0,max+1)   //  max+1 as the heaps max is allways one lower than the max
for(i=0;i<=max;i=i+1)
{
heapset(i,0); //set up every pointer in the heap
}
return;
entered:
for(bin=0;bin<=max;bin=bin+1)
{
heapset(bin,getinv(player,bin)) //set up the heap with the bins
setinv(player,bin,1);  //enable bin (not shure on the exacts of this its commeing out memory
}
return;

exited:
for(bin=0;bin<=max;bin=bin+1)
{
setinv(player,bin,heapget(player,bin));//return to orginal
}
return;
}


thats jsut an example from memory, dont go useing it or anything, but in theory that should work.. if i typed it properly

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-07-06, 1:29 AM #18
Thanks for having a look at it, Jackpot, and well, I won't blame you when you don't have time to post, don't we all have 'normal lives'? [http://forums.massassi.net/html/wink.gif] I'm happy with all the help I can get [http://forums.massassi.net/html/smile.gif] You're always poking your nose in my threads, and that's a very comforting thought [http://forums.massassi.net/html/biggrin.gif]

I really appreciate all your efforts people.

PJB, as always, what you say is completely beyond my grasp (technically). But that doesn't really matter as long as it makes sense to the other people who read this, and I'm sure it does. Btw, remember the guy on MSN messenger who helped you with your earache a couple of months ago? That was me [http://forums.massassi.net/html/wink.gif]

------------------
ORJ_JoS
=Council Member=
+Order of Reborn Jedi+

http://www.rebornjedi.cjb.net

Long live JK! =Best Game Ever=

[This message has been edited by ORJ_JoS (edited July 06, 2004).]
ORJ / My Level: ORJ Temple Tournament I
2004-07-06, 4:08 AM #19
Oh, now i rember you, i must have you on my MSN still then.. i hope.. prehaps i can help you with your cog!

------------------
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
I am Darth PJB!
well, go on, run away!

i have a plastic lightsaber and a jedi cape.. am i a nerd?

If gravity is a crule mistress, and bar tenders with bad grammar are untrustworthy, what is air?
2004-07-06, 5:11 AM #20
Well, you're helping already, aren't you? [http://forums.massassi.net/html/smile.gif]And yes, I still have you on my MSN. I'm mostly on MSN in the late evening (that's afternoon or early evening for US). I think we met eachother via Palidori.
Anyways, let's not derail this thread, lol.

Maybe we can test the cog together or something. I'll make a simple testlevel for it.

[This message has been edited by ORJ_JoS (edited July 06, 2004).]
ORJ / My Level: ORJ Temple Tournament I
2004-07-10, 3:51 AM #21
Well, good game, hope i got you somewhere with the original cog.

Let me know how SG-Fan's cog compares to mine... [http://forums.massassi.net/html/smile.gif]

EAH_XxLuNaTiKxX
2004-07-10, 6:00 AM #22
It seems to work well, although I still haven't tried it with multiple computers. Thanks a lot for that cog, it really adds something to my level. [http://forums.massassi.net/html/smile.gif] And no worries, I'm not the guy who won't credit people for all their work.

------------------
ORJ_JoS
=Council Member=
+Order of Reborn Jedi+

http://www.rebornjedi.cjb.net

Long live JK! =Best Game Ever=
ORJ / My Level: ORJ Temple Tournament I

↑ Up to the top!