Scripts / Starting Equipment

Author
Message
Noktavian
9
Years of Service
User Offline
Joined: 4th Mar 2015
Location:
Posted: 9th Mar 2015 16:42 Edited at: 9th Mar 2015 18:36
Probably not the smartest question you have heard, yet where can I change the code to make it to where I can start the game with the characters only
having the weapons I want them to have, and can gain none from the level?

First part of a idea, will continue this line of questioning after I see if it is available.

Thank you.

Edit: The reason for the none pick up is not for them not to gain it, yet instead for it to go into an inventory window, which was to be the next question. How to make an Inventory.
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 9th Mar 2015 19:10
place a player marker and in the properties you can give him 1 weapon (1 only for now)
if you want more you would need to create the script yourself - it's easy enough but does require the weapons being on the map (even if hidden)

for an inventory you'll need to script it yourself.
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Noktavian
9
Years of Service
User Offline
Joined: 4th Mar 2015
Location:
Posted: 9th Mar 2015 19:50
smallg i really have no idea how to use any language, yet am looking into lua tonight. Sorry i was not around for FPSC and only got GG less than a month ago and am tooling around with making levels. Is there someplace you could send me for the kind of coding to learn that it would take to be able to create an inventory section, and how to implement the items to go in.

In addition, i already looked at your script page and was interested in the loot script, yet it has a broken link. Could you please send me to the currect location.

Thank you in advance
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 9th Mar 2015 21:47
i didnt use classic either but it's not a problem, GG uses a different language than classic did but welcome anyway

hmm i guess all my links are broken since the name change, they are all for older versions anyway and likely need some tweaks to work again now eitherway - the loot script was merely a prompt based item, not a real item, that appeared next to dead bodies.
the new link would be here https://forum.game-guru.com/thread/207801?page=2#msg2488745

depends how far you want to go with the inventory, the best thing to do is look into a script for a shop type system (so you can see how to handle swapping items etc and learn about arrays so you know how to effectively store those items for a start i guess.
my newest shop script might be good if you can understand it, it's not an inventory as such but as you can see from the images on screen it's got things in common https://forum.game-guru.com/thread/207801?page=6#msg2511359

however we still only have the ability to show 1 image and no mouse control so you will need to be creative about your actual inventory screen and selection method (hence the cycle method i used for my shop) or use an add-on like omega core
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Noktavian
9
Years of Service
User Offline
Joined: 4th Mar 2015
Location:
Posted: 10th Mar 2015 01:32
Thank you smallg

Getting ready to look into the basics of lua any minute now, as well as tomorrow to try to implement them into the grand scheme of things

Like I said, no experience coding, and until now, no desire.

I take a great deal of pride into making levels, and I know it will serve me well to learn how to truly engulf the use of all available assets

Once again, thank you for your time
PM
Noktavian
9
Years of Service
User Offline
Joined: 4th Mar 2015
Location:
Posted: 10th Mar 2015 01:43 Edited at: 10th Mar 2015 03:27
O.k. I see how the script on the loot works, yet can you help me to figure out how to make it random.

I don't need you to create the whole process, yet a hint, or help would be much appreciated

Thanks again

It would have to be if/then code with percentiles is the only thing I can come up with right now.

If you have a better idea, I would love to hear it.
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Mar 2015 11:44 Edited at: 10th Mar 2015 11:53
yep another array to hold the chance of the drop would be good idea (so you can chance it easy) when you store the initial loot data, then use math.random to determine if it's dropped or not for all possible loot

if you want to be more specific you could create multiple versions/scripts and give different enemies different % chance

something like
edit, code snippet not working
edit again... the forums are so broken now... post wont show properly
[quote=]chance[1] = 90 --high drop rate
chance[2] = 40 --med drop rate
chance[3] = 10 --low drop rate
max_loot = 3

for a = 1 to max_loot
if math.random(1,100) less than (symbol not working it seems) chance[a] then
item[a] = item[a] + 1
exit --optional exit to drop only 1 item
end
end[quote]
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Noktavian
9
Years of Service
User Offline
Joined: 4th Mar 2015
Location:
Posted: 10th Mar 2015 14:15 Edited at: 10th Mar 2015 16:31
Ok.

So to bring about a random within the random drop chance for the type of drop, it would use basically the same math equation just with different variables and results. Excellent.

Yet the items I'm wanting to drop are not in the database, and are going to be regeants and materials for crafting.

All such things, even the weapons are going to be damaged and unable to be used.

Edit: Where do i place the script, i've just been writing and i don't know which folder it goes into

Edit: Found where to place script
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Mar 2015 15:51
use math.random(low,high) to return a random number and use that instead for the chance then yep

if you're willing to do the work then yes of course you can create any items and shop database for anything, just requires you to code it all in
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Noktavian
9
Years of Service
User Offline
Joined: 4th Mar 2015
Location:
Posted: 10th Mar 2015 19:21
@smallg

Is there a way to attach a re-spawn to a given model in a zone instead of to the entire type of mob?

My question isn't can you help me script a re-spawn, i've figured out how to do that. I just need to know how to affect targets only on one map.

Hope you can help.
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 10th Mar 2015 19:47
if you mean the spawn from hidden then just change it's name?
or you can use Spawn(e) on the model's script (or another if you use it's specific entity number)

you can't respawn a dead character though
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Noktavian
9
Years of Service
User Offline
Joined: 4th Mar 2015
Location:
Posted: 10th Mar 2015 23:31 Edited at: 11th Mar 2015 02:04
No not a re-spawn as in bring it back to life.

As in,

spawn_inti(e)

spawn_main(e)
if HP < 1 then
spawntimer = 100
maxspawn = 1
if spawntimer = 100 then
spawn = +1

end

This is what it should look like right? And can i put it in global to attach to all mobs?

Sorry am learning lua from the tutorials and I know this isn't what your script looks like.

Would try it on my own, just don't know where it is placed to be attached to all enemies?

Is the time as of seconds minutes or hours?

When i set the time to 100 which of these is it calculating?

Do i have to lock possition where the mob started from on an individual bases, or can i attach a
universal script with possitioning as a broad ideal?

Meaning can i just write something like this to affect all of them (with first script first)

spawn_init(e)

spawn_main(e)

if HP < 1 then
spawntimer = 100
maxspawn = 1
if spawntimer = 100 then
spawn = +1

if spawn = +1 then
possition_current "x = 0 "y = 0 "z = 0(e)

set_math = 1,100(e)
if < 1 HP then
if math = < 20 then
spawn_entity = entity (a)
if math = 21,40 then
spawn_enity = entity(b)
if math = 41, 60 then
spawn_entity = entity(c)
if math = 61,100 then
spawn_entity = entity(d)


end

Edit: used a random decider to indicate a random spawn between different entity names. Could you tell me if it would work. Once again not sure where to place it to test it out.

Edit: should i change the math part to be above the spawn entity type?

Edit Again: found the mistake the if then goes before the result
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 11th Mar 2015 19:43
if you want to input all the individual entity numbers it's possible to do it all from 1 script however it's generally easier to attach the script to all entities to be effected and then you can simply use 'e' (which refers to it's own number)
basically think of the global as more of a settings store which should be used as an information reference, not as an active script

i'm not sure i understand what you're asking for, you say not a respawn and yet you have something relating to 0 HP... are you looking to spawn the next enemy after 1 dies?

you will still need the script attached to each enemy which tells them how to act (shoot player etc) 'in most cases this will be 'ai_ something.lua' so you will need to copy & save that so you can modify it to suit your new needs.

the default timer 'GetTimer(e)' works in milliseconds.

there is also an exit call on scripts which gets updated once an enemy is killed, you may want to place some code there to spawn the next enemy
if you place them in order on the map you could simply call
Spawn(e+1)
on each entity (just set an if statement to handle the last call so it wont error - or place at least 1 object after all enemies)

you could however definitely check for the random number to spawn enemies but remember scripts get checked constantly so you would need a very large range otherwise they would spawn very close together (time wise)

for position you set the entity number along with the coords in the call so up to you how you do it.

hope that helps

life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Noktavian
9
Years of Service
User Offline
Joined: 4th Mar 2015
Location:
Posted: 11th Mar 2015 21:36 Edited at: 12th Mar 2015 20:24
Let me get this straight. Taking from top to bottom

so i can affect the entire level by placeing it in the correct location in the map lua script?

I am speaking of a respawn, yet i didn't want to confuse and just interjected as a new model

i can do that in each individual script? such as hippyzombie, or fatzombie, or soldier script?

Thank you for time scale

Instead of placing to each enemy, once again, could i place it in the lua script for each individual type of mob?

Edit: Sorry was very tired during this response. I see everything you were talking about. Thanks again

so for the possition script could i do something similar to this

if HP < 1 then

x1= math.floor(g.PosX)(e)
y1 = math.floor(g.PosY)(e)
z1= math.floor(g.PosZ)(e)

Pos = X = x1
Pos = Y = y1
Pos = Z = z1

spawn_Pos = x1_y1_z1(e)

would that work for possitioning?
PM

Login to post a reply

Server time is: 2024-12-21 14:49:13
Your offset time is: 2024-12-21 14:49:13